Initial commit: Bun · Hono · React SPA · Postgres/Drizzle template

The starting point for an app with a React frontend. Same server, env,
database and API skeleton as template-htmx — the two differ only in what is
served at / — with a React 19 SPA, Tailwind v4 and shadcn/ui on top.

Carried from a working project rather than designed in the abstract, and
carrying the lessons that cost it time:

- The dev script states NODE_ENV=development rather than inheriting it. React
  resolves its runtime against NODE_ENV: Bun emits jsxDEV() in development
  and React's production jsx-dev-runtime defines jsxDEV as void 0. Inherit
  production while transforming for development and the app dies at first
  paint. Verified: the dev bundle resolves the development runtime and
  contains no void-0 stub.
- Asset URLs in components are relative and <base href="/"> is in the HTML,
  so a path-prefix proxy can rewrite one attribute and every asset follows. A
  test enforces it.
- Routing is in the hash, because the app may be mounted under a prefix it
  only learns at runtime and a hash means the same thing at either mount.
- index.html holds __PUBLIC_URL__ and gen-index.ts substitutes it, because
  Bun's HTML bundler fails the build on a root-relative favicon href.
- APP_ENV failing closed, env files before the ambient environment, the
  database enforced by name, one Postgres client per process — as in the
  htmx template.

The database has no tables. The App is a shell with one tab and no features,
named as a placeholder. Renaming `app` is the first step and the README lists
every place it appears.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-18 02:02:52 +00:00
co-authored by Claude Opus 5
commit c08dab4243
47 changed files with 2424 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
{
"name": "app",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"gen:index": "bun run ./scripts/gen-index.ts",
"predev": "bun run ./scripts/gen-index.ts",
"dev": "NODE_ENV=development APP_ENV=development bun --hot src/server.ts",
"prestart": "bun run ./scripts/gen-index.ts",
"start": "NODE_ENV=production APP_ENV=production bun src/server.ts",
"prebuild": "bun run ./scripts/gen-index.ts",
"build": "bun run build.ts",
"db:gen": "cd src/databases/app_db && APP_ENV=${APP_ENV:-development} bun run generate",
"db:push": "cd src/databases/app_db && APP_ENV=${APP_ENV:-development} bun run push",
"db:studio": "cd src/databases/app_db && APP_ENV=${APP_ENV:-development} bun run studio"
},
"dependencies": {
"drizzle-orm": "^0.45.2",
"hono": "^4.13.2",
"postgres": "^3.4.9",
"react": "^19",
"react-dom": "^19",
"@radix-ui/react-label": "^2.1.7",
"@radix-ui/react-select": "^2.2.6",
"@radix-ui/react-slot": "^1.2.3",
"bun-plugin-tailwind": "^0.1.2",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^1",
"tailwind-merge": "^3.3.1",
"tw-animate-css": "^1.4.0"
},
"devDependencies": {
"@types/bun": "latest",
"drizzle-kit": "^0.31.10",
"tailwindcss": "^4.1.11",
"@types/react": "^19",
"@types/react-dom": "^19"
}
}