Skip to content

basilex/skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

117 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Skeleton CRM

Enterprise-grade Business Management System built with Domain-Driven Design (DDD) and Hexagonal Architecture

Go Version Node Version License

Production-ready CRM system for business automation including:

  • 🧾 Invoicing & Billing - Invoice generation, payment tracking
  • πŸ“¦ Inventory Management - Stock control, warehouses, reservations
  • πŸ‘₯ Party Management - Customers, suppliers, contacts
  • πŸ’° Accounting - Chart of accounts, transactions, double-entry
  • πŸ“‹ Order Management - Sales orders, purchase orders
  • πŸ“„ Document Management - PDF generation, signatures
  • πŸ“ File Management - Upload, processing, storage
  • πŸ”” Notifications - Email, SMS, push, in-app

πŸ“– Documentation


πŸƒ Quick Start

Prerequisites

  • Go 1.25+
  • Node.js 20+ (24+ recommended)
  • PostgreSQL 16+
  • Redis 7+
  • Docker & Docker Compose (optional)

Using Docker (Recommended)

# Clone repository
git clone https://github.com/basilex/skeleton.git
cd skeleton

# Start all services
make dev

# Services:
# - PostgreSQL: localhost:5432
# - Redis: localhost:6379
# - Backend API: localhost:8080
# - Frontend: localhost:3000

Manual Setup

# 1. Install dependencies
make install

# 2. Start database services
make db-up

# 3. Run migrations
make db-migrate

# 4. Seed database (optional)
make db-seed

# 5. Start backend (terminal 1)
make backend

# 6. Start frontend (terminal 2)
make frontend

Default Credentials

After running make db-seed:

  • Email: admin@skeleton.local
  • Password: Admin1234!
  • Role: super_admin

πŸ“ Project Structure

skeleton/
β”œβ”€β”€ backend/                    # Go API server
β”‚   β”œβ”€β”€ cmd/api/               # Application entry point + Wire injector
β”‚   β”œβ”€β”€ internal/              # Bounded contexts (DDD)
β”‚   β”‚   β”œβ”€β”€ di/               # Wire DI provider sets & Dependencies struct
β”‚   β”‚   β”œβ”€β”€ accounting/        # Chart of accounts, transactions
β”‚   β”‚   β”œβ”€β”€ audit/            # Audit logging
β”‚   β”‚   β”œβ”€β”€ catalog/          # Products & services catalog
β”‚   β”‚   β”œβ”€β”€ documents/       # Document generation & signatures
β”‚   β”‚   β”œβ”€β”€ files/           # File upload & processing
β”‚   β”‚   β”œβ”€β”€ identity/        # Users, roles, permissions, sessions
β”‚   β”‚   β”œβ”€β”€ inventory/       # Warehouses, stock, movements
β”‚   β”‚   β”œβ”€β”€ invoicing/       # Invoices & payments
β”‚   β”‚   β”œβ”€β”€ notifications/   # Multi-channel notifications
β”‚   β”‚   β”œβ”€β”€ ordering/        # Sales & purchase orders
β”‚   β”‚   β”œβ”€β”€ parties/         # Customers, suppliers, partners
β”‚   β”‚   β”œβ”€β”€ status/          # Build info, health checks
β”‚   β”‚   └── tasks/           # Background jobs
β”‚   β”œβ”€β”€ pkg/                  # Shared packages
β”‚   β”‚   β”œβ”€β”€ cache/           # Redis/memory cache abstraction
β”‚   β”‚   β”œβ”€β”€ config/          # Configuration management
β”‚   β”‚   β”œβ”€β”€ eventbus/        # Event bus (memory/Redis)
β”‚   β”‚   β”œβ”€β”€ middleware/       # HTTP middleware
β”‚   β”‚   β”œβ”€β”€ money/           # Money value object (int64 cents)
β”‚   β”‚   β”œβ”€β”€ ratelimit/      # Rate limiting (token bucket/sliding window)
β”‚   β”‚   β”œβ”€β”€ transaction/    # Transaction manager
β”‚   β”‚   └── uuid/            # UUID v7 generation
β”‚   β”œβ”€β”€ scripts/             # Database scripts
β”‚   β”‚   β”œβ”€β”€ seed/            # Seed sample data
β”‚   β”‚   └── migrate/         # Migration tool
β”‚   β”œβ”€β”€ migrations/           # SQL migrations (52 tables)
β”‚   β”œβ”€β”€ tests/               # Integration tests
β”‚   └── go.mod
β”œβ”€β”€ frontend/                 # Next.js 16 application
β”‚   β”œβ”€β”€ app/                # App Router pages
β”‚   β”œβ”€β”€ components/         # React components
β”‚   β”‚   β”œβ”€β”€ ui/            # shadcn/ui components
β”‚   β”‚   └── domain/        # Business components
β”‚   β”œβ”€β”€ lib/               # Utilities
β”‚   β”‚   └── api/          # API client & endpoints
β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   └── package.json
β”œβ”€β”€ shared/                  # Shared code between frontend/backend
β”‚   └── types/             # TypeScript types
β”‚       β”œβ”€β”€ money.ts       # Money class (matches Go)
β”‚       └── api.ts         # API types for all contexts
β”œβ”€β”€ scripts/               # Operational scripts
β”‚   β”œβ”€β”€ docker/           # Build scripts
β”‚   β”œβ”€β”€ deploy/           # Deploy scripts
β”‚   └── ...
β”œβ”€β”€ docs/                  # Documentation
β”œβ”€β”€ .github/workflows/    # CI/CD pipelines
β”œβ”€β”€ docker-compose.yml    # Docker services
β”œβ”€β”€ Makefile              # Development commands
└── go.work               # Go workspace

