mirror of
https://github.com/techforces-ai/Cial.git
synced 2026-05-15 20:14:11 +00:00
Local mode now boots a real control plane:
docker compose up --build
→ postgres:16 on :5432
→ app-api on :3100
Browser → http://localhost:3100/admin
→ first visit lands on /admin/signup (owner-only),
subsequent on /admin/login.
Owner signs in → /admin shows an empty tenant list.
L2 wires the "create tenant" form on top of this.
Pieces:
- docker-compose.yml: postgres + app-api with healthcheck-gated
depends_on, named volume for PG data, .env-driven secret.
- cial-app/api/src/db: drizzle schema (user/session/account/
verification + tenant + tenant_state enum), lazy pool/db Proxy
(so Turbopack page-data collection doesn't trip on missing env),
inlined idempotent init SQL.
- src/instrumentation.ts: runs migrate() before first request.
Skips silently when DATABASE_URL is unset so `pnpm smoke` still
boots the API without a Postgres.
- src/lib/auth.ts: Better-Auth wired with drizzle adapter, email+
password (no email verification in dev), and a `databaseHooks.
user.create.before` that refuses any sign-up after the first user.
- /api/auth/[...all] mounts toNextJsHandler(auth).
- /admin/signup, /admin/login, /admin pages with simple inline
forms calling the better-auth React client.
- next builds switched to `next build --turbopack`: webpack-based
build hits a Next 16 + React 19 prerender bug on the auto-
generated /_global-error page. Turbopack avoids it cleanly.
- Bumped next 16.0.1 → 16.2.4, react 19.0.0 → 19.2.5.
- cial-app/docker/Dockerfile: NODE_ENV=development in the builder
stage so devDeps (typescript, @types) install for the build.
Verify (docker required):
cp .env.example .env # optionally edit BETTER_AUTH_SECRET
docker compose up --build
open http://localhost:3100/admin
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 lines
258 B
Text
5 lines
258 B
Text
# Copy to .env for `docker compose up`. Only BETTER_AUTH_SECRET really
|
|
# needs overriding for dev — Postgres credentials are baked into compose.
|
|
#
|
|
# Generate a real secret with: openssl rand -hex 32
|
|
BETTER_AUTH_SECRET=dev-only-not-for-prod-please-replace
|