chore: add data snapshot, deployment compose, and CLAUDE.md
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
- Commit SQLite db snapshot (WAL checkpointed before copy) - Replace upstream docker-compose with real deployment config - Add CLAUDE.md documenting customization and deploy steps - Gitignore secrets.json and SQLite temp files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -59,5 +59,7 @@ drizzle/
|
|||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
# data
|
# data — commit db snapshot but not secrets or SQLite temp files
|
||||||
/data
|
/data/secrets.json
|
||||||
|
/data/db/*.db-wal
|
||||||
|
/data/db/*.db-shm
|
||||||
|
|||||||
123
CLAUDE.md
Normal file
123
CLAUDE.md
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
# Chadebebe — Wishlist App
|
||||||
|
|
||||||
|
Baby shower wishlist site running at `chadebebe.omeu.website`. Built on [Reggio Digital's wishlist app](https://github.com/Reggio-Digital/wishlist).
|
||||||
|
|
||||||
|
## Stack
|
||||||
|
|
||||||
|
- **Next.js 16** (App Router, standalone build)
|
||||||
|
- **SQLite** via better-sqlite3 + Drizzle ORM
|
||||||
|
- **Tailwind CSS v4**
|
||||||
|
- **Docker** with Traefik reverse proxy
|
||||||
|
|
||||||
|
## Repository layout
|
||||||
|
|
||||||
|
```
|
||||||
|
src/ ← Next.js source code (this repo)
|
||||||
|
data/
|
||||||
|
db/wishlist.db ← SQLite database (committed as snapshot)
|
||||||
|
uploads/ ← user-uploaded images (not committed)
|
||||||
|
docker-compose.yml ← deployment config (builds image + Traefik labels)
|
||||||
|
Dockerfile ← multi-stage Next.js build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Customization
|
||||||
|
|
||||||
|
### Site title and homepage text
|
||||||
|
|
||||||
|
Stored in the `settings` table — edit directly in SQLite or via the admin UI:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
UPDATE settings SET value = 'My Title' WHERE key = 'siteTitle';
|
||||||
|
UPDATE settings SET value = 'My subtitle' WHERE key = 'homepageSubtext';
|
||||||
|
```
|
||||||
|
|
||||||
|
### Wishlists
|
||||||
|
|
||||||
|
Each wishlist has a `slug` (URL path), `name`, `description`, and optional cover image.
|
||||||
|
Items live in `wishlist_items` linked by `wishlist_id`.
|
||||||
|
|
||||||
|
To inspect or edit data directly:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sqlite3 data/db/wishlist.db
|
||||||
|
```
|
||||||
|
|
||||||
|
### Locale / language
|
||||||
|
|
||||||
|
UI strings are hardcoded in the source. The PT-BR localization lives in:
|
||||||
|
|
||||||
|
- `app/layout.tsx` — `<html lang="pt-BR">` and metadata description
|
||||||
|
- `app/[slug]/page.tsx` — `Intl.NumberFormat('pt-BR', ...)` for prices
|
||||||
|
- `components/share-button.tsx` — "Compartilhar" label
|
||||||
|
- `app/lock/page.tsx`, `app/not-found.tsx`, `app/page.tsx` — page copy
|
||||||
|
|
||||||
|
To switch language, update those files and rebuild the image.
|
||||||
|
|
||||||
|
### Admin credentials
|
||||||
|
|
||||||
|
Set via environment variables in `docker-compose.yml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- ADMIN_USERNAME=your_username
|
||||||
|
- ADMIN_PASSWORD=your_password
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- Docker + Docker Compose
|
||||||
|
- Traefik running on a `web` Docker network with a `letsencrypt` cert resolver
|
||||||
|
- Domain pointing to the server
|
||||||
|
|
||||||
|
### First deploy
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://git.omeu.website/root/chadebebe.git
|
||||||
|
cd chadebebe
|
||||||
|
|
||||||
|
# Build the image and start
|
||||||
|
docker compose up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
The `data/db/wishlist.db` snapshot committed in the repo will be used as the initial database. On first run the app writes `data/secrets.json` (JWT keys) — this file is gitignored and must not be committed.
|
||||||
|
|
||||||
|
### Updating the app
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Pull latest source
|
||||||
|
git pull
|
||||||
|
|
||||||
|
# Rebuild image and restart container
|
||||||
|
docker compose up -d --build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Database backup
|
||||||
|
|
||||||
|
The database is a single SQLite file. Back it up with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sqlite3 data/db/wishlist.db "PRAGMA wal_checkpoint(FULL);"
|
||||||
|
cp data/db/wishlist.db data/db/wishlist.db.bak
|
||||||
|
```
|
||||||
|
|
||||||
|
To commit a new snapshot to git:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sqlite3 data/db/wishlist.db "PRAGMA wal_checkpoint(FULL);"
|
||||||
|
git add data/db/wishlist.db
|
||||||
|
git commit -m "chore: update db snapshot"
|
||||||
|
git push gitea main
|
||||||
|
```
|
||||||
|
|
||||||
|
## Local development
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd src # if cloned at root level, otherwise you're already here
|
||||||
|
cp .env.example .env
|
||||||
|
npm install
|
||||||
|
npm run db:migrate
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
App runs at `http://localhost:3000`. Admin at `/admin`.
|
||||||
BIN
data/db/wishlist.db
Executable file
BIN
data/db/wishlist.db
Executable file
Binary file not shown.
@@ -1,16 +1,27 @@
|
|||||||
services:
|
services:
|
||||||
app:
|
wishlist:
|
||||||
image: reggiodigital/wishlist:latest
|
build: .
|
||||||
container_name: wishlist
|
image: chadebebe-ptbr:latest
|
||||||
|
container_name: chadebebe
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
|
||||||
environment:
|
environment:
|
||||||
# User/Group IDs (defaults to 1000:1000, Unraid users set to 99:100)
|
|
||||||
- PUID=${PUID:-1000}
|
|
||||||
- PGID=${PGID:-1000}
|
|
||||||
# Admin credentials
|
|
||||||
- ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
|
- ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
|
||||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-changeme}
|
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-changeme}
|
||||||
|
- PUID=${PUID:-1000}
|
||||||
|
- PGID=${PGID:-1000}
|
||||||
|
- COOKIE_SECURE=true
|
||||||
volumes:
|
volumes:
|
||||||
- /folder-for-wishlist-data:/app/data
|
- ./data:/app/data
|
||||||
|
networks:
|
||||||
|
- web
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.chadebebe.rule=Host(`chadebebe.omeu.website`)"
|
||||||
|
- "traefik.http.routers.chadebebe.entrypoints=https"
|
||||||
|
- "traefik.http.routers.chadebebe.tls=true"
|
||||||
|
- "traefik.http.routers.chadebebe.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.chadebebe.loadbalancer.server.port=3000"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
web:
|
||||||
|
external: true
|
||||||
|
|||||||
Reference in New Issue
Block a user