Production-ready ERP starter for managing HR, finance, inventory, liabilities, and operations with Supabase + Next.js.
Core layers
- UI layer: Next.js App Router for public marketing pages, auth flows, and protected ERP screens.
- API layer: Server Actions for CRUD operations with strict schema validation (Zod) and RBAC gating.
- Data layer: Supabase Postgres with RLS and organization-scoped multi-tenancy.
- Integrations: Resend for transactional emails, Stripe for billing/webhooks, Supabase Storage for files.
Security & auditability
- Role-based permissions (Admin, Manager, Staff, Accountant).
- RLS enforced at the database layer for every core table.
- Audit logs for sensitive updates with immutable event history.
- Core schema is in
supabase/schema.sql. - RLS policies are in
supabase/policies.sql.
- Every core table includes
organization_id. - Access is limited to members of the organization in
org_memberships. - Soft deletes via
deleted_atto preserve audit history.
app/(public)hosts marketing pages (landing, pricing, about, contact).app/(auth)hosts sign-in, sign-up, reset flows.app/(app)hosts protected ERP modules.app/actionscontains Server Actions for CRUD operations.components/uicontains shadcn-style primitives.
- Auth & RBAC
- Supabase Auth sign-up/sign-in.
- Assign default role on user creation.
- Gate Server Actions with
roleCapabilitiesfromlib/rbac.ts.
- HR module
- Employee profiles, departments, payroll.
- Approvals and review workflows.
- Finance module
- Expenses, revenues, liabilities.
- Ledger dashboard with balance sheet reports.
- Inventory & assets
- Inventory items, suppliers, asset assignments.
- Depreciation schedules.
- Reports & analytics
- CSV/PDF export via Server Actions.
- KPI dashboards and scheduled email exports.
- Admin
- Role management, audit logs, org settings.
npm install
cp .env.example .env.local
npm run dev- Create a Supabase project.
- Run
supabase/schema.sqlandsupabase/policies.sqlin the SQL editor. - Enable email auth providers as needed.
- Add storage bucket for receipts/documents.
- Create a Resend API key.
- Set
RESEND_API_KEYandRESEND_FROM_EMAIL. - Use in Server Actions to send onboarding, payroll, and alert emails.
- Create products and prices in Stripe.
- Set
STRIPE_SECRET_KEY,NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY,STRIPE_PRICE_ID. - Configure webhook endpoint in Next.js (recommended
/api/stripe/webhook). - Store webhook secret in
STRIPE_WEBHOOK_SECRET.
- Push to GitHub.
- Import project in Vercel.
- Configure environment variables from
.env.example. - Set Supabase URL and anon key in Vercel dashboard.
- Validate all Server Action inputs with Zod.
- Enforce RLS policies for all data access.
- Use row-level soft deletes to preserve audit trails.
- Add structured logging for finance and payroll actions.
- Rate-limit external webhooks.
- Landing page renders highlight sections.
- Pricing, About, Contact pages show content.
- Sign up creates a Supabase auth user.
- Sign in redirects to
/dashboard. - Password reset sends email.
- Metrics cards render.
- Alerts list shows placeholder data.
- Employee list loads.
- Payroll entries can be created.
- Expenses can be submitted.
- Revenue entries appear in ledger.
- Inventory items can be updated.
- Assets show depreciation schedule.
- CSV/PDF exports download.
- KPI dashboard loads charts.
- Role assignments update successfully.
- Audit log entries appear.
See .env.example for full list.