🛍️ Fullstack Ecommerce (Hono + React + SQLite)

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.

Open the shop

Stack

  • Backend: Hono REST API (api/routes.ts), cookie-based session cart
  • Database: Val Town SQLite (db/schema.ts) — products, cart, orders, order_items
  • Frontend: Client-side React SPA (frontend/), Twind for styling

Architecture

Rendering mermaid diagram...

API routes

MethodPathDescription
GET/api/productsList all products
GET/api/products/:idGet one product
GET/api/cartGet current session's cart
POST/api/cartAdd item to cart { productId, quantity }
PATCH/api/cart/:productIdUpdate quantity { quantity } (0 removes)
DELETE/api/cart/:productIdRemove item from cart
POST/api/checkoutPlace order { name, email }, clears cart
GET/api/orders/:idGet an order + its line items

File structure

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

Next steps

  • Add product images/categories
  • Add an admin view to manage inventory
  • Add auth so orders are tied to real user accounts instead of a cart cookie