Enterprise-ready Point of Sale (POS) API Backend for multi-outlet retail operations.
- Runtime: Node.js (LTS)
- Framework: Express.js
- Database: PostgreSQL
- ORM: Prisma
- Authentication: JWT + bcrypt
- Validation: Joi
- Node.js >= 18.0.0
- PostgreSQL database
- Redis (optional, for caching/queues)
# Install dependencies
npm install
# Copy environment file
cp .env.example .env
# Update .env with your database credentials
# Generate Prisma client
npm run prisma:generate
# Run database migrations
npm run prisma:migrate
# Start development server
npm run devDATABASE_URL="postgresql://user:password@localhost:5432/poslify"
JWT_SECRET=your-jwt-secret
PORT=3000| Method | Endpoint | Description |
|---|---|---|
| POST | /api/orders |
Create new order |
| GET | /api/orders |
List orders (paginated) |
| GET | /api/orders/:id |
Get order by ID |
| PATCH | /api/orders/:id/pay |
Mark order as paid |
| DELETE | /api/orders/:id |
Cancel order |
- RBAC: Strict Role-Based Access Control (Owner, Admin, Cashier)
- Multi-tenancy: Data scoped by store_id
- Ledger Pattern: Stock changes via stock_movements table
- Atomic Transactions: All orders use Prisma.$transaction
- Idempotency: POST /orders supports idempotency keys