Merge branch 'dev'
This commit is contained in:
commit
f6b640e4a3
92
CLAUDE.md
92
CLAUDE.md
|
|
@ -1,92 +0,0 @@
|
|||
# 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.yaml` defines name, theme colors, design filter, tips
|
||||
- **Subdomain routing**: `{space}.rswag.online` detected by Next.js middleware, sets `space_id` cookie
|
||||
- **API filtering**: `GET /api/products?space=fungiflows` returns 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 spaces
|
||||
- `GET /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 details
|
||||
- `GET /api/designs/{slug}/image` - Serve design image
|
||||
- `GET /api/products` - List products with variants (optional: `?space=X`)
|
||||
- `POST /api/cart` - Create cart
|
||||
- `GET/POST/DELETE /api/cart/{id}/items` - Cart operations
|
||||
- `POST /api/checkout/session` - Create Mollie payment
|
||||
- `GET /api/orders/{id}` - Order status (requires email)
|
||||
- `POST /api/design/generate` - AI design generation
|
||||
|
||||
### Webhooks
|
||||
- `POST /api/webhooks/mollie` - Mollie payment events
|
||||
- `POST /api/webhooks/prodigi` - Prodigi fulfillment updates
|
||||
- `POST /api/webhooks/printful` - Printful fulfillment updates
|
||||
|
||||
### Admin (JWT required)
|
||||
- `POST /api/admin/auth/login` - Admin login
|
||||
- `GET /api/admin/orders` - List orders
|
||||
- `GET /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
|
||||
|
|
@ -1,108 +1,20 @@
|
|||
services:
|
||||
# PostgreSQL Database
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
container_name: rswag-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: rswag
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-devpassword}
|
||||
POSTGRES_DB: rswag
|
||||
volumes:
|
||||
- rswag-db-data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- rswag-internal
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U rswag"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# Redis for sessions/cache
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: rswag-redis
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- rswag-redis-data:/data
|
||||
networks:
|
||||
- rswag-internal
|
||||
|
||||
# FastAPI Backend
|
||||
backend:
|
||||
# Static landing page
|
||||
landing:
|
||||
build:
|
||||
context: ./backend
|
||||
context: ./landing
|
||||
dockerfile: Dockerfile
|
||||
container_name: rswag-backend
|
||||
container_name: rswag-landing
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- INFISICAL_CLIENT_ID=${INFISICAL_CLIENT_ID}
|
||||
- INFISICAL_CLIENT_SECRET=${INFISICAL_CLIENT_SECRET}
|
||||
- INFISICAL_PROJECT_SLUG=rswag
|
||||
- INFISICAL_ENV=prod
|
||||
- INFISICAL_URL=http://infisical:8080
|
||||
- DATABASE_URL=postgresql://rswag:${DB_PASSWORD:-devpassword}@db:5432/rswag
|
||||
- REDIS_URL=redis://redis:6379
|
||||
- DESIGNS_PATH=/app/designs
|
||||
- CONFIG_PATH=/app/config
|
||||
- SPACES_PATH=/app/spaces
|
||||
- PRINTFUL_STORE_ID=${PRINTFUL_STORE_ID:-}
|
||||
- PUBLIC_URL=${PUBLIC_URL:-https://rswag.online}
|
||||
- SMTP_HOST=${SMTP_HOST:-mail.rmail.online}
|
||||
- SMTP_PORT=${SMTP_PORT:-587}
|
||||
- SMTP_USER=${SMTP_USER:-noreply@rswag.online}
|
||||
- SMTP_PASSWORD=${SMTP_PASSWORD:-}
|
||||
- SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL:-noreply@rswag.online}
|
||||
- SMTP_FROM_NAME=${SMTP_FROM_NAME:-rSwag}
|
||||
volumes:
|
||||
- ./designs:/app/designs
|
||||
- ./config:/app/config:ro
|
||||
- ./spaces:/app/spaces:ro
|
||||
- ./frontend/public/mockups:/app/mockups:ro
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- rswag-internal
|
||||
- traefik-public
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.rswag-api.rule=(Host(`rswag.online`) || Host(`fungiswag.jeffemmett.com`) || HostRegexp(`{subdomain:[a-z0-9-]+}.rswag.online`)) && PathPrefix(`/api`)"
|
||||
- "traefik.http.routers.rswag-api.entrypoints=web"
|
||||
- "traefik.http.routers.rswag-api.priority=130"
|
||||
- "traefik.http.services.rswag-api.loadbalancer.server.port=8000"
|
||||
- "traefik.http.routers.rswag-landing.rule=Host(`rswag.online`) || Host(`www.rswag.online`)"
|
||||
- "traefik.http.routers.rswag-landing.entrypoints=web"
|
||||
- "traefik.http.services.rswag-landing.loadbalancer.server.port=80"
|
||||
- "traefik.docker.network=traefik-public"
|
||||
|
||||
# Next.js Frontend
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-http://localhost:8000/api}
|
||||
container_name: rswag-frontend
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- rswag-internal
|
||||
- traefik-public
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.rswag-web.rule=Host(`rswag.online`) || Host(`fungiswag.jeffemmett.com`) || HostRegexp(`{subdomain:[a-z0-9-]+}.rswag.online`)"
|
||||
- "traefik.http.routers.rswag-web.entrypoints=web"
|
||||
- "traefik.http.routers.rswag-web.priority=130"
|
||||
- "traefik.http.services.rswag-web.loadbalancer.server.port=3000"
|
||||
- "traefik.docker.network=traefik-public"
|
||||
|
||||
volumes:
|
||||
rswag-db-data:
|
||||
rswag-redis-data:
|
||||
|
||||
networks:
|
||||
rswag-internal:
|
||||
driver: bridge
|
||||
traefik-public:
|
||||
external: true
|
||||
|
|
|
|||
|
|
@ -699,8 +699,8 @@
|
|||
with no upfront inventory. Revenue flows directly to community treasuries through rFunds.
|
||||
</p>
|
||||
<div class="hero-actions">
|
||||
<a href="https://rstack.online" class="btn btn-primary">Explore rStack</a>
|
||||
<a href="https://github.com/jeffemmett/rswag-online" class="btn btn-secondary">View Source</a>
|
||||
<a href="https://rspace.online/demo/swag" class="btn btn-primary">Try the Demo</a>
|
||||
<a href="https://rstack.online" class="btn btn-secondary">Explore rStack</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue