Invoice Manager is a full-stack app for tracking invoices and customers. It is based on the dashboard application from the official Next.js Learn course, extended with my own additions. I built it to understand how Next.js handles data: server actions, dynamic rendering, streaming, and direct database queries. This post covers what I built and why.
The problem
Freelancers and small businesses need a simple way to create invoices, track payment status, and manage customer records. Most tools are either too complex or too expensive for someone managing a handful of clients.Invoice Manager handles the full lifecycle: create, edit, track status, and manage the customer list — with auth, pagination, and validation built in.
Stack
Next.js (App Router) with TypeScript and React
PostgreSQL on Vercel Postgres
Tailwind CSS for styling
Zod for schema-based validation (client and server)
NextAuth for authentication
I intentionally kept the stack tight. No ORM — direct SQL queries give full control over what runs against the database. Server actions validate every invoice form with Zod, and the edit form adds a client-side Zod check before it submits.
What I added to the course app
Customers page: wired up the customers table with search, showing each customer's invoice count and pending and paid totals.
Revenue from real invoices: the revenue chart sums paid invoices by month in SQL instead of reading a static revenue table.
Client-side validation on edit: a Zod check on the invoice amount in the edit form.
Rebranding: Invoice Manager name and logo, a landing page with a dashboard screenshot, and page metadata.
Vercel Analytics on the dashboard.
Data model
Two core tables:
Customers — name, email, image URL
Invoices: amount, status (pending/paid), date, customer ID
The relationship is simple: one customer has many invoices. Queries for the dashboard aggregate invoice totals and counts with SQL SUM and COUNT, and the revenue chart groups paid invoices by month with GROUP BY.
How it works
Server actions for mutations
All create/update/delete operations use Next.js Server Actions. Each action validates input with Zod, runs the SQL query, and calls revalidatePath to refresh the page data. No API routes needed for CRUD — the server action pattern keeps mutations colocated with the forms that trigger them.
Streaming and suspense
The dashboard uses React Suspense boundaries with streaming. The summary cards, the revenue chart, and the latest invoices each load independently. If the revenue query takes longer than the others, the rest of the page is already interactive.
Search and pagination
The invoices table supports server-side search (by customer name, email, amount, date, or status) and pagination. Both are implemented with URL search params so the state is shareable and bookmarkable. The search debounces input and updates the URL, which triggers a server-side re-fetch.
Authentication
NextAuth handles login with credentials, and passwords are stored as bcrypt hashes. Middleware redirects unauthenticated users to the login page and checks the session on every request to the dashboard.
Challenges
Streaming partial UI
Getting Suspense boundaries right required thinking about which data fetches are independent. The initial version had a single loading.tsx that blocked the whole page. Breaking the dashboard into independent Suspense boundaries — one per card/section — made the perceived load time much faster.
Zod on the client and the server
Form inputs arrive as strings, so the server actions use z.coerce.number() for the amount, while the edit form's client-side check works on a number it converts itself. I ended up with one base schema for the server actions, with derived versions for create and update, plus a small separate schema for the edit form.