Complete ERP system for delivery and logistics management with real-time accounting, cashbox management, and order tracking.
- Backend: Node.js + TypeScript + Express + PostgreSQL
- Frontend: React 18 + TypeScript + Vite + TailwindCSS
- Database: PostgreSQL with Knex.js migrations
- Real-time: Socket.IO
- Auth: JWT + bcrypt
- Testing: Jest + Supertest + Playwright
- Infrastructure: Docker + Docker Compose
- Node.js >= 18
- PostgreSQL >= 14
- Docker & Docker Compose (optional)
# Clone the repository
git clone <your-repo-url>
cd soufiamERP
# Install dependencies
npm run install:all
# Setup environment
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env
# Configure your DATABASE_URL in backend/.env
# Run migrations
cd backend
npm run migrate:latest
# Seed database (optional)
npm run seed:run
# Start development servers
cd ..
npm run dev# Build and start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose downsoufiamERP/
├── backend/ # Node.js + TypeScript backend
│ ├── src/
│ │ ├── config/ # Configuration files
│ │ ├── controllers/ # Route controllers
│ │ ├── middleware/ # Express middleware
│ │ ├── models/ # Database models
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic
│ │ ├── utils/ # Utilities
│ │ └── server.ts # Express server
│ ├── migrations/ # Knex migrations
│ ├── seeds/ # Database seeds
│ ├── tests/ # Backend tests
│ └── package.json
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── api/ # API clients
│ │ ├── hooks/ # Custom hooks
│ │ ├── contexts/ # React contexts
│ │ └── utils/ # Utilities
│ ├── tests/ # Frontend tests
│ └── package.json
├── docs/ # Documentation
├── docker-compose.yml # Docker orchestration
├── .github/ # GitHub Actions CI
└── README.md
- Excel-like grid with batch entry
- Multiple order types: Ecommerce, Instant, Go-to-Market, Prepaid
- Real-time status tracking
- Driver assignment
- Location tracking
- Atomic cashbox updates with row-level locking
- Dual currency support (USD/LBP)
- Automatic exchange rate handling
- Transaction history
- Client accounting with detailed statements
- Driver accounting
- Socket.IO for live updates
- Cashbox balance sync
- Order status updates
- Dashboard KPIs
- CSV export
- PDF generation with Puppeteer
- Financial reports
- Client statements
# Backend tests
cd backend
npm test
# Frontend tests
cd frontend
npm test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:coveragecd backend
npm run build
npm startcd frontend
npm run build
# Deploy dist/ to your hosting servicedocker-compose -f docker-compose.prod.yml up -d# Create new migration
cd backend
npm run migrate:make <migration-name>
# Run migrations
npm run migrate:latest
# Rollback
npm run migrate:rollback
# Check migration status
npm run migrate:statusSee .env.example files in backend/ and frontend/ for required environment variables.
DATABASE_URL- PostgreSQL connection stringJWT_SECRET- JWT signing secretPORT- Server port (default: 5000)
VITE_API_URL- Backend API URLVITE_SOCKET_URL- Socket.IO URL
API documentation available at /api-docs when running the backend.
# Start backend in watch mode
cd backend
npm run dev
# Start frontend in watch mode
cd frontend
npm run dev
# Run linters
npm run lint
# Format code
npm run format- Create a feature branch
- Make your changes
- Write tests
- Run the test suite
- Submit a pull request
MIT
For issues and questions, please open a GitHub issue.