πŸ—οΈ Architecture

Domain-Driven Design

The system follows DDD principles with Bounded Contexts:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      API Layer (Gin)                        β”‚
β”‚  REST endpoints β†’ DTOs β†’ Application Services β†’ Domain     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Bounded Contexts                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   Identity      β”‚    Parties      β”‚    Invoicing           β”‚
β”‚  - Users        β”‚  - Customers    β”‚  - Invoices            β”‚
β”‚  - Roles        β”‚  - Suppliers    β”‚  - Payments            β”‚
β”‚  - Sessions     β”‚  - Partners     β”‚  - Lines                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   Accounting    β”‚   Inventory     β”‚    Ordering            β”‚
β”‚  - Accounts     β”‚  - Warehouses   β”‚  - Orders              β”‚
β”‚  - Transactions β”‚  - Stock        β”‚  - Lines               β”‚
β”‚  - Journal      β”‚  - Movements    β”‚  - Status              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   Catalog       β”‚   Documents     β”‚    Files               β”‚
β”‚  - Items        β”‚  - Templates    β”‚  - Upload              β”‚
β”‚  - Categories   β”‚  - Signatures   β”‚  - Processing          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Infrastructure Layer                            β”‚
β”‚  PostgreSQL β”‚ Redis β”‚ Email β”‚ SMS β”‚ Storage β”‚ Events       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Design Patterns

  • DDD: Bounded contexts, aggregates, domain events
  • Hexagonal Architecture: Ports & adapters
  • CQRS: Command Query Responsibility Segregation
  • Event Sourcing: Domain events for cross-context communication
  • Repository Pattern: Data access abstraction
  • Value Objects: Money (int64 cents), Email, Phone

πŸ› οΈ Tech Stack

Backend (Go)

  • Framework: Gin (HTTP router)
  • Database: PostgreSQL 16+ with pgx driver
  • Cache/Sessions: Redis 7+
  • DI: Google Wire (compile-time dependency injection)
  • Architecture: DDD + Hexagonal + CQRS

Frontend (Next.js)

  • Framework: Next.js 16 (App Router)
  • Language: TypeScript 5
  • UI: shadcn/ui + Tailwind CSS
  • State: React Context + SWR
  • Forms: React Hook Form + Zod

Infrastructure

  • Containerization: Docker + Docker Compose
  • CI/CD: GitHub Actions
  • Database Migrations: Custom SQL migrations
  • Monitoring: Health checks, structured logging

