Production-oriented retail POS for a small startup shop, built with Next.js App Router, TypeScript, Tailwind CSS, Prisma, and PostgreSQL.
- Secure JWT cookie authentication with Admin and Cashier roles
- Dashboard with sales, returns, expenses, low stock alerts, and charts
- Fast POS screen with barcode-input scanning flow for USB scanners
- Transaction-safe sale completion with stock deduction and payment save in one transaction
- Thermal-style receipt printing and receipt reprint from sales history
- Product, inventory, expense, user, return, report, and settings modules
- Profit, sales, stock, expense, and cashier reports with PDF and Excel export
- Next.js 16 App Router
- TypeScript
- Tailwind CSS v4
- shadcn-style reusable UI primitives
- PostgreSQL
- Prisma ORM
- React Hook Form + Zod
- Recharts
- react-to-print
- jsPDF + jspdf-autotable
- xlsx
- jsbarcode
- Install dependencies
npm install- Create your environment file
cp .env.example .env-
Set
DATABASE_URL,DIRECT_URL,AUTH_SECRET, andAPP_URL -
Generate Prisma client
npm run db:generate- Run migrations
npm run db:migrate- Seed demo data
npm run db:seed- Start the app
npm run dev- Admin:
admin / admin123 - Cashier:
cashier / cashier123
npm run devnpm run buildnpm run startnpm run lintnpm run db:generatenpm run db:migratenpm run db:pushnpm run db:seednpm run db:studio
- Prisma schema: prisma/schema.prisma
- Initial SQL migration: prisma/migrations/202604161530_init/migration.sql
- The schema stores price snapshots in
SaleItemandReturnItem - Sales, payment save, and stock deduction happen in a single Prisma transaction
- Returns restore stock through transaction-backed stock movement records
- Create a Neon PostgreSQL database
- Copy the pooled Neon connection string into
DATABASE_URL - Copy the direct Neon connection string into
DIRECT_URL - Add
AUTH_SECRETandAPP_URLin Vercel environment variables - Deploy the repository to Vercel
- Run
npx prisma migrate deploy - Run
npx prisma db seedonce against production if you want starter data
DATABASE_URL="postgresql://..."
DIRECT_URL="postgresql://..."
AUTH_SECRET="a-long-random-secret-at-least-32-characters"
APP_URL="https://your-app.vercel.app"- Login with role-based access
- Add or edit products with unique barcodes
- Scan or search products into the POS cart
- Complete a sale and print a receipt after save
- Reduce stock automatically on sale
- Process returns and restore stock
- Track expenses
- Generate filtered reports and export to PDF or Excel
- Persist held carts across devices
- Better cashier mobile companion views
- Advanced audit logs and activity timeline
- Per-product image upload
- CSV import for products