A fullstack ecommerce demo on Val Town. Val Town runs Deno (TypeScript), not Python, so this uses Hono — a lightweight web framework with the same route/middleware feel as FastAPI — instead of FastAPI itself.
api/routes.ts), cookie-based session cartdb/schema.ts) — products, cart, orders, order_itemsfrontend/), Twind for stylingRendering mermaid diagram...
| Method | Path | Description |
|---|---|---|
| GET | /api/products | List all products |
| GET | /api/products/:id | Get one product |
| GET | /api/cart | Get current session's cart |
| POST | /api/cart | Add item to cart { productId, quantity } |
| PATCH | /api/cart/:productId | Update quantity { quantity } (0 removes) |
| DELETE | /api/cart/:productId | Remove item from cart |
| POST | /api/checkout | Place order { name, email }, clears cart |
| GET | /api/orders/:id | Get an order + its line items |
index.ts ← Hono entrypoint (serves frontend + /api)
api/routes.ts ← All REST API routes
db/schema.ts ← SQLite schema + seed data
frontend/
root.tsx ← HTML shell
index.tsx ← React entrypoint
lib/api.ts ← Typed fetch client for the API
components/
App.tsx ← Root layout / view router
ProductList.tsx ← Product grid
CartPanel.tsx ← Cart sidebar
Checkout.tsx ← Checkout form
OrderConfirmation.tsx ← Post-order confirmation