Public
Fullstack ecommerce: Hono API + React + SQLite
ecommercehonoreactsqlite
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
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.
- 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
Rendering 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
- 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