A MYOB-like accounting system with Invoicing, Inventory, and Reporting
- Create draft invoices with multi-line items
- Post invoices with automatic stock deduction
- Moving average cost calculation
- Payment allocation (partial/full)
- Credit notes for returns
- Real-time stock tracking
- Moving average costing (perpetual)
- Stock ledger with full history
- Stock adjustments & opname
- Negative stock prevention
- Receive items from suppliers
- Bill management
- Payment processing
- Debit notes for returns
- Sales summary by period
- AR/AP aging reports
- Inventory valuation
- Profit & Loss statement
- Balance Sheet
- Trial Balance
- Role-based access control (RBAC)
- Permission-based UI
- Audit trail for all actions
- Period locking
- Node.js 18+
- Docker & Docker Compose
- npm or yarn
# Start MySQL and phpMyAdmin
make docker-up
# Or manually:
cd docker && docker-compose up -dServices:
- MySQL:
localhost:3306
make install
# Or manually:
cd apps/web && npm installmake dev
# Or manually:
cd apps/web && npm run devOpen http://localhost:3000 in your browser.
Use the default admin credentials:
- Email:
admin@sal-system.local - Password:
admin123
sal-system/
βββ apps/
β βββ web/ # Next.js application
β βββ app/
β β βββ api/v1/ # API Route Handlers
β β βββ (ui)/ # UI Pages
β β βββ layout.tsx
β βββ src/
β βββ lib/ # Client utilities
β βββ ui/ # React components
βββ packages/
β βββ shared/
β β βββ types/ # TypeScript types
β β βββ schemas/ # Zod validation schemas
β β βββ constants/ # Error codes, permissions
β βββ server/
β βββ db/ # Database connection
β βββ auth/ # Authentication
β βββ services/ # Business logic
βββ docker/
βββ docker-compose.yml
βββ mysql/
βββ init/ # SQL init scripts (schema + seed)
βββ conf.d/ # MySQL configuration
| Role | Description |
|---|---|
| Admin | Full system access |
| Owner | Reports & approvals |
| Finance | Post transactions, payments, reports |
| Sales | Create invoices, manage customers |
| Warehouse | Inventory management |
| Purchasing | Purchase orders, receiving |
- Frontend: Next.js 14 (App Router), React 18
- State Management: TanStack Query v5
- Validation: Zod
- Database: MySQL 8.0 (InnoDB)
- Authentication: JWT (jose)
- Styling: Vanilla CSS with design system
- Icons: Lucide React
POST /api/auth/login
POST /api/auth/logout
GET /api/me
GET /api/sales/invoices
POST /api/sales/invoices
GET /api/sales/invoices/:id
POST /api/sales/invoices/:id/post
POST /api/sales/payments
GET /api/inventory/stock-on-hand
GET /api/inventory/ledger
POST /api/inventory/adjustments
GET /api/reports/sales-summary
GET /api/reports/ar-aging
GET /api/reports/inventory-valuation
| Service | Port | Description |
|---|---|---|
| MySQL | 3306 | Database server |
Copy docker/.env and modify as needed:
MYSQL_ROOT_PASSWORD=rootpassword
MYSQL_DATABASE=sal_accounting
MYSQL_USER=sal_user
MYSQL_PASSWORD=sal_password
MYSQL_PORT=3306
PMA_PORT=8080# Docker
make docker-up # Start containers
make docker-down # Stop containers
make docker-logs # View logs
make db-reset # Reset database
# Development
make install # Install dependencies
make dev # Start dev server
make build # Production build
make start # Start production
make clean # Clean artifacts- β Check period lock (invoice date)
- β Validate invoice status = DRAFT
- β Check stock availability (if no_negative_stock enabled)
- β Lock item_stock rows (FOR UPDATE)
- β Update stock (deduct qty, calculate value)
- β Insert stock ledger entries
- β Create journal entries (AR, Sales, Tax, COGS, Inventory)
- β Update invoice status to POSTED
- β Update customer AR balance
- β Create audit log
MIT License - feel free to use for personal or commercial projects.
Built with β€οΈ for F&B Suppliers