mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
Rename / namespace: - Finish github.com/pocketbase/* → github.com/hanzoai/base (+ /dbx) sweep across all Go sources; restore the renamed root launcher (Base, base.go). - Drop the upstream-only surfaces ours doesn't ship (admin ui/, the password/OTP/oauth2/impersonate auth files, extensions) re-added by the upstream merge. - Decomplect the on-disk layout to one base_/ namespace: data/, migrations/, hooks/, types.d.ts are siblings under base_/ (default data dir base_/data). Drop the hz_ prefix everywhere; collapse migratecmd's identical JS/Go branches to one path. - Remove the accidentally-committed hz_data/ dev dir (db + iam.key) and gitignore the runtime namespace dirs. Deps / build: - kmsclient now imported from the light github.com/hanzoai/kms/sdk/go module (the root kms module zip exceeds Go's download limit); cloud/pkg/base Mount removed (lives in the fused daemon). - replicate v0.4.0 → v0.8.0; metric.Counter.Get() (no prometheus dto); network/metrics.go import fix; auth gitlab/github tidy. Tests / behavior: - Wire registerNotifyWatcherHooks; debounce notify files past the kqueue rescan window so cross-instance settings/collections reload fires. - migratecmd: exclude createdAt/updatedAt (not created/updated); regenerate Go+JS automigration goldens from canonical output. - Convert the two stale archive red-probes to assert the landed defenses (backlog cap bounds memory; forged-segment signature is rejected). IAM-native (Base = pure IAM client): - Rip the ~1k-line home-grown embedded IAM (iam_embedded*.go) and the iam-user CLI. Base no longer reinvents identity as _iam_users/_superusers rows. IAM_ENDPOINT (hanzo.id, or an in-process iam.Embed in the fused daemon) is required; Base validates IAM JWTs via JWKS only — superuser is the IAM admin claim, resolved to an ephemeral unpersisted record. - Extract the IDV reverse-proxy (/v1/idv/*) into idv_proxy.go — it was mis-colocated in the embedded onboarding file and is independent of IAM. - Bind the SQL console (/v1/sql) and test it through real IAM JWTs against a JWKS stub (no hardcoded record tokens, no persisted rows).
Base Admin UI (embedded)
This package embeds the Base admin SPA via //go:embed all:dist. The
binary serves dist/ at /_/ when BASE_ENABLE_ADMIN_UI=1.
The SPA itself is not built here. Source lives in
~/work/hanzo/gui/apps/admin-base (Hanzo GUI v7 + Vite). Build there
and sync the result with the script in this repo.
Build & sync
# 1. Build the SPA in the gui workspace
cd ../gui/apps/admin-base
bun run build
# 2. Sync into ./dist (this directory) for go:embed
cd -
scripts/sync-admin-ui.sh
The sync writes a .sync-stamp so binaries can be traced back to the
source commit.
Stack
| Layer | Stack |
|---|---|
| Framework | React 19 |
| Bundler | Vite 8 |
| Router | react-router-dom 7 |
| Data | useFetch from @hanzogui/admin/data |
| UI kit | Hanzo GUI v7 (hanzogui umbrella + @hanzogui/admin chrome) |
| Auth | Base _superusers token in localStorage; useAuth hook |
Pages shipped
| Page | Path | File |
|---|---|---|
| Login | /_/login |
gui/apps/admin-base/src/pages/Login.tsx |
| Collections | /_/collections |
Collections.tsx |
| Records | /_/collections/:id/records |
Records.tsx |
| Logs | /_/logs |
Logs.tsx |
| Settings · SMTP | /_/settings/smtp |
SettingsSmtp.tsx |
| Settings · Rate limits | /_/settings/rate-limits |
SettingsRateLimits.tsx |
| Settings · Tokens | /_/settings/tokens |
SettingsTokens.tsx |
Auth, OAuth2, Backups, Mail templates, Superusers, Export/Import, SQL runner, and Realtime inspector are not yet ported.
Why this layout
- The SPA shares the
@hanzogui/adminchrome withapps/admin-tasks(and any other admin surface inapps/admin-*). One way to build admin UI across tasks/kms/commerce/console/base. dist/is committed-tracked at sync time sogo buildis hermetic — CI doesn't need bun installed to compile the binary.- The static extractor must run; without resolved theme CSS the runtime
getThemeProxied()throws "Missing theme" and renders blank.