Full-stack cafe management system — Cloudflare Workers, D1, React, Hono
翻译准备中
正在加载完整 README。
查看完整 README ↗Café management: a public menu with ordering, a staff panel for the day, and an admin workspace for the books.
Built with React, TypeScript and Tailwind CSS, served by Hono on Cloudflare Workers, D1 and KV.
Café Cloud · Screenshots · Quick start · Deploy · Contributing
| ☕ Public menu | Categories, search, filters, favourites, "Spin for me", ordering and order tracking, opening hours and events |
| 📋 Daily panel | A live order board (waiting, preparing, ready), new orders at the till, the checklist, the customer club and clock in/out |
| 📈 Finances | Revenue, expenses, wages and margin, payment mix, best sellers and closing the day |
| 🍰 Menu and stock | Items with cost, margin and availability; raw materials with recipes, automatic deduction and low-stock alerts |
| 👥 Staff and shifts | Team rates, clocked shifts and wages |
| 🤖 Telegram bot | Sales, shift, checklist and low-stock alerts, plus commands to run the café from the chat |
| ☁️ One-click deploys | CHTH Café Cloud deploys and updates a café in the owner's own Cloudflare account |
| 🌍 Five languages | The customer side in English, Persian, Arabic, Russian and Spanish, right-to-left where needed |
| 🧩 Part of CHTH | The shared CHTH brand kit and "Part of CHTH" footer |
Screenshots use the demo menu from schema.sql with two weeks of sample orders, shown as a café that hasn't uploaded photos yet.
| Layer | Technology |
|---|---|
| Runtime | Cloudflare Workers |
| Backend | Hono, Drizzle ORM |
| Database | Cloudflare D1 (SQLite) |
| Cache and state | Cloudflare KV |
| Frontend | React 18, Vite, Tailwind CSS 4, Lucide |
| Control plane | A separate Worker in control-plane/ |
Requirements: Node.js 22+ and npm.
git clone https://github.com/chethober/chth.cafe.git
cd chth.cafe
npm install
npm run db:seed
npm start
npm start (or npm run dev) generates fresh random admin and panel passwords on every startup and prints both to stdout. It also rotates SESSION_SECRET, invalidating previous sessions and order tracking tokens. Credentials are saved in the Git-ignored .dev.vars with owner-only permissions; other local bindings are preserved.
Database seed staff credentials are random and demo staff PINs are unset; set staff PINs in the admin workspace before using clock actions.
| App | URL |
|---|---|
| Menu | http://localhost:3000 |
| Admin | http://admin.localhost:3000 or http://localhost:3000/admin |
| Daily panel | http://panel.localhost:3000 or http://localhost:3000/panel |
Vite runs on port 3000 and proxies /api to the local Worker on port 8787. The startup scripts enable CAFE_DEV_PROXY locally to preserve the staff subdomain through Wrangler; do not enable this binding in deployment. Staff apps use their subdomains; because wrangler.jsonc sets CAFE_WORKSPACE_PATHS, they also open at /admin and /panel, as on workers.dev.
| Command | Purpose |
|---|---|
npm start / npm run dev | Generate passwords and start the UI and Worker together |
npm run dev:ui | Start only Vite |
npm run dev:worker | Start only the local Worker (build first) |
npm run db:seed | Initialize the local database from schema.sql |
npm run db:migrate:local | Apply backup.sql to the local database |
npm test | Run Worker/D1 integration, setup, control plane and release tests |
npm run check | Check TypeScript types |
npm run build | Check types and build production assets |
npm run release | Build and package a versioned release for the control plane in release/ |
npm run deploy:control-plane | Package a release and deploy the control plane |
Admin and panel use separate passwords and sessions. Admin manages finances, menu, inventory, staff and settings. Panel manages daily orders, menu availability, tasks and clock actions; its API access cannot change admin settings or financial and staff records. Set PANEL_PASSWORD separately from ADMIN_PASSWORD.
There are three ways to put a café online. Each café gets its own Worker, D1 database and KV namespace.
The control plane in control-plane/ lets owners sign in with their own Cloudflare account (with Cloudflare's consent screen or an API token), with no separate account to create, and deploy or update a café with one click. The café runs in the owner's account; the control plane never sees its passwords.
以上为 README 的开头部分。其余内容请阅读原文。 查看完整 README ↗