untitled-9443README.md4 matches
16```
17โโโ backend/
18โ โโโ database/
19โ โ โโโ migrations.ts # Database schema setup
20โ โ โโโ queries.ts # Database query functions
21โ โโโ routes/
22โ โ โโโ students.ts # Student CRUD operations
441. The backend API runs on the main HTTP endpoint
452. Frontend is served at the root path
463. All data is stored in SQLite database
474. Real-time updates via API polling
48
reactHonoStarterREADME.md1 match
21## Further resources
2223- [React Hono Example](https://www.val.town/x/stevekrouse/reactHonoExample) is a bigger example project, with a SQLite database table, queries, client-side CSS, a favicon, and shared code that runs on both client and server.
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations, seedInitialData } from "./database/migrations.ts";
4import menuRoutes from "./routes/menu.ts";
5import ordersRoutes from "./routes/orders.ts";
13});
1415// Initialize database on startup
16let dbInitialized = false;
17async function initializeDatabase() {
18if (!dbInitialized) {
19await runMigrations();
20await seedInitialData();
21dbInitialized = true;
22console.log('Database initialized successfully');
23}
24}
34status: "ok",
35timestamp: new Date().toISOString(),
36database: dbInitialized ? "initialized" : "pending"
37});
38});
44// Admin panel route
45app.get("/admin", async c => {
46await initializeDatabase();
47let html = await readFile("/frontend/index.html", import.meta.url);
48
59// Customer order page
60app.get("/order", async c => {
61await initializeDatabase();
62const tableQR = c.req.query("table");
63
77// Root route - redirect to admin for now
78app.get("/", async c => {
79await initializeDatabase();
80return new Response(null, {
81status: 302,
canteenDashboardStats.tsx1 match
150<div className="flex items-center">
151<div className="w-3 h-3 bg-green-500 rounded-full mr-3"></div>
152<span className="text-sm text-gray-700">Database Connection</span>
153</div>
154<span className="text-sm font-medium text-green-600">Active</span>
5getTableByQRCode,
6createTable
7} from "../database/queries.ts";
8import type { CreateTableRequest } from "../../shared/types.ts";
9
6updateOrderStatus,
7getOrdersByStatus
8} from "../database/queries.ts";
9import type { CreateOrderRequest, UpdateOrderStatusRequest, OrderStatus } from "../../shared/types.ts";
10
6updateMenuItem,
7deleteMenuItem
8} from "../database/queries.ts";
9import type { CreateMenuItemRequest } from "../../shared/types.ts";
10
canteenmigrations.ts3 matches
1import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
23// Database table names with versioning for schema changes
4export const TABLES = {
5MENU_ITEMS: 'canteen_menu_items_v1',
1011export async function runMigrations() {
12console.log('Running database migrations...');
1314// Create menu_items table
67`);
6869console.log('Database migrations completed');
70}
71
23- **Frontend**: React 18 with TypeScript
24- **Backend**: Hono.js API framework
25- **Database**: SQLite for data persistence
26- **Styling**: TailwindCSS
27- **QR Codes**: QR code generation and scanning
32```
33โโโ backend/
34โ โโโ database/
35โ โ โโโ migrations.ts # Database schema setup
36โ โ โโโ queries.ts # Database query functions
37โ โโโ routes/
38โ โ โโโ admin.ts # Admin panel routes
54## Getting Started
55561. The system will automatically set up the database on first run
572. Access the admin panel at `/admin` to set up menu items and tables
583. Generate QR codes for tables from the admin panel
78- `GET /api/tables/:id/qr` - Get QR code for table
7980## Database Schema
8182### Tables
untitled-4063auth.ts6 matches
1// Authentication middleware for the GYM Management System
23import { auth } from "../database/firebase.ts";
4import { userModel } from "../database/models.ts";
5import { logger } from "../utils/logger.ts";
6import { UserRole } from "../../shared/types.ts";
54}
5556// Get user data from database
57async function getUserData(uid: string): Promise<AuthenticatedUser | null> {
58try {
59const user = await userModel.findById(uid);
60if (!user) {
61logger.warn(`User not found in database: ${uid}`);
62return null;
63}
102const decodedToken = await verifyFirebaseToken(token);
103
104// Get user data from database
105const userData = await getUserData(decodedToken.uid);
106
107if (!userData) {
108logger.security('User not found in database', {
109uid: decodedToken.uid,
110path: c.req.path,