ApexPOS is a modern, real-time, cloud-native Software-as-a-Service (SaaS) Point of Sale (POS) and Enterprise Resource Planning (ERP) platform. Designed for high performance, dual-tax compliance, and seamless multi-branch scalability.
Note
DevOps & Infrastructure: Looking for the CI/CD pipeline configurations, Docker setups, Kubernetes/Helm manifests, or Terraform IaC? Check out the ApexPOS DevOps Repository.
The platform is designed around a decoupled Client-Server architecture using the MERN stack with real-time bidirectional communication.
graph TD
%% Define Styles
classDef client fill:#3b82f6,stroke:#1d4ed8,stroke-width:2px,color:#fff;
classDef server fill:#10b981,stroke:#047857,stroke-width:2px,color:#fff;
classDef database fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff;
classDef security fill:#ef4444,stroke:#b91c1c,stroke-width:2px,color:#fff;
classDef module fill:#8b5cf6,stroke:#6d28d9,stroke-width:2px,color:#fff;
%% Nodes
Client["π» React SPA Client (Vite + Zustand)"]:::client
WebSocket["β‘ Socket.IO Client"]:::client
subgraph ExpressApp ["Express.js Web Server"]
Express["π Express REST API Engine"]:::server
Helmet["π‘οΈ Helmet Security Headers"]:::security
RateLimit["β³ Rate Limiters"]:::security
Auth["π JWT Authenticator"]:::security
SocketIO["π Socket.IO Server Manager"]:::server
end
Mongo[("π MongoDB Database")]:::database
%% Business Modules
subgraph Modules ["Core Modules"]
Retail["π Retail Register"]:::module
Rest["π½οΈ Hospitality (Table / KOT)"]:::module
Repair["π§ Device Repair Logs"]:::module
HP["π³ Installment / Hire Purchase"]:::module
Delivery["π Live Delivery Tracker"]:::module
TradeIn["β»οΈ Trade-In Valuations"]:::module
end
%% Flows
Client -->|HTTP REST Requests| Helmet
Client -->|WebSocket Handshake| SocketIO
Helmet --> RateLimit
RateLimit --> Auth
Auth --> Express
SocketIO <-->|Bi-directional Sync| WebSocket
Express <-->|Mongoose ORM| Mongo
Client -.-> Retail
Client -.-> Rest
Client -.-> Repair
Client -.-> HP
Client -.-> Delivery
Client -.-> TradeIn
All transactions, inventory status, and active cash register drawer shifts are synchronized live across cashiers and managers using WebSocket events.
sequenceDiagram
autonumber
actor CashierA as π Cashier A (Terminal 01)
participant Server as π Express Server (Socket.IO)
actor CashierB as π Cashier B (Terminal 02)
actor Manager as π Manager Dashboard
CashierA->>Server: Process Sale (Emit "new-transaction")
Server->>Server: Update Inventory in MongoDB
Server-->>CashierA: Acknowledge Success & Print Receipt
Server-->>CashierB: Broadcast "stock-updated" (Live Sync UI)
Server-->>Manager: Broadcast "revenue-updated" (Real-time charts update)
The database architecture consists of highly optimized relational models managed via Mongoose ORM.
erDiagram
STAFF ||--o{ SHIFT : "manages"
PRODUCT }|--|| CATEGORY : "belongs to"
SALE ||--|{ SALE_ITEM : "contains"
SALE_ITEM }|--|| PRODUCT : "references"
SALE }|--|| CUSTOMER : "purchased by"
ORDER ||--o{ ORDER_ITEM : "contains"
ORDER_ITEM }|--|| PRODUCT : "references"
ORDER }|--|| TABLE : "placed at"
HIRE_PURCHASE ||--o{ INSTALLMENT_PLAN : "has"
STAFF {
ObjectId id
string name
string email
string role
string pin_hash
string branch_id
}
SHIFT {
ObjectId id
ObjectId cashierId
float openingFloat
float expectedCash
float actualCash
string status
}
PRODUCT {
ObjectId id
string name
float price
int stock
string barcode
}
SALE {
ObjectId id
float grandTotal
float vatAmount
float ssclAmount
string paymentStatus
string cashierName
}
- β‘ Real-Time Synchronized Registers: Multi-terminal registers synchronize state changes, cash float updates, and order placements instantly.
- π Live Rich Analytics: Interactive business intelligence dashboard built with
rechartsfor calculating revenue, gross profit, and peak transactions. - π Dynamic Localization: Dynamic localization switching powered by
react-i18nextfor seamless multi-language compatibility. - π Role-Based Access Control (RBAC): Fine-grained user role permissions (
super_admin,branch_admin,manager,cashier,accountant,Technician) backed by JSON Web Tokens. - πΈ Dual-Tax Support: Sri Lankan tax compliant computation engine calculating Value Added Tax (VAT - 18%) and Social Security Contribution Levy (SSCL - 2.5%).
- π€ Specialized Industry Add-ons:
- Mobile Repairs & Service Logs: IMEI logs, estimated repair costs, status tracking, and technician signature liability pads.
- Hire Purchase & Installments: Installment plan scheduler, down payments, and due collections ledger.
- Restaurant KOT & Table Management: Live table status mapping (Available/Occupied/Reserved) and Kitchen Order Tickets (KOT) routing.
- Node.js v18.x or v20.x
- MongoDB v6.x running locally on port
27017
git clone https://github.com/Ntharusha/ApexPOS.git
cd ApexPOScd server
npm installCreate a .env file inside server/ using the following:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/apexpos
JWT_SECRET=your_super_secret_jwt_key_change_this
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:80,http://localhost:30080Start backend development:
npm run devcd ../client
npm installCreate a .env file inside client/ using the following:
VITE_API_URL=http://localhost:5000/apiStart frontend development:
npm run devOpen http://localhost:5173 in your browser.
From the server/ directory:
- Seed default admin credentials:
node seedAdmin.js
- Seed sample business categories and products:
node seedProducts.js
- Super Admin Dashboard Access:
- Email:
admin@apexpos.com - Password:
admin123
- Email:
- Fast Cashier Terminal Access:
- PIN:
1234
- PIN: