Skip to content

datnp1003/pos-fnb

Repository files navigation

POS-F&B Dashboard

🍜 POS-F&B

Open-source Point of Sale for Restaurants, CafΓ©s & Karaoke

Version 1.2.0 MIT License Next.js 16 Prisma + SQLite 5 languages


✨ What is POS-F&B?

POS-F&B is a complete restaurant management system built with Next.js. It handles everything from table orders and kitchen printing to inventory, cash flow, and business reports β€” all in one app.

🎯 Born from real restaurant needs in Vietnam. Ready for the world.

πŸ“Έ Screenshots

Login Dashboard Order
Inventory Cash Reports

πŸš€ Features

🧾 Order Management

  • Table grid view β€” drag & drop tables by area (Restaurant, Karaoke, Takeaway)
  • Open / Merge / Split tables with guest count tracking
  • Product catalog with categories, toppings, VAT, excise tax
  • Send to kitchen β€” prints kitchen tickets (order items only, no price)
  • Pre-bill & Checkout with multiple payment methods (cash, transfer, Momo, etc.)
  • Discounts (% or fixed), service charges, happy hour, holiday surcharges

πŸ“¦ Inventory & Stock

  • Stock In / Stock Out tracking with suppliers
  • Unit conversion (purchase unit ↔ base unit)
  • Recipe-based usage β€” auto-deduct ingredients per dish sold
  • Low stock alerts with min-stock thresholds

πŸ’° Cash Flow

  • Cash register β€” open/close shift with opening/closing balance
  • Income & Expense tracking by category
  • Discrepancy detection (expected vs actual)

πŸ“Š Reports & Excel Export

  • Revenue Report β€” by day, payment method, expense category
  • Ingredient Report β€” stock in/out detail, supplier breakdown
  • Warehouse Report β€” current stock overview, low stock alerts
  • Sold Items Report β€” top-selling products
  • Invoice Report β€” all transaction history
  • Export to Excel β€” all reports downloadable as .xlsx

πŸ–¨οΈ Dual-Mode Printing

  • Server Mode β€” server sends TCP directly to thermal printers (for local networks)
  • Client Mode β€” server builds content, device prints via WiFi/Bluetooth/USB (for cloud deployments)
  • Visual Template Editor β€” drag & drop toggle for header/body/footer fields
  • Separate ORDER vs BILL templates β€” kitchen tickets show only itemsΓ—qty (no money); bills show full header/footer with prices

🌐 Multi-Language (i18n)

  • πŸ‡»πŸ‡³ TiαΊΏng Việt | πŸ‡¬πŸ‡§ English | πŸ‡¨πŸ‡³ δΈ­ζ–‡ | πŸ‡°πŸ‡· ν•œκ΅­μ–΄ | πŸ‡―πŸ‡΅ ζ—₯本θͺž
  • Switch language from header or login page
  • LocalStorage persistence

βš™οΈ System Modules

  • Toggle individual modules on/off (Orders, Inventory, Reports, Karaoke, KDS)
  • Disabled modules are hidden from the sidebar menu

πŸ” Auth & Roles

  • NextAuth.js with credential provider
  • Role-based access control (Admin, Staff, etc.)
  • Custom permission JSON per role

πŸ›  Tech Stack

Layer Technology
Framework Next.js 16 (App Router, Turbopack)
Language TypeScript
Database SQLite via Prisma
Auth NextAuth.js v5 (Credentials)
UI shadcn/ui + Tailwind CSS
Icons Lucide
Excel Export ExcelJS
PDF/Screenshots Puppeteer
Charts Recharts
Toast Sonner
i18n Custom context + provider (5 languages)
Printing TCP sockets (server) / Web Bluetooth API (client)
Package Manager npm

πŸ“¦ Quick Start

Prerequisites

  • Node.js 20+ and npm

1. Clone & Install

git clone https://github.com/datnguyen/pos-fnb.git
cd pos-fnb
npm install

2. Environment Setup

