Next.js Approval Workflow App for Expenses, Purchases and Time Off

An open-source approval workflow app for small and mid-size teams, built with Next.js, TypeScript and PostgreSQL. Admins build request types such as expense claims, purchase requests, time off, contract sign-off and software access with their own forms and approval chains, and approvers decide from a Waiting for me inbox with delegation, reminders, an audit trail, reports and CSV export.

by Light CloudInventory and operations, Invoicing and finance

Build an approval workflow app with Next.js and PostgreSQL

Waiting for me: seven requests at steps the signed-in approver decides, the longest-waiting first, with amounts, reminder clocks and two marked as decided for a colleague who is away
Waiting for me: seven requests at steps the signed-in approver decides, the longest-waiting first, with amounts, reminder clocks and two marked as decided for a colleague who is away, on a phone

Features

  • Request types with their own forms: text, number, money, date, choice and file fields, starting with five ready-made types
  • Approval chains by line manager, approver role or named people, with any-one or all-of steps and amount thresholds
  • Approve with a note, reject with a reason or ask for changes; the requester resubmits with their answers kept
  • Out-of-office delegation that also shows approvals to the delegate, and reassigning approvals stuck with someone who left
  • A Waiting for me inbox with the longest-waiting first and overdue steps flagged, plus My requests and All requests with CSV export
  • Reminders per step, a full audit trail with comments, and reports on volume, outcomes, time to approve and the slowest steps
  • Attachments stored in PostgreSQL with no set-up, served only as downloads to people who can see the request
  • A 20-person engineering firm demo with 79 requests, removed in one click, and WCAG 2.2 AA in light and dark

Tech stack

What you need

  • A paid plan: deploying creates a PostgreSQL database, which the Free plan does not include
  • To run it locally: Node.js 22.12 or newer, npm, and Docker for a local PostgreSQL
  • No API keys: it starts with nothing to configure, and attachments are kept in the database
  • Optional: RESEND_API_KEY and EMAIL_FROM to email approvals, reminders, decisions and invitations
  • Optional: CRON_SECRET and a scheduler that calls POST /api/cron/reminders, so reminders are on time on hosting that sleeps

About

The app is built on the Next.js SaaS starter's accounts, settings and admin, with the approval rules in src/lib/approvals and the chain logic unit-tested. Requests already in progress keep the chain they started with when an admin changes a request type, and nobody can approve their own request, even as a delegate. Reminders run on an in-app timer and when pages are viewed, so on hosting that sleeps when idle, such as Light Cloud's default, they go out on the next visit unless CRON_SECRET and a scheduler are set. Attachments on disk or in S3 and email through Resend are built but not yet tested against real services, and approval steps are reordered with up and down buttons rather than drag and drop. The first sign-up takes over the demo's Operations Manager seat, so signing up with exactly claire.thompson@leeds-engineering.example fails until it is claimed.

FAQ

How do I set up an approval workflow for expense claims?

Use the Expense claim type it comes with, or build your own under Settings, Request types: add the fields (date, category, amount, receipt), then the steps (line manager, then Finance, then a director over £500). Put people in the Finance and Directors roles under Settings, Approver roles and set line managers under Settings, People.

Can a purchase over a certain amount need extra approval?

Yes. Each step can have an amount rule, so it only applies when the request's amount is over the value. The purchase request starts as line manager, then Finance over £1,000, then a director over £5,000, and steps below their threshold show as skipped.

How does approval delegation work when an approver is on holiday?

Approvers set out-of-office dates and a delegate under Settings, Your account, and admins can set it for anyone. On those days waiting approvals also appear in the delegate's inbox, labelled with whose they are, and the audit trail records that the delegate decided on their behalf.

Do approval reminders work on hosting that scales to zero?

They run on an in-app timer and when pages are viewed, so a sleeping host sends them on the next visit. For reminders on time, set CRON_SECRET and have a scheduler call POST /api/cron/reminders every 15 minutes; add RESEND_API_KEY to email them as well.

Is there a free, open-source approval workflow app I can host myself?

Yes. This Next.js and PostgreSQL template is MIT licensed and runs on any Node.js host with PostgreSQL once DATABASE_URL and AUTH_SECRET are set, or on Light Cloud in one click, with no third-party keys needed.

Price
Free
Framework
Next.js · JavaScript
Updated

Variables

  • AUTH_SECRETGenerated