Skip to content

joint-task-french/Buildotheque

Repository files navigation

Buildotheque

A Cloudflare Workers backend for storing and searching game builds, with Discord OAuth2 authentication.

Features

  • Store and retrieve builds (JSON objects with nom, description, auteur, tags, encoded, likes, timestamp)
  • Search builds by text (matches nom, description, or auteur) 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)

Setup

1. Install dependencies

npm install

2. Create D1 Database

npx wrangler d1 create buildotheque-db

Copy 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.sql

3. Apply migrations (for existing databases)

If 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 --remote

4. Configure environment variables

Edit 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_SECRET

4. Local development

npm run dev

5. Deploy

npm run deploy

API Documentation

The complete API documentation is available in the API.md file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors