Internal company management system (single-company, 200+). Stack: Next.js 14 App Router + TypeScript + Tailwind + shadcn/ui + Prisma + Postgres 18 + Auth.js credentials.
Modules: HR / Projects+Tasks / Finance / CRM / Inventory / Analytics — all live (P0–P7).
app/— App Router:(app)shell (sidebar layout) +(auth)/login+forbidden+api/*app/api/—admin/users,attendance/check-in,auth/[...nextauth],leave,projects(+[id]/tasks,[id]/time-summary),tasks/[id](+time),finance/*(categories/expenses/invoices/budgets),clients,contacts,deals,activities,products,movements,analyticsapp/(app)/—dashboard,employees(+[id]),leave,projects(+[id],[id]/time),finance(budgets/expenses/invoices),crm(+[clientId]),inventory(+[productId]),analyticscomponents/—app-sidebar.tsx,hr-actions.tsx,project-actions.tsx,time-actions.tsx,finance-actions.tsx,finance-billing-actions.tsx,crm-actions.tsx,crm-deal-actions.tsx,crm-activity-actions.tsx,inventory-actions.tsx,analytics-cards.tsx,analytics-sections.tsx,sign-out-button.tsx,theme-toggle.tsx,ui/primitiveslib/—db.ts(Prisma singleton),rbac.ts(5-role matrix + requireRole),hr.ts,projects.ts,finance.ts,crm.ts,inventory.ts,analytics.ts,utils.ts(cn())prisma/schema.prisma—User,Department,AuditLog(+Role: ADMIN/HR/FINANCE/MANAGER/EMPLOYEE),Employee,Attendance,LeaveRequest,Project,Task,TimeEntry,ExpenseCategory,Expense,Invoice,Budget,Client,Contact,Deal,Activity,Product,StockMovementprisma/seed*.ts—seed.ts(5 role users + Engineering dept, wires all module seeds),seed-finance.ts,seed-crm.ts(6 clients/12 contacts/9 deals/18 activities),seed-inventory.ts(8 products/32 movements)docker-compose.yml—db(postgres:18-alpine) +app(built fromDockerfile)run-dev.sh+company-os.desktop— click-to-run dev launcher (Rule 14/15)
ADMIN full; HR manages people/leave; FINANCE manages money/invoices; MANAGER owns projects/deals; EMPLOYEE self-service (own attendance/leave, assigned tasks, movement logging). Enforced in lib/rbac.ts via requireRole; UI nav is static, API is authoritative.
cp .env.example .env # then set POSTGRES_PASSWORD for compose
npm install
npx prisma migrate dev # needs Postgres (local or `db` service)
npm run db:seed # 5 users + HR/Projects/Finance/CRM/Inventory demo data
npm run dev # http://localhost:3000Docker path: POSTGRES_PASSWORD=... docker compose up --build.
Demo logins (dev only, password from SEED_DEFAULT_PASSWORD): [email protected], [email protected], [email protected], [email protected], [email protected].
npx prisma validate && npx tsc --noEmit && npm run build && npm run db:seedDATABASE_URL + AUTH_SECRET (generate: openssl rand -base64 32) + dev-only SEED_DEFAULT_PASSWORD. No secrets are committed; production injects real values from the vault at deploy time.