A fast, modern POS and inventory app built with Next.js App Router and Prisma. Includes drag‑and‑drop item organization, order creation, analytics, and Bluetooth thermal printing.
- Dashboard: Revenue, orders, items-in-stock, retention-like metric, recent orders, and quick actions.
- Inventory:
- Add/Edit/Delete items (price, weight, quantity, in-stock) and manage categories (color, rename, delete).
- Search, pagination for uncategorized.
- Drag‑and‑drop items across categories with auto-scroll while dragging.
- Long‑press/right‑click to enter selection mode; multi‑select and mass move between categories or to uncategorized.
- Orders:
- Create orders with search + category filter, inline quantity controls, customer name, notes, and live totals.
- View order details (responsive table/cards) and edit existing orders.
- Bluetooth thermal printing via Web Bluetooth; printer pairing and persisted direct-print support.
- Analytics: Daily/weekly/monthly charts, metrics, top items, today stats, loading/empty states.
- Auth & Security: Cookie-based sessions, middleware-protected routes, CSRF on mutations, login rate limiting.
- Performance/UX: Server actions with cache, Prisma transactions, Suspense loaders, responsive sidebar and tablet navbar, toasts.
- Framework: Next.js 15 (App Router), React 18, TypeScript
- Data: PostgreSQL, Prisma ORM
- UI: Tailwind CSS, shadcn/ui (Radix), lucide-react
- DnD: react-dnd-multi-backend (HTML5 + touch)
- Charts: Recharts-like custom charting in
components/analytics - Printing: Web Bluetooth (ESC/POS-like, AT POS/Epson/Star paths)
src/app/dashboard/page.tsx: Metrics, recent orders, quick links.src/app/items/page.tsx: Inventory with DnD categories, selection mode, add/edit/delete, pagination.src/app/orders/page.tsx: Orders list with actions (print/delete) and Pair Printer button.src/app/orders/create/page.tsx: Create order UI with search, category filter, quantities, totals.src/app/orders/[id]/page.tsx: Order details with responsive layout; print/edit/delete.src/app/orders/[id]/edit/page.tsx: Edit order client flow.src/app/analytics/page.tsx: Metrics + interactive chart (daily/weekly/monthly).src/app/settings/page.tsx: App settings and paired printer persistence.
- Middleware (
src/middleware.ts): Auth gating, redirects, CSRF validation for API mutations, SSR-friendly headers. - Auth (
src/app/api/auth/*,src/hooks/use-auth.ts): Cookie session, verify session, logout; login rate limiting. - APIs/Actions: Items, categories, orders, analytics, and settings via API routes and server actions with caching.
- Pair via Orders page “Pair Printer”.
- Print from order actions; robust service/characteristic discovery and chunked writes.
- Supports common ESC/POS-compatible devices (AT POS, Epson, Star) with fallbacks.
- Node.js 18+
- PostgreSQL
- Install dependencies:
npm install- Configure environment:
cp .env.example .env # ensure DATABASE_URL is set- Initialize database:
npx prisma migrate dev- Run the app:
npm run devOpen http://localhost:3000.
src/app/: App Router pages, API routes, middleware-aware SSRsrc/components/: Reusable UI including items DnD, orders, analyticssrc/lib/: Prisma, auth, services, utilities (Bluetooth, printing)prisma/: Schema and migrationspublic/: Static assets (includesdemo.mp4)
MIT