Documentation
¶
Overview ¶
Command admin-demo is a runnable demo server that mounts the fabriq adminapi extension against a live Postgres, so the fabriq-admin SPA can be exercised end-to-end against a real backend.
It wires:
- a demo dynamic entity "product" (registry.DynamicSchema aggregate) plus the adminapi plugin-remote schema (adminapi.PluginRemoteSpec);
- fabriq.Open (runs migrations) + EnsureDynamic for the dynamic tables;
- the fabriq forge extension (forgeext) and the adminapi extension, with auth ON by default (auto-provisioned KeyStore + admin/admin login; set ADMIN_DEMO_AUTH=0 to opt out to a keyless API with a tenant middleware that resolves the tenant from the X-Tenant-ID header);
- an app-wide CORS middleware that allows the SPA origin and answers preflight OPTIONS with 204;
- idempotent startup seeding of ~60 product rows per demo tenant so the list endpoint exercises pagination (default page size 50).
Environment:
FABRIQ_POSTGRES_DSN Postgres DSN
(default postgres://fabriq:fabriq@localhost:5433/fabriq?sslmode=disable)
ADMIN_DEMO_ADDR listen address (default ":8080")
Run:
go run ./cmd/admin-demo
Then:
curl -s localhost:8080/admin/meta -H 'X-Tenant-ID: acme-corp' curl -s 'localhost:8080/admin/entities?type=product&limit=5' -H 'X-Tenant-ID: acme-corp'
Click to show internal directories.
Click to hide internal directories.