cp .env.example .env.local
# Edit .env.local with your values:
#   AUTH_SECRET = any random string (openssl rand -base64 32)
#   AUTH_URL   = http://localhost:3000

3. Database Setup

npx prisma migrate dev --name init
npx prisma db seed   # Creates default admin account + sample data

4. Run

npm run dev           # Development (Turbopack)
# OR
npm run build && npm start   # Production

Open http://localhost:3000 β€” default login: admin / admin123


🚒 Production Deployment

# Build
npm run build

# Start with PM2
pm2 start npm --name pos-fnb -- start
pm2 save

For HTTPS, use a reverse proxy (nginx, Caddy, Cloudflare Tunnel).

Printer Setup

  • Local network: Set printer mode to "Server" β†’ enter IP & port of your thermal printer
  • Cloud / Mobile: Set printer mode to "Device" β†’ print from phone browser via Bluetooth/WiFi

πŸ“ Project Structure

pos-fnb/
β”œβ”€β”€ prisma/
β”‚   β”œβ”€β”€ schema.prisma        # Database schema (40+ models)
β”‚   β”œβ”€β”€ seed.ts              # Seed data (sample menu, accounts)
β”‚   └── migrations/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ (auth)/login/    # Login page
β”‚   β”‚   └── (pos)/
β”‚   β”‚       β”œβ”€β”€ dashboard/    # Dashboard with stats & timeline
β”‚   β”‚       β”œβ”€β”€ order/        # Table management & ordering
β”‚   β”‚       β”œβ”€β”€ inventory/    # Stock in/out & tracking
β”‚   β”‚       β”œβ”€β”€ cash/         # Cash register & flow
β”‚   β”‚       β”œβ”€β”€ reports/      # 5 report types + Excel export
β”‚   β”‚       └── settings/     # 20+ config pages
β”‚   β”œβ”€β”€ server/              # Server actions (Prisma queries)
β”‚   β”œβ”€β”€ i18n/                # 5-language dictionaries
β”‚   β”œβ”€β”€ hooks/               # React hooks (useBluetoothPrinter)
β”‚   β”œβ”€β”€ components/ui/       # shadcn/ui components
β”‚   └── lib/                 # Utilities (db, auth, utils)
β”œβ”€β”€ screenshots/             # App screenshots
β”œβ”€β”€ docs/                    # User guides
└── public/                  # Static assets

🌍 Internationalization

POS-F&B supports 5 languages out of the box:

Language Code Coverage
πŸ‡»πŸ‡³ TiαΊΏng Việt vi 100% (reference)
πŸ‡¬πŸ‡§ English en 100%
πŸ‡¨πŸ‡³ δΈ­ζ–‡ zh 100%
πŸ‡°πŸ‡· ν•œκ΅­μ–΄ ko 100%
πŸ‡―πŸ‡΅ ζ—₯本θͺž ja 100%

To add a new language: copy src/i18n/vi.ts β†’ translate values β†’ register in src/i18n/dictionaries.ts.


🀝 Contributing

Contributions are welcome! Here's how:

  1. Fork the repo
  2. Create a branch: git checkout -b feature/amazing-feature
  3. Commit: git commit -m "Add amazing feature"
  4. Push: git push origin feature/amazing-feature
  5. Open a Pull Request

What we need help with

  • Translations for more languages
  • Payment gateway integrations (VNPay, Stripe, PayPal)
  • Receipt printer ESC/POS protocol improvements
  • Unit & E2E tests

πŸ“ Changelog

See CHANGELOG.md for version history.


πŸ‘₯ Authors

  • CΓ΄ng Tα»­ β€” Product owner, domain expertise
  • MαΊ­p 🐼 β€” AI assistant, development & maintenance

πŸ“§ Contact: datnp100394@gmail.com


πŸ“„ License

MIT β€” see LICENSE for details. Free for personal and commercial use.


Built with β˜• and 🍜 by restaurant people, for restaurant people.