mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
One path: /v1/*. We do not use /api/ — that's Casdoor's path. The
BASE_API_PREFIX env knob is gone; the prefix is hard-coded in
apis/base.go and apis/serve.go banner.
Server-side mounts:
- apis: bindHealthApi, bindCollectionApi, bindRecordCrudApi, etc. all
attach under r.Group("/v1") (was r.Group(BASE_API_PREFIX, default /api))
- platform plugin: /api/platform/* -> /v1/platform/* (including auth and
org sub-groups)
- kms plugin: /api/kms/* -> /v1/kms/*
- functions plugin: /api/functions/* -> /v1/functions/*
- cloudsql plugin: /api/cloud-sql/*, /api/meta/* -> /v1/*
- superuser OIDC: /_/api/oidc/config -> /_/v1/oidc/config
- core settings: default RateLimitRule labels /api/batch, /api/ ->
/v1/batch, /v1/
- apis/batch.go: ValidBatchActions regexes match /v1/collections/*;
internal rewrite targets /v1/collections/* (was /v1/base/collections/*,
a stale artifact)
Clients:
- sdk/base-js (BaseClient.collections, files, realtime, CRDT WS,
signIn/refresh/health) targets /v1/*
- sdk/base-react (use-crdt WS path) targets /v1/crdt
- ui-react admin (lib/api.ts, settings.application copy) targets /v1/*
- cmd/cli (NewClient.APIPrefix) defaults to /v1; client_test.go and
cmd/cli_test.go stubServer use /v1/*
- cmd/typegen calls /v1/collections
Upstream paths untouched: Casdoor IAM (/api/login, /api/userinfo,
/api/signup, /api/send-verification-code, /api/get-user), KMS Infisical
(/api/v1/auth/universal-auth/login, /api/v2/workspace/environments),
Kubernetes tasks (/api/v1/namespaces/...), IPFS (/api/v0/...), Gitea/
GitLab/Discord/Strava/Patreon/Box/Wakatime upstream APIs. Those are
their contracts, not ours.
Tests: all 437 prior /api/ test URLs across apis/*_test.go and
plugins/platform/auth_proxy_test.go updated to /v1/. Build + go vet
clean. ./apis ./core ./plugins/platform ./plugins/jsvm ./forms all
green. Pre-existing red probes (network/TestRedProbe_*,
migratecmd/TestAutomigrateCollection*) unchanged.
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.