Skip to content

Latest commit

Β 

History

146 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MinaERP

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.

Next.js TypeScript Prisma Tailwind CSS


✨ Features

Multi-Tenant Architecture

  • Organization-based isolation using Clerk
  • Role-based access control
  • Customizable module selection per organization

12 Core Modules

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

Additional Features

  • 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

πŸ› οΈ Tech Stack


πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • PostgreSQL database (or Neon for serverless)
  • Clerk account for authentication
  • (Optional) Resend account for email notifications

1. Clone & Install

git clone <repository-url>
cd erp
npm install

2. Environment Setup

Create 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

3. Database Setup

# Push schema to database
npm run db:push

# Generate Prisma client
npm run db:generate

# (Optional) Open Prisma Studio
npm run db:studio

4. Run Development Server

npm run dev

Open http://localhost:3000 in your browser.


πŸ“ Project Structure

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)

πŸ“œ Available Scripts

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

πŸ” Authentication Flow

  1. Sign Up β†’ User creates account via Clerk
  2. Organization β†’ User creates/joins an organization
  3. Onboarding β†’ Admin selects which modules to enable
  4. Dashboard β†’ Access granted with filtered sidebar

🎨 Module Selection

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.


🌐 E-Commerce Storefront

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]


πŸ’³ Point of Sale (POS)

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

Payment Providers (Plugin Architecture)

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

πŸ“§ Email Notifications

The system sends email notifications for:

  • Feedback status changes
  • (Extensible for invoices, orders, etc.)

Configure Resend API key in .env to enable emails.


πŸ—„οΈ Database Schema

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

🚒 Deployment

Vercel (Recommended)

  1. Push to GitHub
  2. Import to Vercel
  3. Add environment variables
  4. Deploy

Docker

# Coming soon

πŸ“„ License

MIT License - see LICENSE for details.


🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ž Support

  • Issues: Open a GitHub issue
  • Discussions: Use GitHub Discussions
  • Feedback: Use the in-app feedback board at /feedback

About

12 core modules (Finance, CRM, Sales, Inventory, Procurement, HR, Assets, Projects, Documents, Manufacturing, E-Commerce, POS). Audit logging, public feedback board + roadmap, email notifications, payment provider plugins (Stripe, Flutterwave, LemonSqueezy, M-Pesa, etc.), role-based access, organization-level module selection.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages