1
0
Fork 0
Commit Graph

7 Commits

Author SHA1 Message Date
Jonny 18bea21ca8 feat: Akteur am Service-Client und Audit-Eintraege fuer Nutzeraktionen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 08:05:25 +02:00
Jonny be021f803a feat: Middleware leitet Nutzer mit Passwortpflicht auf /passwort-aendern um
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-05 11:25:01 +02:00
Jonny 8db31c72a8 feat: add Supabase admin client and service-role-key wiring 2026-07-14 21:56:15 +02:00
Jonny d812db7da3 fix: fall back to NEXT_PUBLIC_SUPABASE_URL when SUPABASE_INTERNAL_URL is unset
Adds graceful degradation for environments that don't have SUPABASE_INTERNAL_URL
configured. Uses nullish coalescing to fall back to NEXT_PUBLIC_SUPABASE_URL if
the new internal URL variable is unset, maintaining backward compatibility while
preserving the Docker-specific optimization.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-05 00:29:35 +02:00
Jonny 2f508ea5dd feat: containerize the Next.js app and wire it into docker-compose
Adds web/Dockerfile (multi-stage node:22-alpine build, standalone output)
and web/.dockerignore, and wires a `web` service into docker-compose.yaml
so the whole stack (self-hosted Supabase + Next.js) starts with a single
`docker compose up -d`.

Networking fix: Next.js inlines NEXT_PUBLIC_* env vars at build time into
every compiled bundle, including server-side ones (Server Actions, Server
Components, Middleware) - not just the browser bundle. Since
NEXT_PUBLIC_SUPABASE_URL must point at the externally-reachable
http://localhost:8000 for the browser, the server-side Supabase clients in
lib/supabase/server.ts and lib/supabase/middleware.ts got that same literal
baked in - which resolves to the web container itself (not kong) once
running in Docker, causing ECONNREFUSED on any server-side Supabase call
(most visibly signInWithPassword in the login server action).

Fix: introduce SUPABASE_INTERNAL_URL, a server-only env var without the
NEXT_PUBLIC_ prefix, so it's read at actual runtime rather than inlined at
build time. It points at http://kong:8000 in docker-compose.yaml (same
pattern already used by the studio service's internal SUPABASE_URL) and at
http://localhost:8000 in web/.env.local(.example) for non-Docker local dev,
where there's no container networking boundary. lib/supabase/client.ts
(browser-only) is untouched and keeps reading NEXT_PUBLIC_SUPABASE_URL.

Considered extra_hosts: ["localhost:host-gateway"] instead, but rejected it:
overriding what the literal string "localhost" resolves to inside a
container is unreliable (glibc's resolver typically still prioritizes the
container's own loopback), and is the kind of workaround that looks fixed
in a quick check and quietly breaks later.

Verified end-to-end against the running container via curl (unauth redirect,
real signInWithPassword through the login server action, authenticated
dashboard content, logout) with zero ECONNREFUSED in `docker compose logs
web` afterward, plus a local `npm run dev` smoke test to confirm non-Docker
development still works unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-05 00:25:01 +02:00
Jonny b397cb326b feat: add auth middleware with session refresh and redirects 2026-07-04 15:57:41 +02:00
Jonny 7254923885 feat: add Supabase browser and server client helpers
- Add browser client helper (createClient) for client-side components
- Add server client helper (createClient) for server components and route handlers
- Add test for browser client functionality
- Update .gitignore to allow .env.local.example while ignoring .env*.local
- Install @supabase/supabase-js and @supabase/ssr packages

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-04 15:32:05 +02:00