CodingIdeas.ai
← Browse All Ideas

Build Guide

How to Build an Invoice App

Freelancers send 500 million invoices per year — and 30% are paid late because the invoice was a Word doc attached to a Gmail.

Intermediate3–7 days

Invoice tools are evergreen, paid, and low-churn. Build one and you'll learn PDF generation, Stripe webhooks, recurring billing logic, and email deliverability.

Data model

The core tables you'll need before writing any UI.

Userid, email, business_name, address, tax_number, logo_url
Clientid, user_id, name, email, address, currency
Invoiceid, user_id, client_id, number, status (draft/sent/viewed/paid/overdue), due_date, subtotal, tax_rate, total, notes, stripe_payment_link, sent_at, paid_at
LineItemid, invoice_id, description, quantity, unit_price, total

Build order

The sequence that minimises rewrites — build in this order.

1

Invoice builder UI

Build the invoice form: your business details, client selector, line items table (description, qty, unit price, total auto-calculated), tax rate, and notes. Show a live preview alongside.

2

PDF generation

Use @react-pdf/renderer to define the invoice layout as React components. Call pdf().toBlob() to generate a PDF on demand. Show a download button and a preview iframe.

3

Client management

Create a clients table. Add a client selector to the invoice form. On selecting a client, auto-fill their address and currency. Add a simple client list page.

4

Invoice numbering and status

Auto-increment invoice numbers (INV-001, INV-002). Add a status field: draft → sent → viewed → paid → overdue. Update status when: you send it, the client opens it, Stripe confirms payment.

5

Send by email with pay-by-link

Create a Stripe Payment Link for the invoice total. Send an email via Resend with the invoice PDF attached and the pay link. Track when the link is opened using a redirect through your app.

6

Automatic payment reminders

A daily cron job checks for invoices where due_date < today AND status != paid. For each overdue invoice, send a polite reminder email with the pay link. Cap at 3 reminders.

7

Recurring invoices

Add a recurring boolean and interval (monthly/weekly) to invoices. A cron job duplicates the invoice on the correct date, resets status to draft, increments the number, and optionally auto-sends.

Build it with AI — Architect Prompt

Paste this into Claude, Cursor, Windsurf, or any AI coding tool. It includes the full context of this guide — data model, build order, and pitfalls — so the AI starts with everything it needs.

ClaudeCursorWindsurfCopilotGemini
architect-prompt.txt
<context>
App: Invoice App
Difficulty: Intermediate
Estimated build time: 3–7 days

Data model:
  User: id, email, business_name, address, tax_number, logo_url
  Client: id, user_id, name, email, address, currency
  Invoice: id, user_id, client_id, number, status (draft/sent/viewed/paid/overdue), due_date, subtotal, tax_rate, total, notes, stripe_payment_link, sent_at, paid_at
  LineItem: id, invoice_id, description, quantity, unit_price, total

Recommended build order:
  1. Invoice builder UI — Build the invoice form: your business details, client selector, line items table (description, qty, unit price, total auto-calculated), tax rate, and notes. Show a live preview alongside.
  2. PDF generation — Use @react-pdf/renderer to define the invoice layout as React components. Call pdf().toBlob() to generate a PDF on demand. Show a download button and a preview iframe.
  3. Client management — Create a clients table. Add a client selector to the invoice form. On selecting a client, auto-fill their address and currency. Add a simple client list page.
  4. Invoice numbering and status — Auto-increment invoice numbers (INV-001, INV-002). Add a status field: draft → sent → viewed → paid → overdue. Update status when: you send it, the client opens it, Stripe confirms payment.
  5. Send by email with pay-by-link — Create a Stripe Payment Link for the invoice total. Send an email via Resend with the invoice PDF attached and the pay link. Track when the link is opened using a redirect through your app.
  6. Automatic payment reminders — A daily cron job checks for invoices where due_date < today AND status != paid. For each overdue invoice, send a polite reminder email with the pay link. Cap at 3 reminders.
  7. Recurring invoices — Add a recurring boolean and interval (monthly/weekly) to invoices. A cron job duplicates the invoice on the correct date, resets status to draft, increments the number, and optionally auto-sends.

Known pitfalls to avoid:
  - Generating PDF on the server without a headless browser — @react-pdf/renderer works in Node.js without Puppeteer. Don't reach for Puppeteer (which needs a full Chrome install) until you outgrow react-pdf.
  - Marking invoices paid based on email reply — only trust Stripe webhooks (payment_intent.succeeded) to mark an invoice paid. Never mark it paid based on a customer email or manual input without verification.
  - Forgetting to handle partial payments — if a client pays $500 of a $1000 invoice via bank transfer, your status machine needs a partial state. Add amount_paid alongside the status field.

