A Cloudflare Workers backend for storing and searching game builds, with Discord OAuth2 authentication.
- Store and retrieve builds (JSON objects with
nom,description,auteur,tags,encoded,likes,timestamp) - Search builds by text (matches
nom,description, orauteur) and by tags (cumulative – the build must have all requested tags) - Discord OAuth2 login
- JWT-based session management
- Full CRUD for builds (create, read, update, delete)
- Like system
- Powered by Cloudflare D1 (SQL Database)
npm installnpx wrangler d1 create buildotheque-dbCopy the generated database_id into your wrangler.toml.
Then, apply the database schema (create a schema.sql file at the root of the project with your SQL tables first):
# For local development
npx wrangler d1 execute buildotheque-db --local --file=./schema.sql
# For production deployment
npx wrangler d1 execute buildotheque-db --remote --file=./schema.sqlIf you already have a database and want to update it to the latest version:
# For local development
npx wrangler d1 migrations apply buildotheque-db --local
# For production deployment
npx wrangler d1 migrations apply buildotheque-db --remoteEdit wrangler.toml and set:
| Variable | Description |
|---|---|
DISCORD_CLIENT_ID |
Your Discord application's Client ID |
DISCORD_REDIRECT_URI |
OAuth2 redirect URI (e.g. https://<worker>.workers.dev/auth/discord/callback) |
FRONTEND_URL |
Default URL to redirect users to after login |
ALLOWED_DOMAINS |
Comma-separated list of allowed frontend domains (e.g., joint-task-french.github.io, *.mon-domaine.fr) |
Set secrets (never commit these):
npx wrangler secret put DISCORD_CLIENT_SECRET
npx wrangler secret put JWT_SECRETnpm run devnpm run deployThe complete API documentation is available in the API.md file.