1import { serveFile } from "https://esm.town/v/std/utils/index.ts";
2import { generateCode } from "./backend/generate-code.ts";
3import { createTables } from "./database/migrations.ts";
4import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries.ts";
5
6await createTables();
21## Further resources
22
23- [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 } from "./database/migrations.ts";
4import api from "./routes/api.ts";
5
11});
12
13// Initialize database
14await runMigrations();
15
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getAllProducts, getProductById, createTransaction } from "../database/queries.ts";
3import type { PurchaseRequest, PurchaseResponse } from "../../shared/types.ts";
4
8- Purchase simulation with transaction logging
9- Simple, clean design with CSS styling
10- SQLite database for storing products and transactions
11
12## Structure
13
14- `backend/index.ts` - Main Hono server with API routes
15- `backend/database/` - Database setup and queries
16- `frontend/` - HTML, CSS, and JavaScript for the website
17- `shared/` - Shared types and utilities
22```
23โโโ backend/
24โ โโโ database/
25โ โ โโโ migrations.ts # Database schema
26โ โ โโโ queries.ts # Database operations
27โ โโโ routes/
28โ โ โโโ auth.ts # Authentication routes
52- **Backend**: Hono (TypeScript)
53- **Frontend**: React with TypeScript
54- **Database**: SQLite
55- **Styling**: TailwindCSS
56- **PDF Generation**: jsPDF
59## Getting Started
60
611. The application will automatically set up the database on first run
622. **Admin Login Credentials**:
63 - **Email**: `admin@fabrication.com`
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { runMigrations } from "./database/migrations.ts";
3import auth from "./routes/auth.ts";
4import bills from "./routes/bills.ts";
13});
14
15// Initialize database on startup
16await runMigrations();
17
76 }
77
78 console.log("Database migrations completed successfully");
79}
17app.use('*', errorHandler);
18
19// Initialize database (similar to connecting to MongoDB)
20await UserModel.init();
21
8
9- **Express โ Hono**: Web framework for routing and middleware
10- **MongoDB/Mongoose โ SQLite**: Database with ORM-like patterns
11- **Node.js โ Deno**: Runtime environment
12
133## Development Notes
134
135- Database is automatically initialized on startup
136- SQLite table is created if it doesn't exist
137- All responses follow a consistent JSON structure