Tech stack (intermediate): Next.js + Supabase + Stripe + react-pdf + Resend — full pay-by-link flow
</context>

<role>
You are a Senior Full-Stack Engineer and product architect who has shipped production Invoice Apps before. You know exactly where developers get stuck and how to structure the project to avoid rewrites.
</role>

<task id="step-1-clarify">
Before writing any code or spec, ask me 3–5 clarifying questions that will meaningfully change the architecture. Focus on: scale expectations, auth requirements, platform (web / mobile / both), must-have vs nice-to-have features for the MVP, and any hard constraints (budget, deadline, existing infrastructure).

<example>
BAD: "What tech stack do you want to use?" — too broad, doesn't change architecture decisions.
GOOD: "Do you need real-time sync across devices, or is single-device with periodic refresh acceptable? This decides whether we use WebSockets or simple REST polling and significantly affects infrastructure complexity."
</example>
</task>

<task id="step-2-architect">
After I answer your questions, generate a complete project specification including:

1. Final tech stack with version numbers
2. Full file and folder structure
3. Complete database schema — every table, column, type, index, and foreign key
4. All API routes with request/response shapes and auth requirements
5. Component tree with TypeScript props interfaces
6. Auth and authorisation flow (who can do what)
7. Step-by-step implementation plan in the exact build order from <context> above
8. All environment variables with descriptions

<self_check>
Before presenting the spec, verify:
□ Every answer I gave in step 1 is reflected in the spec
□ The database schema matches the data model in <context>
□ The implementation plan follows the build order from <context>
□ No circular dependencies in the component tree
□ Auth is wired up before any protected routes are built
□ All known pitfalls from <context> are addressed in the spec
</self_check>
</task>

<task id="step-2.5-agents-md">
Generate an AGENTS.md file at the project root. This file is read automatically by Claude Code, Cursor, Windsurf, Sourcegraph Cody, and all major AI coding tools at the start of every session.

Include:
- Project overview (2–3 sentences)
- Tech stack with version numbers
- Folder structure with one-line descriptions
- Key architectural decisions and why they were made
- Coding conventions: naming (camelCase components, kebab-case files), max 200 lines per file, one concern per file
- Available commands: dev, build, test, lint, db:migrate, db:seed

Note in the file: "Cursor users can symlink .cursorrules → AGENTS.md. Claude Code users can symlink CLAUDE.md → AGENTS.md."
</task>

<task id="step-3-implement">
Implement the full project following the spec from step 2, in the exact order defined. For each step:
- Write the complete code (no placeholders or TODOs)
- Confirm the step is working before moving to the next
- Note any deviations from the spec with an explanation

<constraints>
- Max 200 lines per file. WHY: every file must fit in one AI context window for easy review and editing.
- One concern per file. WHY: mixing auth logic into API routes makes it impossible to reuse — extract to lib/auth.ts.
- TypeScript strict mode, no `any` types. WHY: catches data shape mismatches at compile time, not in production at 2am.
- All database queries in server components or API routes only. WHY: keeps credentials server-side, prevents accidental client-side exposure.
- All environment variables documented in .env.example. WHY: the next developer (or your future self) should be able to set up the project in under 5 minutes.
- Comment every non-obvious decision. WHY: AI tools read your comments to understand intent — without them, the next edit will break the pattern you established.
</constraints>
</task>

How to use this prompt

  1. 1.Copy the prompt above
  2. 2.Open Claude, Cursor (Cmd+L), or Windsurf
  3. 3.Paste the prompt and send — the AI will ask 3–5 clarifying questions
  4. 4.Answer the questions, then it generates your full project spec
  5. 5.Continue in the same session to implement step by step

Common mistakes

What trips up most developers building this for the first time.

⚠️

Generating PDF on the server without a headless browser — @react-pdf/renderer works in Node.js without Puppeteer. Don't reach for Puppeteer (which needs a full Chrome install) until you outgrow react-pdf.

⚠️

Marking invoices paid based on email reply — only trust Stripe webhooks (payment_intent.succeeded) to mark an invoice paid. Never mark it paid based on a customer email or manual input without verification.

⚠️

Forgetting to handle partial payments — if a client pays $500 of a $1000 invoice via bank transfer, your status machine needs a partial state. Add amount_paid alongside the status field.

Recommended tech stack

Pick the level that matches your experience.

