A modern, full-featured Enterprise Resource Planning (ERP) system built with Next.js 16, designed for small to medium businesses. Features multi-tenant architecture, beautiful dark mode UI, and modular design allowing organizations to enable only the features they need.
- Organization-based isolation using Clerk
- Role-based access control
- Customizable module selection per organization
| Module | Description |
|---|---|
| π° Finance | Chart of accounts, invoices, bills, payments, budgets |
| π₯ CRM | Customers, vendors, leads, opportunities, activities |
| π Sales | Sales orders, shipments, delivery tracking |
| π¦ Inventory | Products, warehouses, stock levels, reorder alerts |
| ποΈ Procurement | Purchase orders, goods receipts |
| π€ HR | Employees, leave management, timesheets, payroll |
| πΎ Assets | Fixed asset tracking and depreciation |
| π Projects | Project management with tasks and milestones |
| π Documents | Document storage and management |
| π Manufacturing | Bill of materials, work orders |
| πͺ E-Commerce | Online stores with multiple payment providers |
| π³ POS | Point of sale, cash register, shift management |
- Audit Logging - Track all changes with full audit trail
- Public Feedback Board - Collect user feedback with voting
- Product Roadmap - Show planned features to users
- Email Notifications - Status change notifications via Resend
- Framework: Next.js 16 with App Router & Turbopack
- Language: TypeScript
- Database: PostgreSQL with Prisma ORM
- Authentication: Clerk (multi-tenant orgs)
- Styling: Tailwind CSS 4
- Icons: Lucide React
- Validation: Zod
- Email: Resend
- Node.js 18+
- PostgreSQL database (or Neon for serverless)
- Clerk account for authentication
- (Optional) Resend account for email notifications
git clone <repository-url>
cd erp
npm installCreate a .env file in the root directory:
# Database (Required)
DATABASE_URL="postgresql://user:password@host:5432/database"
# Clerk Authentication (Required)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_..."
CLERK_SECRET_KEY="sk_..."
NEXT_PUBLIC_CLERK_SIGN_IN_URL="/sign-in"
NEXT_PUBLIC_CLERK_SIGN_UP_URL="/sign-up"
# App URL (Required)
NEXT_PUBLIC_APP_URL="http://localhost:3000"
# Email - Resend (Required for build)
RESEND_API_KEY="re_..."
FROM_EMAIL="noreply@yourdomain.com"
COMPANY_NAME="Your Company Name"
# Admin Email (Optional - receives order notifications)
ADMIN_EMAIL="admin@yourdomain.com"| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
β | PostgreSQL connection string |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
β | Clerk public key |
CLERK_SECRET_KEY |
β | Clerk secret key |
NEXT_PUBLIC_APP_URL |
β | Full URL of your app |
RESEND_API_KEY |
β | For email notifications |
FROM_EMAIL |
β | Sender email for notifications |
COMPANY_NAME |
β | Company name in emails |
ADMIN_EMAIL |
β | Receives e-commerce order alerts |
# Push schema to database
npm run db:push
# Generate Prisma client
npm run db:generate
# (Optional) Open Prisma Studio
npm run db:studionpm run devOpen http://localhost:3000 in your browser.
src/
βββ app/
β βββ (auth)/ # Sign-in/Sign-up pages
β βββ (dashboard)/ # Main dashboard layout
β β βββ dashboard/
β β βββ finance/ # Finance module pages
β β βββ crm/ # CRM module pages
β β βββ sales/ # Sales module pages
β β βββ inventory/# Inventory module pages
β β βββ ... # Other modules
β β βββ page.tsx # Dashboard home
β βββ actions/ # Server actions (24 files)
β βββ api/ # API routes
β βββ feedback/ # Public feedback board
β βββ onboarding/ # Module selection
β βββ roadmap/ # Public roadmap
β βββ store/ # E-commerce storefront
βββ components/
β βββ shared/ # Sidebar, Header, ModuleNav
β βββ finance/ # Finance components
β βββ crm/ # CRM components
β βββ sales/ # Sales components
β βββ inventory/ # Inventory components
β βββ ... # Other module components
βββ lib/
β βββ prisma.ts # Prisma client
β βββ auth.ts # Auth utilities
β βββ audit.ts # Audit logging
β βββ email.ts # Email utilities
β βββ utils.ts # Helper functions
βββ prisma/
βββ schema.prisma # Database schema (1600+ lines)
| Command | Description |
|---|---|
npm run dev |
Start development server with Turbopack |
npm run build |
Build for production |
npm run start |
Start production server |
npm run lint |
Run ESLint |
npm run db:generate |
Generate Prisma client |
npm run db:push |
Push schema changes to database |
npm run db:studio |
Open Prisma Studio GUI |
- Sign Up β User creates account via Clerk
- Organization β User creates/joins an organization
- Onboarding β Admin selects which modules to enable
- Dashboard β Access granted with filtered sidebar
Organizations can choose which modules to enable during onboarding:
- Default modules: Finance, CRM, Sales, Inventory
- Optional modules: Procurement, HR, Assets, Projects, Documents, Manufacturing, E-Commerce, POS
- Always visible: Dashboard, Reports, Settings
Module preferences are stored at the organization level, so all team members see the same modules.
Each organization can create online stores with:
- Customizable branding (logo, colors)
- Product catalog from inventory
- Multiple payment providers:
- Cash on Delivery (COD)
- Stripe
- Flutterwave
- LemonSqueezy
Public storefronts are accessible at /store/[slug]
Retail checkout system with:
- Sales Terminal - Touch-friendly product grid, cart, quick search
- Payment Methods - Cash (with change calculator) and Card
- Shift Management - Open/close shifts with cash reconciliation
- Transaction History - Daily summary and sales reports
Both POS and E-Commerce share a unified payment provider system:
| Provider | Type | Region |
|---|---|---|
| Stripe | Card | Global |
| PayPal | Card/Account | Global |
| LemonSqueezy | Subscriptions | Global |
| Razorpay | Card/UPI | India |
| Google Pay | Wallet | Global |
| M-Pesa | Mobile Money | Kenya |
| Flutterwave | Multi | Africa |
| IntaSend | M-Pesa + Card | Kenya |
| Cash | Manual | POS only |
The system sends email notifications for:
- Feedback status changes
- (Extensible for invoices, orders, etc.)
Configure Resend API key in .env to enable emails.
The Prisma schema includes 40+ models covering:
- Core: Organization, AuditLog
- Finance: Account, Transaction, Invoice, Bill, Payment, Budget
- CRM: Customer, Vendor, Contact, Lead, Opportunity, Activity
- Sales: SalesOrder, Delivery, Return
- Inventory: Product, Warehouse, StockLevel, StockMovement
- Procurement: PurchaseOrder, GoodsReceipt
- HR: Employee, LeaveRequest, Timesheet, PayrollRecord
- Assets: Asset, AssetMaintenance
- Projects: Project, ProjectTask, ProjectMilestone
- Documents: Document
- Manufacturing: BillOfMaterials, WorkOrder
- E-Commerce: OnlineStore, StoreProduct, StoreOrder
- POS: POSTerminal, POSSession, POSSale, POSSaleItem, POSPayment
- Payments: PaymentProvider
- Feedback: Feedback, FeedbackVote, FeedbackReply
- Push to GitHub
- Import to Vercel
- Add environment variables
- Deploy
# Coming soonMIT License - see LICENSE for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Issues: Open a GitHub issue
- Discussions: Use GitHub Discussions
- Feedback: Use the in-app feedback board at
/feedback