V11 Enterprise QMS
Full-stack quality management system built with Next.js, Prisma, and PostgreSQL. Starts from zero data and learns as your team uses it.
Role access
| Role | Access |
|---|---|
| Admin | Everything: form builder, user management, settings, audit trail |
| QC | CAPA, audits, NCRs, documents, risk, suppliers, standards |
| Production | Fill first-build forms, view own submissions only |
| Management | Read-only dashboards and reports |
Quick start
1. Prerequisites
- Node.js 18+
- PostgreSQL database (free options below)
2. Clone and install
npm install
3. Set up your database
Option A — Supabase (recommended, free):
- Go to supabase.com → New project
- Copy the connection string from Settings → Database
- Paste it into your
.envfile
Option B — Railway:
- Go to railway.app → New → PostgreSQL
- Copy the DATABASE_URL from the Variables tab
Option C — Local PostgreSQL:
createdb v11qms
4. Configure environment
cp .env.example .env
# Edit .env with your database URL and SMTP details
5. Set up the database schema
npx prisma db push
6. Create your admin account
# Run this once to create the first admin user
npx ts-node --project tsconfig.json scripts/create-admin.ts
Or manually insert via Prisma Studio:
npx prisma studio
7. Start the app
npm run dev
# Open http://localhost:3000
Deployment (Vercel)
npm install -g vercel
vercel
Set these environment variables in Vercel dashboard:
DATABASE_URLNEXT_PUBLIC_APP_URL(your Vercel URL)SMTP_HOST,SMTP_PORT,SMTP_USER,SMTP_PASS,EMAIL_FROM
Email notifications
The app sends emails for:
- CAPA overdue alerts (to the assigned owner)
- NCR escalation (to admins)
- Form review ready (when submission target is hit)
Set up a free Resend account for 3,000 emails/month free.
File structure
/pages
/api ← All backend API routes
/admin ← Admin-only pages (form builder, users, settings, audit trail)
/qc ← QC team pages (CAPA, audits, NCR, risk, suppliers, docs)
/fill ← Production team form filling
/management ← Management read-only dashboard
/components
/layout ← Shell, sidebar, topbar
/ui ← Shared UI components
/lib
prisma.ts ← Database client
auth.ts ← Session management, role checks
email.ts ← Notification emails
context.tsx ← React app context
/prisma
schema.prisma ← Full database schema
Database schema
All 8 modules with full relational schema:
- Users + sessions + roles
- CAPAs + timeline events
- Audits + findings
- NCRs
- Documents
- Risks
- Suppliers
- First-build forms + submissions + quality standards
- Audit log (immutable, append-only)
- Notifications
Adding more modules
Each module follows the same pattern:
- Add model to
prisma/schema.prisma - Run
npx prisma db push - Create API route in
pages/api/ - Create page in
pages/qc/orpages/admin/ - Add nav item in
components/layout/Layout.tsx