Beginner

Next.js + react-pdf + Resend — invoices with PDF and email, no payment processing

Intermediate

Next.js + Supabase + Stripe + react-pdf + Resend — full pay-by-link flow

Advanced

Next.js + Supabase + Stripe + Puppeteer (PDF) + Twilio — professional billing suite

Take it further — related ideas

Each comes with revenue math, a full build guide, and a prompt to paste into Claude or Cursor.

9 ideas in the archive

Ship in:
beginnerBusiness Automation

ContractPulse - Vendor Renewal and Health Monitor for Bootstrapped SaaS Teams

Small SaaS teams routinely lose money on zombie vendor contracts because no one owns the renewal calendar. ContractPulse ingests your vendor invoices and emails, surfaces upcoming renewals, flags price drift, and sends Slack alerts 30 days out. It's the CFO dashboard you couldn't afford to hire.

Time to ship2 weeks
DemandHigh
Revenue7/10
AI quality score6/10
View Details →
beginnerGig Economy

GigHive - Single-View Project and Payment Pulse for Freelancers With 5+ Simultaneous Clients

Freelancers juggling five clients across email, Notion, Slack, and their brain have no single place to see what is due, what is unpaid, and what client is about to ghost. GigHive is the focused project and payment pulse tracker built for exactly this chaos.

Time to ship2 weeks
DemandVery High
Revenue7/10
AI quality score6/10
View Details →
beginnerProductivity

NoteShip - Shareable Public Pages From Obsidian Notes Instantly

Your Obsidian note is brilliant. Your client cannot open a .md file. NoteShip turns any Obsidian markdown paste into a shareable, readable public URL in one click — like Notion public pages but for people who actually write in Obsidian.

Time to ship1 week
DemandHigh
Revenue7/10
AI quality score6/10
View Details →
intermediateGig Economy

PawRoute - White-Label Booking App for Independent Dog Walkers

Independent dog walkers are hemorrhaging clients to Rover's 30% commission cut while managing everything via PayPal.me links and texts. PawRoute gives every solo pet care pro their own branded booking page, live GPS walk tracking for anxious owners, and Stripe-powered invoicing.

Time to ship3 weeks
DemandHigh
Revenue8/10
AI quality score8/10
View Details →
beginnerGig Economy

CoachSlot - Mobile Booking and Payments for Solo Fitness Coaches

Solo yoga teachers and PTs are running $5k/month businesses on WhatsApp and bank transfers like it's 2009. CoachSlot gives every solo fitness coach a personal booking link, Stripe card payments, and automatic cancellation fee enforcement — no more ghost clients.

Time to ship2 weeks
DemandVery High
Revenue8/10
AI quality score7/10
View Details →
intermediateNLP & Text AI

ClauseWatch - NLP Contract Clause Drift Detector for Recurring Vendor Agreements

Vendors quietly update contract clauses between renewal cycles and nobody notices until something breaks or a lawyer bills you $400/hour to find it. ClauseWatch uses NLP to diff contract versions, flag changed clauses by risk level, and summarize what actually changed in plain English.

Time to ship3 weeks
DemandHigh
Revenue7/10
AI quality score7/10
View Details →
intermediateBusiness Automation

TimeSync - Real-Time Monday.com to Toggl and Harvest Bridge With Full Task Context

Monday.com passes 'Monday App' as the project name to every time tracking tool, making billable hours useless for client invoicing. TimeSync listens to Monday board events and auto-creates Toggl and Harvest entries with the actual task name, board, and assignee so your timesheet actually matches your work.

Time to ship2 weeks
DemandHigh
Revenue7/10
AI quality score6/10
View Details →
beginnerSaaS

BookSlot - Freelancer-First Scheduling With Built-In Payments and Session Types

Calendly was built for sales teams, not solopreneurs charging $200/hour for consulting sessions. BookSlot is a scheduling tool where paid sessions, custom meeting types, and instant rescheduling are table stakes — not $20/month add-ons.

Time to ship2 weeks
DemandVery High
Revenue7/10
AI quality score6/10
View Details →
intermediateProductivity

FolderWise - AI File Organizer That Actually Reads Your Files Before Moving Them

Your Downloads folder is a crime scene and Finder's search is basically useless for 'that contract from last March.' FolderWise watches your messy folders, reads file contents via embeddings, and auto-proposes a clean structure you approve with one click. No more grep, no more manual sorting, no more hunting for that pitch deck.

Time to ship3 weeks
DemandHigh
Revenue7/10
AI quality score7/10
View Details →