karuraccdev_test/README.md
2026-04-16 15:08:29 +03:00

92 lines
2.4 KiB
Markdown

# 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.