BabaBuilds ERP gives service businesses one practical place to run sales, money, operations, and people workflows. Turn a proposal into an invoice, follow up on receivables, reconcile the bank, prepare tax evidence, manage stock, and keep the team moving without stitching together a collection of disconnected tools.
The built-in demo creates a private, short-lived workspace with realistic synthetic data. It is the quickest way to explore the product safely—no customer data or credit card required.
Built with Next.js App Router + React Server Components + Prisma + PostgreSQL 17 + NextAuth.
- Product Tour (Screenshots)
- Core Functionalities (Codebase + Schema Mapped)
- Use Cases
- Architecture at a Glance
- Installation & Local Development
- Environment Variables
- Auth Configuration Modes
- Database & Prisma Notes
- Scripts You’ll Actually Use
- Testing & Quality
- Troubleshooting
- Documentation & Helpful Paths
Every product image below comes from the seeded Software Company demo at a 1440×900 desktop viewport. Your browser automatically selects the light or dark version.
See the figures that need attention, upcoming work, receivables, cash movement, and recent activity without hunting through reports.
Create consistent proposals, understand pipeline health, convert approved work into invoices, and keep the original client context attached.
Inventory, expenses, documents, tax, reporting, and bank reconciliation share one workspace and one access model.
Browse the complete light/dark product image library for the full set of public, workspace, finance, compliance, payroll, and settings screens.
Based on static inspection of app modules, Prisma enums/models, scripts, and help docs.
- NextAuth-based sign-in architecture (email and/or Google providers)
- Guided persona demos with synthetic, automatically expiring workspaces
- Workspace-aware user model and role system
- Role/permission-gated feature access for optional modules
- Client management (profiles, contact and relationship data)
- Referral tracking and rewards workflow
- Proposal/quote lifecycle with conversion pathways
- Service catalog operations (priceable services/products)
- Shop, order, and point-of-sale workflows for sellable items
- Retainer and recurring revenue tracking
- Invoice lifecycle with schema-backed statuses:
PENDINGPARTIALLY_PAIDPAID
- Payment/revenue event tracking via accounting event types
- Expense recording and categorization
- Tax workflows with readiness, blocker, and filing status concepts
- CA/audit portal workflows for finance/compliance collaboration
- Compliance task tracking via task status states
- Inventory management and stock operational flows
- Operational dashboard with primary action surfaces and drill-down views
- AI reconciliation workflows
- Optional cash-flow forecasting module with:
- horizon, scenario tags, direction/source/classification enums
- risk-level tagging and generation provenance metadata
- Optional Reporting Center module
- Preset-driven, scoped query execution model
- Export workflows (XLSX pathway in dependencies/scripts)
- Audit logging for reporting actions
- Workforce module patterns for people/process tracking
- Payroll-related optional workflows
- Document Vault module surface
- Import Manager workflows for structured data intake
- Distributor, coupon attribution, and commission schema entities
- Margin basis and payout lifecycle handling
- Reseller/coupon audience concepts in schema enums
- Replace fragmented tools (spreadsheets + invoicing app + CRM + notes) with one operational system.
- Track cash in/out, invoices, retainers, and taxes from a single dashboard.
- Keep clean revenue/expense visibility with audit-friendly activity trails.
- Standardize filing readiness and compliance blockers before deadlines.
- Move from lead/referral to proposal to invoice without switching products.
- Maintain client context while coordinating with service/ops teams.
- Run inventory-aware workflows alongside service catalog and order processes.
- Reduce manual handoff friction between shop floor and finance workflows.
- Start with core ERP modules, then enable optional modules (cash flow, reporting center, payroll, document vault, etc.) as maturity increases.
- Frontend: Next.js 16 App Router + React 19 + TypeScript
- Backend: Next.js server routes / server components
- Database: Prisma ORM with PostgreSQL 17 (separate development database)
- Auth: NextAuth with provider toggles
- Styling/UI: Tailwind + Radix/UI utilities
- Tests: Vitest + Playwright smoke coverage
git clone <your-repo-url>
cd BabaBuilds-ERP
nvm install && nvm use
npm ci --no-audit --no-fundRequired baseline variables:
DATABASE_URL="postgresql://postgres:postgres@127.0.0.1:5432/bababuilds_erp_ci"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="replace-with-a-random-secret"
AI_TOOL_CONFIRMATION_SECRET="replace-with-an-independent-32-byte-random-secret"
AUTH_GOOGLE_ENABLED=false
AUTH_EMAIL_ENABLED=falsenpx prisma generate
npx prisma migrate deploy(Optional) seed compliance dictionaries:
npx ts-node prisma/seed.tsnpm run devOpen http://localhost:3000, choose Explore a live demo workspace, select the business profile that best matches your work, and continue into the seeded workspace.
NEXTAUTH_URLNEXTAUTH_SECRETAI_TOOL_CONFIRMATION_SECRET(independent random value, at least 32 characters; signs two-minute AI mutation confirmations)
DATABASE_URL(PostgreSQL 17 URL for an isolated local database)
AUTH_EMAIL_ENABLEDAUTH_GOOGLE_ENABLED
When enabling email or Google auth, set the related provider credentials as documented in Auth Configuration Modes.
Set:
AUTH_EMAIL_ENABLED=trueAUTH_GOOGLE_ENABLED=false
Also configure SMTP/email variables:
EMAIL_SERVER_HOSTEMAIL_SERVER_PORTEMAIL_SERVER_USEREMAIL_SERVER_PASSWORDEMAIL_FROM
Set:
AUTH_GOOGLE_ENABLED=trueAUTH_EMAIL_ENABLED=true
Also configure:
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRET- all SMTP/email variables above
Google OAuth callback URI:
https://erp.bababuilds.com/api/auth/callback/google
- Development database: a disposable PostgreSQL 17 database; never connect local tooling to production.
- Production/staging schema changes should always flow through migration files and
npx prisma migrate deploy. - For clean database bootstrap, use the baseline +
migrate resolveworkflow documented inprisma/migrations/README.md. - Use
npx prisma db pushonly for disposable local prototyping databases, never as a production migration pathway.
npm run dev # Start local app
npm run lint # ESLint + KPI coverage check
npm run typecheck # TypeScript no-emit check
npm run validate # Lint + typecheck + production build
npm test # Vitest suite
npm run test:browser:smoke # Playwright smoke tests
npm run codex:quick # Fast local validation loop- Unit/integration tests: Vitest
- Browser smoke tests: Playwright
- Static quality gates: ESLint + TypeScript + route/check scripts
Note: Existing lint debt is known in the codebase; treat lint output as “baseline + regressions” during active development.
- Auth fails early: verify
NEXTAUTH_URLandNEXTAUTH_SECRETare set correctly. - Schema mismatch/local DB issues: confirm that the database is disposable, then run
npx prisma generate && npx prisma migrate deploy. - Demo sign-in loops back to login: make sure
NEXTAUTH_URLuses the same hostname you opened in the browser (for example, uselocalhostconsistently rather than mixing it with127.0.0.1). - A paid module is missing in a demo: create a fresh demo workspace. Demo entitlements are bound to the short-lived workspace and fail closed when its expiry is missing.
- Main README:
README.md - Prisma schema:
prisma/schema.prisma - Product image library:
docs/product-images/README.md - Help screenshot index:
content/docs/help-screenshot-gallery.md - Help Center source:
content/docs/ - Frontend rollout docs:
docs/frontend/component-adoption-matrix.mddocs/frontend/visual-qa-checklist.md
If you want, next PR can add:
- clickable architecture diagram,
- persona-specific quick-starts,
- a “module-to-route map” table for faster onboarding of new engineers and coding agents.
The production ERP uses PostgreSQL 17 exclusively. Prisma migrations live in prisma/migrations/ and are applied with npx prisma migrate deploy. Use a disposable local PostgreSQL database for development; see docs/postgres-backup-runbook.md for encrypted backup and recovery expectations. The original data migration and rollback evidence is retained in Git history and encrypted off-host recovery snapshots, not in the live application tree.
The repository targets Node 26.13.1/npm 11.20.0. See the Stage 2 release and rollback runbook for GitHub-hosted ARM64 production artifacts, the existing authenticated SSH transport, verified PostgreSQL/media recovery gates, the root-owned canary/promoter and monitoring. Merge alone does not activate the VPS; the retained Node22 cutover release remains the rollback anchor.