LoomPOS is a high-performance, single-store Point of Sale (POS) system engineered for rapid retail operations. Built with a sleek desktop-first design, LoomPOS features sub-second barcode checkout, dynamic tax breaks (GST), offline state syncing, real-time analytics, and secure admin gates.
| Admin Analytics & Reporting | POS Billing & UPI Checkout |
|---|---|
Daily summaries, revenue analytics, and sales trends |
Sub-second scanning and dynamic UPI QR generation |
- β‘ Sub-Second Checkout: Optimized cart management with integrated hardware barcode scanner support, instant item matching, and a keyboard/SKU autocomplete dropdown featuring full arrow key navigation and instant select shortcuts.
- π Financial Analytics: Real-time sales dashboards tracking daily revenue, order counts, tax aggregates, and 7-day performance logs.
- π§Ύ Compliant GST Engine: Automatic tax calculation with real-time grouping by GST rates (5%, 12%, 18%, 28%) and invoice generation.
- π¨οΈ Multi-Format Printing: Dedicated printing templates for standard 80mm thermal receipt printers and professional A4 tax invoices.
- π² Dynamic UPI QR Codes: Dynamically encodes store credentials and exact payable totals into instant, scan-to-pay QR codes.
- π Multi-Tiered Security: Granular, role-based access control (RBAC) separating administrative actions from cashier checkouts.
- π¦ Barcode Sheet Generator: Utility to configure and print customized barcode sheet layouts for product inventory tagging.
- Core: React 18, TypeScript, Tailwind CSS, Framer Motion, Lucide Icons
- State Management: Zustand (with persistent local storage caching)
- Build System: Vite
- Server: Node.js, Express.js (TypeScript)
- Runtime Runner: TSX runtime watcher
- Database: PostgreSQL
- ORM: Prisma ORM (with native client query engine)
- Security: JSON Web Tokens (JWT), Bcrypt.js password hashing
- Validation: Zod Schemas (API payloads validation)
LoomPOS utilizes a decoupled client-server architecture designed for high availability and low latency:
- React Single Page Application: Serves as the interactive desktop interface. Delegates state management (cart items, active sessions, and settings) to Zustand to avoid prop drilling and minimize re-renders.
- RESTful API Backend: A stateless Express.js server that validates payload structures using Zod schemas and processes queries via Prisma.
- Transaction Safety: All checkout operations run inside a database-level transaction (
prisma.$transaction). If any product is out of stock or does not match inventory checks, the operation is rolled back, preventing partial writes.
π View Project Structure Tree
loom-pos/
βββ prisma/ # Database configuration and migrations
β βββ migrations/ # SQL database migration history
β βββ schema.prisma # Prisma schema and relationship definitions
βββ public/ # Static public assets (custom favicon, logos)
βββ scripts/ # CLI utility scripts (DB verification, password resets)
βββ server/ # Backend REST API Server (Express.js)
β βββ index.ts # API endpoints, middleware, and server bootstrap
βββ src/ # Frontend Client App (Vite + React)
β βββ components/ # Component architecture
β β βββ auth/ # Auth gates & login screen
β β βββ billing/ # Checkout carts, QR codes, print engines
β β βββ dashboard/ # Sales charts & financial analytics
β β βββ inventory/ # Product grids & barcode generators
β β βββ layout/ # Application shell & sidebar layouts
β β βββ settings/ # Store settings & cashier configurations
β βββ hooks/ # Custom React hooks (global scanner)
β βββ lib/ # Shared helpers (Prisma clients, formatters)
β βββ store/ # Zustand global store configuration
β βββ App.tsx # Application router and guards
βββ package.json # Configuration scripts and dependencies
βββ vite.config.ts # Bundler configuration
The database consists of 5 core models structured for strict transaction isolation and audit compliance:
π View Entity-Relationship Diagram (ERD) & Schema Details
erDiagram
User ||--o{ Order : processes
Order ||--|{ OrderItem : contains
Product ||--o{ OrderItem : details
StoreSettings {
String id PK
String name
String address
String gstin
String upiId
String phone
String cashierPassword
}
User {
String id PK
String employeeId UK
String name
String role
String phone
String password
Boolean isActive
}
Product {
String id PK
String name
String sku UK
String barcode UK
String category
String size
String color
Float costPrice
Float sellingPrice
Float gst
Int stock
String supplier
}
Order {
String id PK
String invoiceNo UK
DateTime date
Float totalAmount
Float gstAmount
String paymentMethod
String customerName
String customerMobile
String userId FK
}
OrderItem {
String id PK
String orderId FK
String productId FK
Int quantity
Float price
}
git clone https://github.com/your-username/loom-pos.git
cd loom-posnpm installConfigure your PostgreSQL URL (see the Environment Variables section below) and run:
npx prisma migrate dev --name initPopulate the database with realistic products, staff accounts, and 7-day transaction logs to display graphics on the dashboard:
npm run seedCreate a .env file in the root directory:
| Variable | Description | Default / Example Value |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgresql://postgres:postgres@localhost:5432/loompos?schema=public |
JWT_SECRET |
Cryptographic secret for signing tokens | super-secret-cryptographic-hash-key-here |
Start the development environment by launching the API backend and Vite client.
1. Start the API Server:
npx tsx watch server/index.ts- Runs on
http://localhost:3001 - Creates a default admin account on startup: Employee ID:
admin/ Password:admin123
2. Start the Frontend Client:
npm run dev- Runs on
http://localhost:5173
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/api/auth/login |
Authenticate cashier/admin and retrieve JWT token | None |
POST |
/api/auth/change-password |
Update current user password | Bearer JWT |
GET |
/api/users |
List all staff members | Admin JWT |
POST |
/api/users |
Register a new cashier or admin account | Admin JWT |
GET |
/api/products |
Fetch paginated & searchable product catalog | None |
POST |
/api/products |
Add new product to inventory | Admin Key / JWT |
PUT |
/api/products/:id |
Modify an existing product catalog details | Admin Key / JWT |
DELETE |
/api/products/:id |
Remove a product from catalog | Admin Key / JWT |
POST |
/api/orders |
Create an invoice and update stock levels | None |
GET |
/api/orders |
Query invoice transaction history (with filters) | None |
GET |
/api/orders/:id |
Retrieve single transaction receipt details | None |
GET |
/api/settings |
Get invoice metadata (GSTIN, UPI ID, Address) | None |
PUT |
/api/settings |
Update company settings and company logo | Admin JWT |
GET |
/api/analytics/summary |
Retrieve sales revenue, orders count, and GST summaries | None |
GET |
/api/analytics/sales |
Retrieve 7-day revenue trend | None |
GET |
/api/inventory/low-stock |
Retrieve products with stock level <= 10 | None |
Processes incoming billing carts through isolated transactions (prisma.$transaction) to perform absolute safety checks on available stock. Features a search-by-keyword autocomplete dropdown with full keyboard navigation (arrows + Enter/Escape shortcuts) to enable high-speed checkout without needing a mouse.
Aggregates sales records directly from the database to present real-time dashboards of business indicators. Measures overall GST collections and tracks payment breakdowns across CASH, UPI, and CARD.
Manages catalog attributes, stock configurations, and barcode labeling. Emits preview components styled to match real-world layout printing specs.
Build the optimized static frontend bundle:
npm run buildFrontend assets are built to /dist, ready to be served by Nginx, Cloudflare, or Netlify.
Serve the backend API under process manager monitoring (PM2):
pm2 start npx --name "loompos-api" -- tsx server/index.ts- Bcrypt Hashing: All individual and global passwords are encrypted using Bcrypt with 10 salt rounds before database storage.
- Token Integrity: Authenticated routes verify session details using signed JSON Web Tokens expiring after 12 hours.
- Admin Verification Overrides: Non-admin users attempting catalog or system updates must supply an authorized admin key passphrase passed via the custom header
x-admin-verification-key.
Contributions are welcome! Please follow these steps:
- Fork the Project.
- Create your Feature Branch (
git checkout -b feature/AmazingFeature). - Commit your Changes (
git commit -m 'Add some AmazingFeature'). - Push to the Branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Distributed under the MIT License. See LICENSE for more details.

