Paidly — Invoice Generator

Freev1.0.0

Enterprise invoicing — gap-free numbering, dunning, recurring billing, a client portal, and a signed REST API — all in one production-ready SaaS starter.

saas-starterinvoicingbillingnextjstypescriptprismastripeauthjssupabaseresendreact-emailzodplaywright

Paidly — Invoice Generator

$0

Paidly — Invoice Generator v1.0.0-Wholesaas.zip · 1.2 MB

Free forever · MIT license · Personal license key

0 Wholesaas team
0 ratings
Sign in to rate
paidly-invoice-generator/screenshot-1
Free
Paidly — Invoice Generator screenshot 1
Full page

Overview

Paidly gives you a full invoice product and all the SaaS plumbing around it, so it works as either **a ready-to-run invoicing app** or **a reference implementation for your own SaaS**.

- **Workspaces** — invoices, clients, numbering, settings, API keys, and reports are all scoped to a personal account or an organization you belong to (switch via the topbar). Organizations get member roles, invitations, and their own billing.

- **Money done right** — all amounts are **integer minor units** (cents), rounded half-up with **BigInt**, so totals are exact and reproducible across currencies and tax regimes.

- **Tax-aware** — per-client currency, per-line tax rates, and both **tax-inclusive** and **tax-exclusive** pricing (inclusive derives net + tax out of gross), covering VAT/GST workflows.

- **Gap-free numbering** — per-workspace sequences (`INV-0001`) allocated inside the invoice transaction with `SELECT … FOR UPDATE` row locks; a failed insert rolls the counter back so there are never gaps or duplicates.

- **Built-in monetization** — FREE / PRO / TEAM plan entitlements enforced server-side, Stripe checkout and webhooks, recurring subscriptions, and a self-serve billing page.

- **Production hardening** — a server-only data access layer (the database, not the token, is the source of truth for authorization), CSP + security headers, rate limiting, HMAC-signed webhooks, and a complete audit log.

What's included

### Client & invoice management

- **Clients** — create/edit/delete with billing address, currency, payment terms, tax ID, and notes; list with outstanding balance.

- **Invoices** — dynamic line items (description, qty, unit price, per-line tax rate), percent/flat discounts, PO number, notes/terms, live totals preview.

- **Lifecycle** — draft → sent → paid, with computed overdue, partial payments, void-with-reason, re-open, and duplicate.

- **Gap-free numbering** with a configurable prefix.

- **VAT/GST** — per-line rates, tax-inclusive vs tax-exclusive pricing.

### Automation & delivery

- **Email** — branded react-email templates via Resend: send invoice, payment receipts, overdue reminders. In dev without a key, emails print to the server console and the send is still logged/marked SENT.

- **Dunning** — configurable grace / first / second / final reminder schedule with an automatic overdue job plus a manual "send reminder" per invoice.

- **Recurring invoices** — templates with frequency + next run; a lightweight scheduler generates and emails on schedule; run-now from the dashboard.

### Payments

- **Manual recording** — cash / check / bank transfer.

- **Stripe Checkout "pay now" links** (PRO+) with webhook reconciliation.

- **Public client portal** — token-gated `/pay/invoice/<token>` pages so clients view and pay without an account.

### API & integrations (PRO / TEAM)

- **REST API** — `/api/v1` clients + invoices with `sk_live_` / `sk_test_` API keys (**sha256-hashed at rest**, one-time raw display).

- **Webhooks** — HMAC-signed `invoice.created` / `invoice.paid` events with at-least-once delivery, retries, and a delivery log. Manage keys/endpoints under **API & webhooks**.

### Reporting & observability

- **Reports** — revenue by client, tax summary, and A/R aging with CSV exports.

- **Dashboard analytics** — revenue, outstanding, overdue aging buckets, and a 30-day chart.

- **Audit log** — every invoice/client mutation writes an `AuditLog` entry.

### Teams, admin & platform

- **Organizations** — invite members, roles (OWNER/ADMIN/MEMBER), invitations with expiry, per-org billing.

- **Admin panel** — users, organizations, subscriptions, moderation, audit, contact inbox, and admin invoicing.

- **Moderation** — suspend/ban with expiry, content flagging.

- **Privacy** — consent records, DPA/subprocessor/acceptable-use pages, data hygiene.

---

Get started

1

Download the ZIP

2

Unzip & install

Extract, then run npm install

3

Run it

npm run dev and start shipping

Basic usage

app/route.ts

File structure

paidly-invoice-generator/
.
├─ .env.example               # documented env template (committed, placeholders only)
├─ .env.local                 # real local secrets — GITIGNORED, never commit
├─ .gitignore
├─ next.config.ts             # CSP + security headers, image remote patterns
├─ playwright.config.ts       # e2e config + test env
├─ prisma.config.ts           # Prisma 7 CLI config (DIRECT_URL for migrations)
├─ vercel.json                # cron schedules (recurring invoicing, dunning)
├─ package.json
│
├─ prisma/
│  ├─ schema.prisma           # full data model: users, orgs, invoices, billing,
│  │                          #   payments, dunning, webhooks, audit, flags, api keys
│  ├─ migrations/             # SQL migrations
│  └─ seed.ts                 # demo data + sign-in accounts
│
├─ src/
│  ├─ app/                    # Next.js App Router
│  │  ├─ (marketing)/         # landing, pricing, features, about, faq, help, blog, contact
│  │  ├─ (auth)/              # sign-in, sign-up, verify-email, forgot/reset-password
│  │  ├─ (legal)/             # terms, privacy, dpa, cookies, refunds, subprocessors, aup
│  │  ├─ dashboard/           # invoices, clients, payments, reports, billing,
│  │  │  │                     #   settings, api keys, organizations, notifications
│  │  ├─ admin/               # users, orgs, subscriptions, moderation, audit, contact,
│  │  │                       #   invoicing, settings
│  │  ├─ moderation/          # content flagging
│  │  ├─ pay/invoice/[token]/ # public client portal
│  │  ├─ invitations/[token]/ # org invitation acceptance
│  │  ├─ styleguide/          # hidden design-token/styleguide page
│  │  └─ api/
│  │     ├─ auth/[...nextauth]/
│  │     ├─ v1/{clients,invoices}/          # REST API (API keys)
│  │     ├─ webhooks/stripe/                # Stripe webhook handler
│  │     ├─ cron/{recurring,dunning}/       # scheduled jobs
│  │     ├─ notifications/                  # email-send endpoint
│  │     └─ health/
│  │
│  ├─ components/             # UI components, grouped by feature
│  │  ├─ ui/                  # primitives (button, input, dialog, …)
│  │  ├─ layout/  theme/  motion/
│  │  ├─ marketing/  auth/  billing/  invoices/  clients/
│  │  ├─ organizations/  notifications/  moderation/  legal/
│  │  ├─ admin/  api/  dashboard/
│  │  └─ route-error.tsx  route-loading.tsx  session-provider.tsx
│  │
│  ├─ lib/                    # server logic (domain engines + cross-cutting)
│  │  ├─ money.ts             # integer minor units, BigInt rounding
│  │  ├─ invoice-numbering*.ts # gap-free per-workspace sequences (row locks)
│  │  ├─ invoice-totals.ts  invoice-status.ts  invoice-payments*.ts
│  │  ├─ invoice-dunning*.ts  recurring*.ts  invoice-settings*.ts
│  │  ├─ client-portal*.ts    # token-gated pay pages
│  │  ├─ api-keys*.ts  webhooks*.ts  webhooks-shared.ts
│  │  ├─ billing.ts  checkout.ts  stripe.ts  stripe-webhook.ts  plans.ts
│  │  ├─ auth-client.ts  session.ts  dal.ts  permissions.ts  organizations.ts
│  │  ├─ moderation.ts  admin.ts  admin-invoicing*.ts  audit.ts
│  │  ├─ analytics*.ts  reports.ts  csv.ts  notifications*.ts  mail.ts
│  │  ├─ blog.ts  seo.ts  site.ts  consent.ts  storage.ts  theme.ts
│  │  ├─ env.ts  db.ts  logger.ts  rate-limit.ts  tokens.ts  utils.ts
│  │  └─ validations/        # Zod schemas grouped by domain (auth, invoice, org, …)
│  │
│  ├─ emails/                 # react-email templates
│  │  ├─ _components/         # shared email UI
│  │  └─ invoice, invoice-receipt, invoice-reminder, payment-failed,
│  │     subscription-receipt, verify-email, password-reset, notification,
│  │     organization-invitation, contact-*
│  │
│  ├─ hooks/                  # use-overlay, use-floating-position, …
│  ├─ types/                  # next-auth module augmentation
│  ├─ generated/prisma/       # Prisma client (generated — gitignored)
│  ├─ server-only-stub.ts     # local `server-only` shim for tooling
│  └─ proxy.ts  auth.ts       # Auth.js + proxy helpers
│
├─ tests/                     # Playwright suites + helpers (gitignored .auth)
│  ├─ global-setup.ts  global-teardown.ts  auth.setup.ts
│  ├─ helpers/                # db helper + shared constants
│  └─ e2e/                    # auth, invoicing, billing, organizations,
│                             #   admin-moderation, access-control, contact, smoke
├─ scripts/                   # tsx unit tests + dev tooling (screenshots, concurrency check)
├─ public/                    # static assets (svg placeholders; ./img lives alongside)
├─ screenshots/               # local captures (review before publishing)
└─ docs/                      # optional; see docs/build-log for design decisions

MIT license

Free for personal and commercial use.

Read the license →

Paidly — Invoice Generator is free. Grab it.

A 1.2 MB ZIP, signed-in download, instant license key. The rest of the library is free too — explore more scripts.

Browse the library

Comments

Questions, feedback and experiences from members who shipped withPaidly — Invoice Generator.

Comments are reviewed before they appear — keep it constructive and on-topic.

No comments yet

Be the first to share your experience with this template.

Join the conversation

Sign in to leave a comment on this template.

Sign in to comment