Next.js app for the Decentralized BJJ Belt System.
- Node.js 20 (for local/dev)
- Docker + Docker Compose (for container deploy)
Create .env.local (local dev) or .env (docker-compose) at project root:
NEXT_PUBLIC_API_URL=https://bjjserver-995707778143.europe-west1.run.app
NEXT_PUBLIC_PROFILE_POLICY_ID=<policy_id>
NEXT_PUBLIC_NETWORK_ID=1npm ci
npm run dev
# http://localhost:3000npm ci
npm run build
npm run start -- -p 3000Ensure the following directories exist and are writable for persistence:
data/for SQLite DB (profile-metadata)public/uploads/for profile images
Use Nginx to proxy http://127.0.0.1:3000 and enable TLS. Increase client_max_body_size to allow uploads.
A multi-stage Dockerfile and docker-compose are provided.
- Build and run
docker compose up -d --build- Volumes (persisted on host)
./data→/app/data./public/uploads→/app/public/uploads
- Environment (compose reads from
.env)
NEXT_PUBLIC_API_URLNEXT_PUBLIC_PROFILE_POLICY_IDNEXT_PUBLIC_NETWORK_ID
To keep Basic Auth server-side, the app uses Next.js API routes to proxy to the backend:
/api/build-tx,/api/submit-tx/api/practitioner/[id],/api/organization/[id]/api/belts,/api/belts/count,/api/belts/frequency/api/promotions,/api/promotions/count/api/profiles,/api/profiles/count
Client calls (in src/lib/api.ts) target these routes; no Basic Auth is exposed to the browser.
- Off-chain profile metadata stored in SQLite at
data/metadata.dbvia/api/profile-metadata. - Profile images stored under
public/uploads/(resized WebP), uploaded via/api/profile-image.
The app supports multiple CIP-30 compatible Cardano wallets:
- Eternl (🔵) - Recommended for advanced users
- Nami (🔷) - Popular and user-friendly
- Lace (💎) - Official Daedalus companion
- Flint (🔥) - Lightweight and fast
- Yoroi (🟡) - Mobile-first wallet
- Typhon (🌪️) - Feature-rich wallet
Users can select their preferred wallet from a dropdown menu when connecting. If only one wallet is detected, it will be auto-selected for convenience.
- Native modules:
better-sqlite3,sharpare built in the Docker image. If building on host, you may need build-essential and Python. - If you change env values, rebuild or restart the container:
docker compose up -d --build.