3.5 KiB
3.5 KiB
rSwag - AI Assistant Context
Project Overview
E-commerce platform for rSpace ecosystem merchandise (stickers, shirts, prints) with Mollie payments and print-on-demand fulfillment via Printful and Prodigi. Part of the rSpace ecosystem (rspace.online).
Architecture
- Frontend: Next.js 15 App Router, shadcn/ui, Tailwind CSS, Geist font
- Backend: FastAPI, SQLAlchemy, Alembic
- Database: PostgreSQL
- Payments: Mollie (redirect flow, Dutch data residency)
- Fulfillment: Printful (apparel), Prodigi (stickers/prints)
- AI Design: Gemini API for design generation
- Deployment: Docker on Netcup RS 8000, Traefik routing
Key Directories
| Directory | Purpose |
|---|---|
backend/app/api/ |
FastAPI route handlers |
backend/app/models/ |
SQLAlchemy ORM models |
backend/app/schemas/ |
Pydantic request/response schemas |
backend/app/services/ |
Business logic (mollie, pod, orders, spaces) |
backend/app/pod/ |
POD provider clients |
frontend/app/ |
Next.js App Router pages |
frontend/components/ |
React components |
frontend/lib/ |
Utilities (spaces, cn) |
designs/ |
Design assets (stickers, shirts, misc) |
spaces/ |
Space configs (multi-tenant branding/theming) |
Spaces (Multi-Tenant)
rSwag supports subdomain-based spaces. Each space has its own branding, theme, and product catalog.
- Config:
spaces/{space_id}/space.yamldefines name, theme colors, design filter, tips - Subdomain routing:
{space}.rswag.onlinedetected by Next.js middleware, setsspace_idcookie - API filtering:
GET /api/products?space=fungiflowsreturns only that space's designs - Theme injection: CSS variables overridden at runtime from space config
- Cart isolation: localStorage keys scoped by space (
cart_id_fungiflows) - Current spaces:
_default(rSwag hub),fungiflows(Fungi Flows merch)
Design Source
Designs are stored in-repo at ./designs/ and mounted into the backend container.
Each design has a metadata.yaml with name, description, products, variants, pricing, and space field.
API Endpoints
Spaces
GET /api/spaces- List all spacesGET /api/spaces/{id}- Get space config (branding, theme, tips)
Public
GET /api/designs- List active designs (optional:?space=X)GET /api/designs/{slug}- Get design detailsGET /api/designs/{slug}/image- Serve design imageGET /api/products- List products with variants (optional:?space=X)POST /api/cart- Create cartGET/POST/DELETE /api/cart/{id}/items- Cart operationsPOST /api/checkout/session- Create Mollie paymentGET /api/orders/{id}- Order status (requires email)POST /api/design/generate- AI design generation
Webhooks
POST /api/webhooks/mollie- Mollie payment eventsPOST /api/webhooks/prodigi- Prodigi fulfillment updatesPOST /api/webhooks/printful- Printful fulfillment updates
Admin (JWT required)
POST /api/admin/auth/login- Admin loginGET /api/admin/orders- List ordersGET /api/admin/analytics/*- Sales metrics
Deployment
Push to Gitea triggers webhook auto-deploy on Netcup at /opt/apps/rswag/.
Branding
Default (rSwag):
- Primary color: Cyan (HSL 195 80% 45%)
- Secondary color: Orange (HSL 45 80% 55%)
- Font: Geist Sans + Geist Mono
- Theme: rSpace spatial web aesthetic
Fungi Flows space (fungiflows.rswag.online):
- Primary: Gold (#ffd700)
- Secondary: Bioluminescent green (#39ff14)
- Background: Deep purple (#08070d)
- Theme: Psychedelic mushroom hip-hop aesthetic