A modern, modular ERP (Enterprise Resource Planning) platform built with Go + Fiber, Next.js, and GraphQL.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ERP Platform β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Frontend (Next.js) β Backend (Go + Fiber) β
β βββ React Components β βββ Core Platform β
β βββ Apollo Client β β βββ Auth (JWT) β
β βββ Zustand State β β βββ Database (PostgreSQL) β
β βββ TailwindCSS β β βββ Event Bus β
β β β βββ Module Loader β
β β β βββ Registry β
β β β βββ RBAC Permissions β
β β β βββ Settings β
β β βββ GraphQL API β
ββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ€
β Modules β
β βββ Sales (Customers, Products, Orders, Invoices) β
β βββ Inventory (Coming Soon) β
β βββ Accounting (Coming Soon) β
β βββ Custom Modules... β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- π Authentication: JWT-based auth with role support
- π₯ RBAC: Fine-grained role-based access control
- π§© Modular Architecture: Install, enable, disable, uninstall modules
- π GraphQL API: Flexible, type-safe API
- π Event Bus: Inter-module communication
- βοΈ Settings Management: Configurable per-module settings
- π Audit Logging: Track all changes
- Module Discovery: Automatic discovery from
/modulesdirectory - Dependency Management: Modules can depend on other modules
- Database Migrations: Per-module migration support
- Permission Registration: Modules register their own permissions
- Event Subscriptions: Subscribe to platform and other module events
- Go 1.22+
- Node.js 20+
- PostgreSQL 15+
- Docker & Docker Compose (optional)
# Clone the repository
git clone <repository-url>
cd erp-platform
# Copy environment file
cp .env.example .env
# Start all services
docker-compose up -d
# Access the application
# Frontend: http://localhost:3000
# Backend API: http://localhost:8080
# GraphQL Playground: http://localhost:8080/graphqlcd backend
# Install dependencies
go mod download
# Copy and edit config
cp config/config.yaml.example config/config.yaml
# Run the server
make run
# Or with hot reload
make devcd frontend
# Install dependencies
npm install
# Run development server
npm run deverp-platform/
βββ backend/
β βββ cmd/
β β βββ server/ # Application entry point
β βββ core/
β β βββ auth/ # Authentication & JWT
β β βββ database/ # DB connection & migrations
β β βββ events/ # Event bus
β β βββ loader/ # Module loader
β β βββ logger/ # Structured logging
β β βββ permissions/ # RBAC system
β β βββ registry/ # Module registry
β β βββ settings/ # Settings storage
β β βββ platform.go # Main platform
β βββ graph/ # GraphQL schema & resolvers
β βββ modules/
β β βββ sales/ # Example module
β β βββ module.json # Module metadata
β β βββ migrations/ # SQL migrations
β β βββ models/ # Data models
β β βββ services/ # Business logic
β β βββ module.go # Module entry point
β βββ config/
β βββ go.mod
βββ frontend/
β βββ src/
β β βββ app/ # Next.js App Router
β β βββ components/ # React components
β β βββ hooks/ # Custom hooks
β β βββ lib/ # Utilities & GraphQL
β βββ package.json
β βββ next.config.js
βββ docker-compose.yml
βββ README.md
-
Create a new directory in
backend/modules/<module-name>/ -
Create
module.json:
{
"id": "my-module",
"name": "My Module",
"version": "1.0.0",
"description": "Description of my module",
"author": "Your Name",
"dependencies": [],
"permissions": [
"my-module.resource.view",
"my-module.resource.create"
],
"migrations": true
}- Create migrations in
migrations/:
-- 001_create_tables.sql
CREATE TABLE my_module_items (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);- Implement the module in
module.go:
package mymodule
import (
"context"
"erp-platform/core/database"
"erp-platform/core/events"
"erp-platform/core/registry"
)
type Module struct {
db *database.Database
eventBus *events.EventBus
}
func NewModule(db *database.Database, eventBus *events.EventBus) *Module {
return &Module{db: db, eventBus: eventBus}
}
func (m *Module) GetMetadata() *registry.ModuleMetadata {
// Load from module.json
}
func (m *Module) Initialize(ctx context.Context) error {
// Subscribe to events, initialize services
return nil
}
func (m *Module) Shutdown(ctx context.Context) error {
// Cleanup
return nil
}| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/auth/register |
Register new user |
| POST | /api/v1/auth/login |
Login |
| POST | /api/v1/auth/refresh |
Refresh token |
| GET | /api/v1/modules |
List modules |
| POST | /api/v1/modules/:id/enable |
Enable module |
| POST | /api/v1/modules/:id/disable |
Disable module |
Access the GraphQL Playground at http://localhost:8080/graphql
Example queries:
# Login
mutation {
login(input: { email: "[email protected]", password: "password" }) {
accessToken
user { id email }
}
}
# Get modules
query {
modules {
id name version status
}
}After initial setup, create an admin user:
curl -X POST http://localhost:8080/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"admin123","first_name":"Admin","last_name":"User"}'MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Built with β€οΈ using Go, Next.js, and PostgreSQL