commit d4678abafeefb0c1cc740f4c30f41e7fe4e8c2b8 Author: David Kiania Date: Thu Apr 16 15:08:29 2026 +0300 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..14b3c41 --- /dev/null +++ b/README.md @@ -0,0 +1,92 @@ +# fireside-test-app + +End-to-end deployment smoke test for the self-hosted stack: + +``` +Forgejo → Dokploy (Docker Compose) → Supabase (Auth + DB) +``` + +## What this tests + +| Layer | What's exercised | +|---|---| +| **Forgejo** | Source repo, webhook trigger to Dokploy | +| **Dokploy** | Multi-stage Docker build, Compose deploy, healthcheck | +| **Supabase Auth** | Email/password signup, login, SSR session via cookies | +| **Supabase DB** | `notes` table, Row Level Security, per-user reads/writes | +| **Next.js 15** | Server Components, middleware, edge health route | + +## Quick start + +### 1. Run the DB migration + +In your Supabase SQL editor, run the contents of: + +``` +supabase/migrations/001_notes.sql +``` + +This creates the `notes` table and RLS policies. + +### 2. Local dev + +```bash +cp .env.example .env.local +# fill in your Supabase URL and anon key + +npm install +npm run dev +``` + +Open http://localhost:3000 — it redirects to `/auth/login`. + +### 3. Deploy via Dokploy + +1. Push this repo to your Forgejo instance +2. In Dokploy, create a new application → **Docker Compose** +3. Set source to your Forgejo repo +4. Add environment variables: + ``` + NEXT_PUBLIC_SUPABASE_URL=https://your-supabase.yourdomain.com + NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key + ``` +5. Set the compose file to `docker-compose.yml` +6. Deploy + +### 4. Configure Supabase redirect URLs + +In your Supabase dashboard → **Authentication → URL Configuration**: + +- **Site URL**: `https://your-app.yourdomain.com` +- **Redirect URLs**: add `https://your-app.yourdomain.com/**` + +## Project structure + +``` +app/ + auth/login/ ← public login + auth/signup/ ← public signup + dashboard/ ← protected, SSR, reads user + notes + api/health/ ← GET /api/health — Docker healthcheck +components/ + AuthForm.tsx ← client, email/password auth + NotesList.tsx ← client, create/delete notes + SignOutButton.tsx +lib/supabase/ + server.ts ← SSR client (cookies) + client.ts ← browser client +middleware.ts ← route guard + session refresh +supabase/ + migrations/ ← SQL to run in Supabase +Dockerfile ← multi-stage standalone build +docker-compose.yml ← Dokploy entry point +``` + +## Healthcheck + +``` +GET /api/health +→ { "status": "ok", "app": "fireside-test-app", "ts": "..." } +``` + +Dokploy and Docker will use this to verify the container is alive.