chore: add data snapshot, deployment compose, and CLAUDE.md
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:
Adriano Belisario
2026-05-03 18:29:38 +00:00
parent 52f75f0b3d
commit 4864bf6304
4 changed files with 148 additions and 12 deletions

123
CLAUDE.md Normal file
View 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`.