πŸ“Š Makefile Commands

make help                 # Show all commands

# Development
make dev                  # Start all services (Docker)
make backend              # Wire generate + start backend server
make backend-wire         # Regenerate Wire DI code (cmd/api/wire_gen.go)
make backend-build        # Wire generate + compile binary with ldflags

# Database
make db-up               # Start PostgreSQL + Redis
make db-migrate          # Run migrations
make db-seed             # Seed sample data
make db-shell            # PostgreSQL CLI

# Testing
make test                # Backend tests
make test-coverage       # With coverage report

# Build (Docker)
make build               # Build all Docker images
make build-backend       # Build backend image (Wire + ldflags)
make build-frontend      # Build frontend image

πŸ”Œ API Endpoints

Authentication

POST   /api/v1/auth/register     # Register new user
POST   /api/v1/auth/login        # Login
POST   /api/v1/auth/refresh      # Refresh token
POST   /api/v1/auth/logout       # Logout
GET    /api/v1/auth/me           # Current user profile

Business Entities

# Customers
GET    /api/v1/customers         # List customers
POST   /api/v1/customers         # Create customer
GET    /api/v1/customers/:id     # Get customer
PUT    /api/v1/customers/:id     # Update customer

# Invoices
GET    /api/v1/invoices          # List invoices
POST   /api/v1/invoices          # Create invoice
GET    /api/v1/invoices/:id      # Get invoice
POST   /api/v1/invoices/:id/send     # Send invoice
POST   /api/v1/invoices/:id/payments # Record payment

# Orders
GET    /api/v1/orders            # List orders
POST   /api/v1/orders            # Create order
GET    /api/v1/orders/:id         # Get order
PATCH  /api/v1/orders/:id/status  # Update status

# Inventory
GET    /api/v1/warehouses        # List warehouses
POST   /api/v1/warehouses        # Create warehouse
GET    /api/v1/stock             # List stock
POST   /api/v1/stock/adjust      # Adjust stock

# Accounting
GET    /api/v1/accounts          # Chart of accounts
POST   /api/v1/accounts          # Create account
POST   /api/v1/transactions      # Record transaction

Full API Reference: docs/API.md


πŸ§ͺ Testing

Backend Tests

# Run all tests
make test

# Run with coverage
make test-coverage

# Run integration tests
make test-integration

# Run specific package
cd backend && go test ./internal/invoicing/...

Frontend Tests

# Run tests
cd frontend && npm test

# Run e2e tests
cd frontend && npm run test:e2e

πŸš€ Deployment

CI/CD Pipeline

Automatic deployment via GitHub Actions:

  • Push to dev β†’ Deploy to staging
  • Push to main β†’ Deploy to production

Manual Deployment

# Build Docker images
./scripts/docker/build-all.sh v1.0.0

# Deploy to staging
./scripts/deploy/deploy-staging.sh

# Deploy to production
./scripts/deploy/deploy-production.sh

🀝 Contributing

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

Commit Convention

This project follows Conventional Commits:

  • feat: - New feature
  • fix: - Bug fix
  • docs: - Documentation
  • refactor: - Code refactoring
  • test: - Tests
  • chore: - Maintenance

πŸ“„ License

MIT License - see LICENSE for details.


πŸ“ž Support


🎯 Roadmap

v2.0 (Current)

  • βœ… Monorepo structure (backend + frontend)
  • βœ… 9 bounded contexts
  • βœ… Money value object (int64 cents)
  • βœ… PostgreSQL + Redis
  • βœ… REST API (150+ endpoints)
  • βœ… Next.js 16 frontend
  • βœ… Docker + CI/CD

v2.1 (Planned)

  • ⏳ Real-time WebSocket notifications
  • ⏳ File upload (S3, MinIO)
  • ⏳ Email templates
  • ⏳ PDF generation
  • ⏳ Multi-tenant support

v3.0 (Future)

  • ⏳ GraphQL API
  • ⏳ Event sourcing
  • ⏳ Microservices architecture
  • ⏳ Kubernetes deployment

Built with ❀️ using Domain-Driven Design and Hexagonal Architecture

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors