Poslify
Point of Sale (POS) API built with Node.js, Express, Prisma & PostgreSQL. Features multi-tenancy, atomic transactions, and ledger-based inventory management
Install / Use
/learn @akbarwjyy/PoslifyREADME
Poslify POS API
Enterprise-ready Point of Sale (POS) API Backend for multi-outlet retail operations.
Tech Stack
- Runtime: Node.js (LTS)
- Framework: Express.js
- Database: PostgreSQL
- ORM: Prisma
- Authentication: JWT + bcrypt
- Validation: Joi
Getting Started
Prerequisites
- Node.js >= 18.0.0
- PostgreSQL database
- Redis (optional, for caching/queues)
Installation
# 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 dev
Environment Variables
DATABASE_URL="postgresql://user:password@localhost:5432/poslify"
JWT_SECRET=your-jwt-secret
PORT=3000
API Endpoints
Orders
| 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 |
Business Rules
- 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
