A real-time POS-to-Kitchen-Display web app for small restaurants and cafes. One URL, three screens, real orders flowing live from counter to kitchen to table. No paper, no printers, no shouting across the pass.
Live demo: https://kitchendisplay.onrender.com
Server (phone/tablet) Express + Socket.IO + SQLite Kitchen (tablet/wall)
+-----------------+ new_order / order_status_update +-------------------+
| /pos | <-----------------------------------------> | /kds |
+-----------------+ +-------------------+
| |
+-------------------------- admin -------------------------------+
/admin (sales, orders, top items)
Anyone / +-------------------+
first visit /landing -> | public landing |
+-------------------+
| Screen | Path | What it does |
|---|---|---|
| Landing | /landing |
Public intro, hero, how-it-works, features. No login. |
| Sign in | /login |
Username + password. Show/hide password eye. |
| Sign up | /signup |
Open registration. Server or kitchen. The first account on a fresh database is admin. |
| POS | /pos |
Server takes orders. Menu grid + cart + send to kitchen. |
| My tables | /server-status |
Server's view of their own active orders. Cancel own pending, mark ready as served. |
| KDS | /kds |
Kitchen display. Three side-by-side rails (Pending / Preparing / Ready). Wait-time color bar, chime on new orders. |
| Admin | /admin |
Today's sales, top items, 7-day chart, full order history with filters. |
Plus:
- Real-time - Socket.IO pushes new orders and status changes the second they happen.
- Three roles - server, kitchen, admin. Each screen enforces its own role.
- Print - thermal-80mm friendly popup for kitchen tickets and customer receipts.
- Currency - PHP (default) and USD. Toggle in the topbar, constant rate of 56 PHP/USD.
- Self-healing DB - schema migrations and seed accounts re-apply on every boot.
- Stale auto-cancel - pending orders idle for more than 30 minutes get auto-cancelled so the kitchen pass doesn't drown in abandoned tickets.
- No emojis, no dark mode - one clean monochrome theme.
| Role | Username | Password | Lands on |
|---|---|---|---|
| Admin | zham |
not published, see below | /admin |
| Server | server |
ServerPass!2026-KDS |
/pos |
| Kitchen | kitchen |
KitchenPass!2026-KDS |
/kds |
The server and kitchen passwords are in this table on purpose. Those two roles are what a visitor is meant to try, and open signup hands them out anyway. They cannot read revenue, change the menu or touch another restaurant's data.
The admin password is not in this file. This repository is public, so a
password written here is a login, not a demo feature. In production the admin
account is created with KDS_ADMIN_PASSWORD if that is set in the environment,
and otherwise with a random one-time password that the server prints to the
deploy log and nowhere else. In development it is still
ZhamAdmin!2026-KDS so npm run dev works out of the box.
Click any row on the login screen to autofill. The quick-fill panel only renders
in a development build, so the passwords above are not shipped inside the
production JavaScript bundle. Sign up more accounts at /signup if you want to
test a multi-server / multi-kitchen flow.
The demo accounts are seeded automatically and never overwrite a password that already exists. The old version reset them on every boot, which made changing the admin password impossible; it now only creates accounts that are missing. Set
KDS_SEED_DEMO=falseto create no accounts at all and make your own through a console.
Before putting this anywhere public, read this section. A few things were hardened in v6.4, and a few things are your job.
Handled:
- The JWT signing key is no longer a hardcoded fallback. It used to fall
back to the literal
kds-dev-secret-change-me, which is public in the git history, so anyone could mint a token withrole: "admin"and the server accepted it. In production the server now refuses to start withoutJWT_SECRET. In development it generates a random per-boot key and warns. - Public signup can no longer create an admin.
POST /api/auth/signuphonoured therolefield from the request body, sorole: "admin"in one POST gave a full admin account on a publicly reachable app. Signup now only grantsserverorkitchen; the first account on an empty database is still admin so a fresh deploy is usable. - Demo passwords are no longer reset on every boot. The old seed migration compared each stored hash against the demo password and overwrote it on any mismatch, which silently undid any password change on the next restart.
- The admin password is no longer published. This repository is public, so
the admin password that used to sit in this file was a working admin login on
a publicly reachable app. In production the admin is now created with
KDS_ADMIN_PASSWORDfrom the environment, or with a random one-time password that the server prints to the deploy log. The server and kitchen demo passwords stay public, because those are the roles a visitor should try. - Login is rate limited. 10 attempts per IP and username per 15 minutes,
then
429. - Order input is bounded. Quantity is 1-99 and capped at 50 lines per
order.
qty: 1000000previously produced a PHP 220,000,000 ticket.?limit=-1on the admin history query previously meant "no limit". - Prices must be finite and non-negative.
price: -500was accepted. - Malformed JSON returns JSON. A bad request body used to answer with an HTML stack trace.
Your job:
- Set a real
JWT_SECRETand change theCORS_ORIGINfrom*. - Set
KDS_ADMIN_PASSWORDin the deploy environment, so the admin password is yours and does not change on every redeploy. If you leave it unset the server generates one and prints it to the log. - Remember the old signing key is compromised. Any token signed with it is still valid for up to 12 hours, so restart the process after deploying.
Money is stored as a SQLite REAL, so totals can drift by a fraction of a
cent over many orders. It is fine for a demo and for whole-peso pricing. If
this ever takes real money, move prices and totals to integer centavos.
| Action | Server | Kitchen | Admin |
|---|---|---|---|
| Take a new order | yes | - | yes |
| Mark pending -> preparing | - | yes | yes |
| Mark preparing -> ready | - | yes | yes |
| Mark ready -> served | yes | - | yes |
| Cancel your own PENDING order | yes | - | yes |
| Cancel any order, any state | - | - | yes |
| View today's sales / 7-day history | - | - | yes |
| View full order history (filter) | - | - | yes |
cd server
npm install
npm start # http://localhost:4000 (auto-seeds DB on first run)
# Frontend (only if you want hot-reload while developing)
cd ../client
npm install
npm run build # outputs ./dist once
cd ../server
npm start # server now serves /dist on the same portThe server already binds 0.0.0.0. Pick whichever fits your setup.
With the VM powered off, in VirtualBox Manager:
- Select the Kali VM -> Settings -> Network -> Adapter 1
- Confirm "Attached to: NAT"
- Click Advanced -> Port Forwarding
- Add a rule: Name
kds, Protocol TCP, Host port4000, Guest port4000 - OK, OK. Start the VM.
Then on the host laptop: http://localhost:4000 works.
On other devices on the same WiFi: find your host LAN IP via
PowerShell ipconfig (look for IPv4 under Wi-Fi), then hit
http://<your-host-ip>:4000 from the phone or tablet.
In VirtualBox Manager (VM off):
- Settings -> Network -> Adapter 1
- Attached to Bridged Adapter, Name: your WiFi adapter
- OK, start the VM.
Find the VM's IP:
ip -4 addr | grep inet
# or
hostname -IThen any device on the WiFi hits http://<kali-ip>:4000/pos directly.
Three browser tabs:
http://localhost:4000/landinghttp://localhost:4000/pos(log in asserver)http://localhost:4000/kds(log in askitchen)http://localhost:4000/admin(log in aszham)
Real-time events fire across all four even on one machine.
The UI is mobile-first:
- POS: menu grid stacks above the cart on a phone, side-by-side on tablet and up.
- KDS: three rails stacked vertically on mobile (under 768px), side-by-side on tablet and up.
- Topbar: wraps on narrow screens, the clock and role chip hide under 768px.
- Admin tables: horizontal scroll on narrow screens.
- Landing: the section links used to disappear entirely below 768px, so a phone could not reach any of them. They now live in a scrollable row under the main bar.
Checked at 390, 768, 1024 and 1440 wide. No horizontal overflow on any page, no console errors, every control reachable.
For a true 2-device demo, do Option A or B above.
A step-by-step guide for three free paths lives in DEPLOY.md:
- Cloudflare Tunnel - 2 commands, no signup, instant public URL.
- ngrok - 5 minutes, free signup, stable free URL.
- Render.com - 15 minutes, permanent hosted URL. This is what the live demo above uses. Free tier, spins down after 15 min idle (30-60s cold start on the next hit), DB resets on each redeploy. Production use would need Render's $7/mo persistent disk add-on.
Or use the one-shot script:
chmod +x deploy-tunnel.sh
./deploy-tunnel.shStarts the server and opens a public Cloudflare tunnel. Ctrl+C cleans up.
All prices in the database are PHP - the source of truth. When you switch
the topbar toggle to USD, prices convert using a fixed rate
(RATE_PHP_PER_USD = 56 in client/src/lib/currency.jsx). So:
- Classic Cheeseburger: PHP 220.00 -> $3.93
- Cola: PHP 65.00 -> $1.16
The rate is a single constant in the frontend; change it to whatever baseline you want. The database itself stays in PHP either way.
To change the rate to a live one, set RATE_PHP_PER_USD to whatever you
get from a rates API. The current setup is intentionally static - no
extra moving parts.
kds-app/
+-- server/ # Express + Socket.IO + SQLite
| +-- index.js # REST API + WS + serves /dist
| +-- db.js # Schema + seed + self-healing migrations
| +-- routes/
| | +-- auth.js # /login, /signup, /me
| | +-- orders.js # /orders (state machine + stale auto-cancel)
| | +-- menu.js # /menu (admin CRUD)
| | +-- reports.js # /reports (sales, summary)
| +-- middleware/auth.js # JWT (12h TTL)
+-- client/
| +-- src/
| | +-- pages/ # Landing, Login, Signup, POS, KDS, Admin, ServerStatus
| | +-- components/ # OrderCard, MenuGrid, OrderTicket, TopBar,
| | | # StatusBadge, ProductImage, Modal, icons
| | +-- lib/ # api, socket, store (auth), toast,
| | | # currency, format, printTicket
| +-- tailwind.config.js # ink/paper/accent palette
| +-- src/index.css # CSS variables + base styles
| +-- public/screenshots/ # real screenshots used on the landing page
+-- README.md
+-- DEPLOY.md
POST /api/auth/login { username, password } -> { token, user }
POST /api/auth/signup { name, username, password, role } -> { token, user }
GET /api/auth/me Bearer -> { user }
GET /api/menu Bearer -> [...]
POST /api/menu admin
PATCH /api/menu/:id admin
DELETE /api/menu/:id admin
POST /api/orders server / admin
GET /api/orders/active kitchen / admin
GET /api/orders/mine server / admin
GET /api/orders/all?status= admin
PATCH /api/orders/:id/status role-gated state transition
GET /api/reports/sales admin
GET /api/reports/summary admin
| Event | Direction | Notes |
|---|---|---|
new_order |
server -> kitchen, admin | full hydrated order |
order_status_update |
any -> all | drops off KDS on served |
Auth is exchanged once via socket.handshake.auth.token (JWT).
- Palette: off-white (
#fafaf7) + ink black (#0a0a0a) + deep red accent (#b91c1c). One accent, used sparingly. No dark mode. - Typography: serif (Georgia stack) for display, system sans for body, monospace for numbers and receipts.
- Spacing: generous. Sharp 2px corners, no shadows, hairline borders.
- Currency: context-based, PHP default. Toggle persists in localStorage.
- Product photos: 15 Unsplash food photos referenced by URL in
menu_items.image. If a URL 404s, the placeholder renders (clean colored block with the food name). Swap URLs in the DB or via the menu admin. - Logout: confirms via modal before signing out.
- Modal: small reusable
<Modal>component, Escape + backdrop to dismiss.
- JWT session: 12 hours. After that you have to log in again.
- Render free tier: 15 min idle = spin down. Next hit takes 30-60s.
- Render free tier DB: no persistent disk, so the SQLite file resets on each redeploy. Demo accounts re-seed automatically. Production needs Render's $7/mo disk.
- No payments: the POS sends orders to the kitchen, it does not charge cards.
- No multi-tenant: one deployment = one restaurant.
- No image upload: menu photos are external URLs, not stored on the server.
rm -rf server/data
# Restart the server. DB will be re-created and seeded fresh.- Zero external runtime services. Runs on a laptop. Deploy is one Render web service away, see DEPLOY.md.
- Socket.IO falls back to long-polling if WebSockets are blocked.
- Web Audio API used for kitchen alerts - no audio asset files.
- All timestamps in SQLite are UTC; client formats elapsed durations locally.
- Server-side schema migrations are idempotent and self-heal on every boot.
- State machine is centralised in
server/routes/orders.js- the file is the source of truth for who can move what status.