Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2aab52947 |
No files matched your search
@@ -1,33 +1,186 @@
|
||||
# bdinvite
|
||||
|
||||
Interactive digital birthday invitation with RSVP.
|
||||
Interactive digital birthday invitation with real-time RSVP management, dynamic OpenStreetMap location previews, and an administrative dashboard.
|
||||
|
||||
## Overview
|
||||
|
||||
A mobile-first invitation app with animated golden bokeh particles, an RSVP form with semantic state feedback, a live countdown timer, and an admin dashboard for managing responses and invitation content.
|
||||
**bdinvite** is a production self-hosted web application delivering two coordinated experiences:
|
||||
|
||||
- **Guest**: `demos.roadtotech.me/birthday/`
|
||||
- **Admin**: `demos.roadtotech.me/birthday/admin` (Authelia-protected)
|
||||
1. **Guest Experience (`/birthday/`)**:
|
||||
- Mobile-first vertical composition mimicking a physical luxury invitation card.
|
||||
- Ambient golden bokeh particle canvas (Canvas 2D) with accessibility support (`prefers-reduced-motion`).
|
||||
- Phone-normalized RSVP submission flow with explicit semantic state feedback (`SUCCESS`, `DUPLICATE`, `ERROR`).
|
||||
- Timezone-aware countdown timer (`NOS VEMOS EN DD:HH:MM:SS`).
|
||||
- Dynamic OpenStreetMap venue preview tile crop with direct Google Maps navigation links.
|
||||
|
||||
## Stack
|
||||
2. **Admin Experience (`/birthday/admin`)**:
|
||||
- Reverse-proxy authentication boundary via Authelia ForwardAuth (`Remote-User`).
|
||||
- Live RSVP roster with search filtering, inline editing, and permanent deletion.
|
||||
- Event-timezone formatted registration timestamps.
|
||||
- One-click CSV export (`rsvps.csv`).
|
||||
- Live configuration editor with hierarchical text preview and on-demand map generation.
|
||||
|
||||
| Layer | Technology |
|
||||
|---|---|
|
||||
| Frontend | React, Vite, TypeScript, Canvas 2D, CSS Modules |
|
||||
| Backend | FastAPI, SQLAlchemy, Pydantic, SQLite (WAL) |
|
||||
| Infrastructure | Docker (multi-stage), Traefik, Authelia SSO |
|
||||
- **Guest URL**: `https://demos.roadtotech.me/birthday/`
|
||||
- **Admin URL**: `https://demos.roadtotech.me/birthday/admin` (Authelia SSO protected)
|
||||
|
||||
## Documentation
|
||||
---
|
||||
|
||||
- [Frontend Specification](specs/front.md)
|
||||
- [Backend Specification](specs/backend.md)
|
||||
- [Infrastructure Specification](specs/infra.md)
|
||||
- [Roadmap](ROADMAP.md)
|
||||
## Architecture & System Design
|
||||
|
||||
## Experiments
|
||||
The application runs as a **single unified container**:
|
||||
- **Frontend**: React 18 SPA built with Vite, TypeScript, and CSS Modules.
|
||||
- **Backend**: FastAPI (Python 3.11+) powered by Uvicorn, SQLAlchemy 2.0, and Pydantic v2.
|
||||
- **Persistence**: SQLite with Write-Ahead Logging (`WAL`) mode mounted on `./data/bdinvite.db`.
|
||||
- **Static Assets & Routing**: FastAPI serves API routes under `/birthday/api/`, static assets under `/birthday/assets/`, and fallback SPA catch-all routing for React Router.
|
||||
- **Security Boundary**: Traefik intercepts `/birthday/admin` and `/birthday/api/admin` with Authelia ForwardAuth middleware, injecting `Remote-User`. Every backend admin endpoint independently asserts this header.
|
||||
|
||||
- [SSO Graphify Benchmark](experiments/bdinvite-sso-graphify-benchmark/README.md) — Retrospective and archived evidence from an 8-checkpoint agent implementation benchmark.
|
||||
```text
|
||||
HTTPS Requests (*.roadtotech.me)
|
||||
│
|
||||
▼
|
||||
┌───────────────────────┐
|
||||
│ Traefik v3.6 │
|
||||
└───────────┬───────────┘
|
||||
│
|
||||
┌───────────────────────┴───────────────────────┐
|
||||
│ │
|
||||
Public Routes Admin Routes
|
||||
(/birthday, /birthday/api/*) (/birthday/admin, /birthday/api/admin/*)
|
||||
│ │
|
||||
│ ┌───────────▼───────────┐
|
||||
│ │ Authelia ForwardAuth│
|
||||
│ └───────────┬───────────┘
|
||||
│ │ (Injects Remote-User)
|
||||
└───────────────────────┬───────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌───────────────────────────┐
|
||||
│ bdinvite Container │
|
||||
│ │
|
||||
│ ┌─────────────────────┐ │
|
||||
│ │ FastAPI + Uvicorn │ │
|
||||
│ │ (Port 8000) │ │
|
||||
│ └──────────┬──────────┘ │
|
||||
│ │ │
|
||||
│ ┌──────┴──────┐ │
|
||||
│ ▼ ▼ │
|
||||
│ React SPA SQLite DB │
|
||||
│ (static) (WAL Mode) │
|
||||
└───────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## API Summary
|
||||
|
||||
All endpoints are prefixed with `/birthday/api/`.
|
||||
|
||||
### Public Endpoints
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/birthday/api/config` | Retrieves the active invitation configuration |
|
||||
| `POST` | `/birthday/api/rsvp` | Submits an RSVP (validates 10-digit Colombian phone format) |
|
||||
| `GET` | `/birthday/api/map-preview.png` | Serves stitched OpenStreetMap tile preview image |
|
||||
|
||||
### Admin Endpoints (Requires `Remote-User`)
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/birthday/api/admin/rsvps` | Lists confirmed guests (supports `?search=<term>`) |
|
||||
| `PATCH` | `/birthday/api/admin/rsvps/{id}` | Updates name, phone, or email for an RSVP record |
|
||||
| `DELETE` | `/birthday/api/admin/rsvps/{id}` | Permanently deletes an RSVP record (`204 No Content`) |
|
||||
| `GET` | `/birthday/api/admin/export` | Downloads the guest roster as a formatted CSV |
|
||||
| `GET` | `/birthday/api/admin/config` | Fetches complete editable configuration |
|
||||
| `PUT` | `/birthday/api/admin/config` | Updates singleton configuration and triggers map preview update |
|
||||
| `POST` | `/birthday/api/admin/map-preview/generate` | Generates or regenerates OSM preview tiles from Google Maps URL |
|
||||
|
||||
---
|
||||
|
||||
## Development & Toolchain
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- [Nix](https://nixos.org/) with `direnv` (recommended), or:
|
||||
- Node.js 20+
|
||||
- Python 3.11+
|
||||
- [uv](https://docs.astral.sh/uv/)
|
||||
- [Biome](https://biomejs.dev/)
|
||||
|
||||
If using `direnv`, simply allow the environment in the project root:
|
||||
```bash
|
||||
direnv allow
|
||||
```
|
||||
Or enter the Nix development shell:
|
||||
```bash
|
||||
nix-shell
|
||||
```
|
||||
|
||||
### Backend Setup
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
|
||||
# Install dependencies and create virtual environment
|
||||
uv sync
|
||||
|
||||
# Run development server with live reload
|
||||
uv run uvicorn app.main:app --reload --port 8000
|
||||
|
||||
# Run unit and integration tests
|
||||
uv run pytest
|
||||
|
||||
# Run strict type checker
|
||||
uv run pyright
|
||||
|
||||
# Run linter
|
||||
uv run ruff check
|
||||
```
|
||||
|
||||
### Frontend Setup
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
|
||||
# Install dependencies
|
||||
npm install
|
||||
|
||||
# Start Vite dev server (runs on http://localhost:5173/birthday/)
|
||||
npm run dev
|
||||
|
||||
# Run TypeScript type check and production build
|
||||
npm run build
|
||||
|
||||
# Run Biome linter and formatter checks
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Running with Docker Locally
|
||||
|
||||
Build and run the multi-stage production container locally:
|
||||
```bash
|
||||
docker compose build
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Documentation & References
|
||||
|
||||
- [Frontend Specification](specs/front.md) — Visual principles, particle system, and component behaviors
|
||||
- [Backend Specification](specs/backend.md) — Data schemas, phone normalization rules, and API contracts
|
||||
- [Infrastructure Specification](specs/infra.md) — NixOS homelab host, Traefik labels, and deployment architecture
|
||||
- [Project Roadmap](ROADMAP.md) — Phased progress, completed milestones, and future enhancements
|
||||
- [SSO Graphify Benchmark](experiments/bdinvite-sso-graphify-benchmark/README.md) — Retrospective and archived evidence from an 8-checkpoint agent benchmark
|
||||
|
||||
---
|
||||
|
||||
## Staged Features
|
||||
|
||||
- **Phase 6 OIDC Authentication**: An application-level OpenID Connect authorization code flow (with signed session cookies and headless browser Playwright testing) has been implemented and verified in branch `feat/sso-auth` ([PR #2](https://gitea.roadtotech.me/kiskaadee/bdinvite/pulls/2)). Deployment is staged pending the homelab Authelia identity provider rework.
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
[Unlicense](UNLICENSE) — public domain.
|
||||
[Unlicense](UNLICENSE) — Public Domain.
|
||||
+21
-5
@@ -21,7 +21,9 @@
|
||||
- [x] Admin endpoints with `Remote-User` guard
|
||||
- [x] CSV export endpoint
|
||||
- [x] SPA catch-all route
|
||||
- [x] Backend tests (15 unit/integration tests passing)
|
||||
- [x] Backend tests (25 unit/integration tests passing)
|
||||
- [x] OpenStreetMap preview tile generator and geocoding fallback (`app/services/map_preview.py`)
|
||||
- [x] Admin RSVP update (`PATCH`) and delete (`DELETE`) endpoints
|
||||
|
||||
## Phase 2 — Frontend Scaffolding
|
||||
|
||||
@@ -42,7 +44,7 @@
|
||||
- [x] Submission state machine (`SUBMITTING` → `SUCCESS` | `DUPLICATE` | `ERROR`)
|
||||
- [x] Confirmation section: personalized message
|
||||
- [x] Countdown timer (timezone-aware, `NOS VEMOS EN DD:HH:MM:SS`)
|
||||
- [x] Map preview (circular static image, link to `mapUrl`)
|
||||
- [x] Dynamic map preview (circular OpenStreetMap stitched preview, link to `mapUrl`)
|
||||
- [x] Venue info (compact name + address)
|
||||
- [x] `sessionStorage` post-RSVP state preservation
|
||||
- [x] Accessibility (semantic HTML, keyboard nav, aria-live, focus states)
|
||||
@@ -54,11 +56,13 @@
|
||||
- [x] Admin layout shell (header, navigation)
|
||||
- [x] RSVP table with total count
|
||||
- [x] Search/filter RSVPs
|
||||
- [x] Inline RSVP editing and permanent deletion with modal confirmation
|
||||
- [x] Display of registration timestamps in configured event timezone
|
||||
- [x] CSV export download button
|
||||
- [x] Config editor form (flat fields, Pydantic-validated)
|
||||
- [x] Map preview generator trigger button and status feedback
|
||||
- [x] Text preview of invitation content
|
||||
|
||||
|
||||
## Phase 5 — Infrastructure & Deployment
|
||||
|
||||
- [x] Dockerfile (multi-stage build)
|
||||
@@ -70,10 +74,22 @@
|
||||
- [ ] Post-deployment verification
|
||||
- [ ] Authelia admin route verification
|
||||
|
||||
## Phase 6 — Application-Level OIDC Authentication (Staged)
|
||||
|
||||
Implemented and verified in branch `feat/sso-auth` ([PR #2](https://gitea.roadtotech.me/kiskaadee/bdinvite/pulls/2)), pending Homelab Authelia OIDC provider rework:
|
||||
|
||||
- [x] Decouple admin auth from reverse-proxy `Remote-User` header injection
|
||||
- [x] OpenID Connect Authorization Code flow (`/birthday/api/auth/login`, `/callback`, `/logout`, `/me`)
|
||||
- [x] Thread-safe in-memory `SessionStore` with expiration and cleanup
|
||||
- [x] Cryptographically signed session cookie (HMAC-SHA256, `HttpOnly`, `SameSite=Lax`)
|
||||
- [x] Frontend session expiration handling (lock card + re-login modal)
|
||||
- [x] Headless browser E2E test with mock OIDC IdP (110 passing assertions)
|
||||
- [ ] Configure Authelia OIDC client in `~/Homelab/Core/config/authelia/configuration.yml`
|
||||
- [ ] Merge PR #2 and deploy to production
|
||||
|
||||
## Future
|
||||
|
||||
- [ ] Font selection (visual comparison of candidates)
|
||||
- [x] Application-owned map preview asset (replace URL with static file)
|
||||
- [ ] Miniature rendered invitation preview in admin config editor
|
||||
- [ ] Enhanced admin features (edit/delete RSVP, attendance status, guest count)
|
||||
- [ ] Guest count toggle / attendance status indicator
|
||||
- [ ] CSV import
|
||||
+59
-5
@@ -43,6 +43,8 @@ flowchart LR
|
||||
```
|
||||
backend/
|
||||
├── pyproject.toml
|
||||
├── uv.lock
|
||||
├── pyrightconfig.json
|
||||
├── app/
|
||||
│ ├── __init__.py
|
||||
│ ├── main.py # FastAPI app, lifespan, static file mount, SPA catch-all
|
||||
@@ -54,15 +56,19 @@ backend/
|
||||
│ │ ├── __init__.py
|
||||
│ │ ├── rsvp.py # POST /birthday/api/rsvp
|
||||
│ │ ├── config.py # GET /birthday/api/config
|
||||
│ │ └── admin.py # Admin endpoints
|
||||
│ │ └── admin.py # Admin endpoints (RSVP CRUD, config, map preview)
|
||||
│ └── services/
|
||||
│ ├── __init__.py
|
||||
│ ├── rsvp.py # RSVP business logic + phone normalization
|
||||
│ └── config.py # Config CRUD + seed defaults
|
||||
│ ├── config.py # Config CRUD + seed defaults
|
||||
│ └── map_preview.py # Google Maps URL resolution & OSM preview stitching
|
||||
└── tests/
|
||||
├── __init__.py
|
||||
├── test_rsvp.py
|
||||
└── test_config.py
|
||||
├── conftest.py # Shared fixtures, test database, mock client
|
||||
├── test_rsvp.py # Public RSVP endpoint & validation tests
|
||||
├── test_config.py # Config endpoints & timezone tests
|
||||
├── test_admin.py # Admin auth, RSVP update/delete, and CSV export
|
||||
└── test_map_preview.py # Coordinate resolution & tile generation
|
||||
```
|
||||
|
||||
---
|
||||
@@ -135,6 +141,8 @@ flowchart LR
|
||||
end
|
||||
subgraph Admin["Admin (Remote-User required)"]
|
||||
C["GET /birthday/api/admin/rsvps"]
|
||||
C1["PATCH /birthday/api/admin/rsvps/{id}"]
|
||||
C2["DELETE /birthday/api/admin/rsvps/{id}"]
|
||||
D["GET /birthday/api/admin/export"]
|
||||
E["GET /birthday/api/admin/config"]
|
||||
F["PUT /birthday/api/admin/config"]
|
||||
@@ -233,6 +241,49 @@ List all RSVPs.
|
||||
}
|
||||
```
|
||||
|
||||
#### `PATCH /birthday/api/admin/rsvps/{rsvp_id}`
|
||||
|
||||
Update details for an existing RSVP record (name, phone, or email).
|
||||
|
||||
- **Auth:** `Remote-User` header required
|
||||
- **Path parameter:** `rsvp_id: int`
|
||||
- **Request body (`RSVPUpdate`):**
|
||||
```json
|
||||
{
|
||||
"name": "Ana María García",
|
||||
"phone": "3009876543",
|
||||
"email": "anamaria@example.com"
|
||||
}
|
||||
```
|
||||
All fields are optional in the payload, but non-empty strings are required if present.
|
||||
- **Validation:** Phone is normalized using the same 10-digit Colombian format rule (§7).
|
||||
- **Responses:**
|
||||
- `200` — Returns updated `RSVPAdminItem`:
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Ana María García",
|
||||
"phone": "3009876543",
|
||||
"email": "anamaria@example.com",
|
||||
"created_at": "2026-09-30T12:00:00Z"
|
||||
}
|
||||
```
|
||||
- `400` — Validation error on supplied fields.
|
||||
- `404` — `{"detail": "No se encontró el registro con ID {rsvp_id}"}` if not found.
|
||||
- `409` — `{"detail": "El número de teléfono ya está registrado para otro asistente."}` if the new phone conflicts with an existing RSVP.
|
||||
- `401` — Unauthenticated (`Remote-User` missing).
|
||||
|
||||
#### `DELETE /birthday/api/admin/rsvps/{rsvp_id}`
|
||||
|
||||
Permanently delete an RSVP record by identifier.
|
||||
|
||||
- **Auth:** `Remote-User` header required
|
||||
- **Path parameter:** `rsvp_id: int`
|
||||
- **Responses:**
|
||||
- `204` — No Content (record successfully deleted).
|
||||
- `404` — `{"detail": "No se encontró el registro con ID {rsvp_id}"}` if not found.
|
||||
- `401` — Unauthenticated (`Remote-User` missing).
|
||||
|
||||
#### `GET /birthday/api/admin/export`
|
||||
|
||||
Download all RSVPs as CSV.
|
||||
@@ -450,11 +501,13 @@ version = "0.1.0"
|
||||
description = "Birthday Invitation RSVP Backend"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
"fastapi>=0.115.0",
|
||||
"fastapi[standard]>=0.115.0",
|
||||
"uvicorn>=0.30.0",
|
||||
"sqlalchemy>=2.0.0",
|
||||
"pydantic>=2.0.0",
|
||||
"pydantic-settings>=2.0.0",
|
||||
"pillow>=10.0.0",
|
||||
"httpx>=0.27.0",
|
||||
]
|
||||
|
||||
[dependency-groups]
|
||||
@@ -462,5 +515,6 @@ dev = [
|
||||
"httpx>=0.27.0",
|
||||
"pytest>=8.0.0",
|
||||
"pytest-asyncio>=0.23.0",
|
||||
"pyright>=1.1.0",
|
||||
]
|
||||
```
|
||||
+15
-10
@@ -348,7 +348,7 @@ The map is rendered as a clean, circular preview widget linked to the external n
|
||||
- **Hover/Active**: Scales smoothly (`transform: scale(1.05)`), border brightens
|
||||
- **Venue Copy**: Clean text block listing venue name and address
|
||||
- **External Link**: Text link `VER UBICACIÓN ↗` opening `map_url` in a new tab (`target="_blank" rel="noopener noreferrer"`)
|
||||
- **Asset**: Uses `map_preview_url` (v1 configurable URL, architected for future self-hosted static asset)
|
||||
- **Asset**: Served via `map_preview_url` (pointing to `/birthday/api/map-preview.png`), dynamically generated on the backend from OpenStreetMap stitched tiles with a cache-busting timestamp `?t=...`
|
||||
|
||||
---
|
||||
|
||||
@@ -416,26 +416,31 @@ interface Particle {
|
||||
|
||||
Served under route `/birthday/admin` and protected at the reverse-proxy level by Authelia ForwardAuth.
|
||||
|
||||
### 14.1 RSVP Table View
|
||||
### 14.1 RSVP Management Table
|
||||
- **Total Count**: Live tally of confirmed invitees
|
||||
- **Search Bar**: Substring filtering by name, phone, or email
|
||||
- **Table Columns**:
|
||||
- Name
|
||||
- Phone (formatted Colombian mobile)
|
||||
- Email (or em-dash if omitted)
|
||||
- Submission Date/Time (converted from UTC to browser-local)
|
||||
- **Search Bar**: Debounced substring filtering by name, phone, or email
|
||||
- **Table Columns & Interactions**:
|
||||
- **Name**: Displayed as text; converted to inline `<input>` during edit mode
|
||||
- **Phone**: Formatted as Colombian mobile (`300 123 4567`); validates 10-digit format during inline editing
|
||||
- **Email**: Displayed as text (or em-dash if omitted); validates email format during edit
|
||||
- **Submission Date/Time**: Converted from stored UTC to the event's configured timezone (`event_timezone`, e.g., `America/Bogota`) using Colombian Spanish locale (`es-CO`)
|
||||
- **Actions**:
|
||||
- **Editar**: Triggers row edit mode with Save / Cancel controls; displays inline conflict errors if the phone number is already registered
|
||||
- **Eliminar**: Opens a confirmation dialog and permanently removes the record via `DELETE /birthday/api/admin/rsvps/{id}`
|
||||
- **CSV Export**: *"Descargar CSV"* button triggering `GET /birthday/api/admin/export`
|
||||
|
||||
### 14.2 Configuration Editor
|
||||
A flat form allowing the host to edit dynamic invitation data:
|
||||
- Honoree Name
|
||||
- Event Date, Event Time, Event Timezone
|
||||
- Event Date, Event Time, Event Timezone (validated against IANA database)
|
||||
- Invitation Title & Intro Copy
|
||||
- Venue Name & Address Lines
|
||||
- Map Preview URL & External Map URL
|
||||
- RSVP Button Copy & Feedback Messages
|
||||
|
||||
Includes a **Text Preview** block showing the hierarchical composition of the text fields before saving.
|
||||
**Special Features:**
|
||||
- **On-Demand Map Generation**: Button to trigger `POST /birthday/api/admin/map-preview/generate`, resolving coordinates, writing a freshly stitched OpenStreetMap tile preview to disk, and reporting resolved coordinates with timestamp cache-busting.
|
||||
- **Hierarchical Text Preview**: Real-time structured preview of the invitation typographic hierarchy before saving.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in new issue
Block a user