Add R2 image storage, upload endpoint, and CDN support
All checks were successful
ci/woodpecker/push/deploy Pipeline was successful
All checks were successful
ci/woodpecker/push/deploy Pipeline was successful
- Backend: R2StorageService, upload controller (POST /api/upload) - Frontend: CDN url helper, NEXT_PUBLIC_CDN_URL build arg - Deploy: pass R2 secrets from Woodpecker CI to containers via .env - Docs: update CLAUDE.md with CDN and upload conventions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
15
CLAUDE.md
15
CLAUDE.md
@@ -130,6 +130,7 @@ cd backend && dotnet build
|
||||
- Controllers use attribute routing: `[Route("api/[controller]")]`
|
||||
- Health check: `GET /api/health` — returns `{ status, database, environment }`
|
||||
- Health ping: `GET /api/health/ping` — returns `{ status: "pong" }`
|
||||
- Upload: `POST /api/upload` — multipart form, fields: `file` (required), `path` (optional folder prefix)
|
||||
|
||||
## Frontend Conventions
|
||||
|
||||
@@ -168,6 +169,20 @@ Host=postgres;Port=5432;Database={db};Username={user};Password={pass}
|
||||
Configured via env var `ConnectionStrings__Default` in docker-compose files.
|
||||
Locally via `appsettings.Local.json` with SSH tunnel (`localhost:5433`).
|
||||
|
||||
## CDN & Image Storage
|
||||
|
||||
- **Storage:** Cloudflare R2 (S3-compatible)
|
||||
- **CDN domain:** https://cdn.goodbrick.com.ua
|
||||
- **Bucket:** goodbrick
|
||||
- **Frontend:** `NEXT_PUBLIC_CDN_URL` env var, `cdnUrl()` helper in `src/lib/cdn.ts`
|
||||
- **Backend:** `R2__*` env vars, `R2StorageService` for uploads
|
||||
- **Upload endpoint:** `POST /api/upload` — multipart/form-data, max 10MB, images only (jpeg/png/webp/avif)
|
||||
|
||||
### Folder Convention
|
||||
- `products/<slug>/main.jpg` — product photos
|
||||
- `catalog/<slug>/cover.jpg` — collection covers
|
||||
- `site/<name>.jpg` — site-wide images (hero, about, etc.)
|
||||
|
||||
## Key Rules
|
||||
|
||||
- Never commit `.env` files or secrets — credentials are in docker-compose env vars on server
|
||||
|
||||
Reference in New Issue
Block a user