Internal admin app for LPO management, fabric inventory, manufacturer fabric ledgers, and consumption rates.
Phases 0–5 complete — greenfield LPO + Fabric product with deadline email cron and GitHub Actions CI.
See docs/ROADMAP.md for product rules.
See docs/QA.md for the end-to-end manual test plan.
Dev databases were reset for the greenfield schema. Do not expect old LPO/fabric rows to migrate.
pnpm install
pnpm devOpen http://localhost:3001 → redirects to /login until signed in.
If Neon was sleeping, open the Neon dashboard once, then:
pnpm exec prisma migrate deploy
pnpm exec prisma generateCopy from .env.example and fill in:
| Variable | Purpose |
|---|---|
DATABASE_URL |
Neon pooled URL (…-pooler…) for the app + longer timeouts |
DIRECT_URL |
Neon direct URL (no -pooler) for prisma migrate |
AUTH_SECRET |
Random secret (openssl rand -base64 32) |
AUTH_GOOGLE_ID |
Google OAuth client ID |
AUTH_GOOGLE_SECRET |
Google OAuth client secret |
ALLOWED_EMAILS |
Comma-separated emails that may sign in |
CRON_SECRET |
Bearer token for /api/cron/overdue |
OVERDUE_NOTIFY_EMAIL |
Optional overdue recipient |
RESEND_API_KEY |
Optional — without it, deadline emails dry-run |
RESEND_FROM_EMAIL |
Optional Resend from address |
BLOB_READ_WRITE_TOKEN |
Vercel Blob store token — required in production (see Deploy checklist); unset locally, falls back to disk |
GOTENBERG_URL / GOTENBERG_BASIC_AUTH_USER / GOTENBERG_BASIC_AUTH_PASSWORD |
Optional — Excel→PDF conversion (infra/gotenberg/README.md); unset disables Convert to PDF with a clear message |
pnpm test
pnpm lint
pnpm exec tsc --noEmit
pnpm db:deploy
pnpm db:generatecurl -H "Authorization: Bearer $CRON_SECRET" http://localhost:3001/api/cron/overdue| Route | Purpose |
|---|---|
/lpo |
LPO dashboard + create |
/invoices |
Supplier invoices (filter by supplier/month) |
/manufacturers |
Registry + fabric ledger per manufacturer |
/consumption |
Garment meters table |
/notifications |
Due reminders inbox |
/help |
In-app knowledge base & user flows |
- Create a Vercel Blob store (Storage tab → Create Database → Blob) and connect it to the project — this sets
BLOB_READ_WRITE_TOKENfor you in every environment (Production/Preview/Development) it's linked to. Required: without it, uploads and generated documents would try to write to local disk, which doesn't persist on Vercel's serverless functions. - Set the remaining env vars on Vercel for each environment you deploy (pooled + direct DB URLs, Auth, cron secret, Resend optional, Gotenberg optional)
prisma migrate deployon release (nevermigrate reset/db push --force-resetagainst a real database)- Confirm
vercel.jsoncron hits/api/cron/overduewithCRON_SECRET - Google OAuth redirect URIs for the deployed domain(s) — a Preview deployment's URL changes per-commit unless you assign a stable branch domain, so use that for testing sign-in rather than the raw preview URL
- Optional at launch: stand up Gotenberg (
infra/gotenberg/README.md) for Excel→PDF conversion — everything else works without it