feat(adminui): embed the admin SPA and serve it next to the API

- Add internal/adminui with a SPA handler: index fallback for client routes, immutable caching for hashed assets, 404 for missing assets, security headers
- Answer 503 with a hint when the UI has not been built, so go build always works
- Mount the UI at / and the API at /api/ on the same listener, no CORS needed
- Scaffold admin/ with Vite, React, TypeScript, Tailwind v4, shadcn/ui and Vitest
This commit is contained in:
tgiachi 2026-11-09 15:29:12 +01:00
commit 5a0dd7f6d6

8
admin/scripts/clean.mjs Normal file
View file

@ -0,0 +1,8 @@
// Empties the Go embed directory but keeps .gitkeep, so `go build` always works.
import { readdirSync, rmSync } from 'node:fs'
import { join } from 'node:path'
const dist = new URL('../../internal/adminui/dist', import.meta.url).pathname
for (const name of readdirSync(dist)) {
if (name !== '.gitkeep') rmSync(join(dist, name), { recursive: true, force: true })
}