The Knucklebones dice game in Cult of the Lamb.
You can find the game at knucklebones.io.
The frontend is built with: React, Vite & Tailwind CSS.
The backend is built with: Cloudflare Workers & Durable Objects
The frontend is hosted with Cloudflare Pages while the backend is a Cloudflare Worker.
All of it is written with TypeScript.
We use Turborepo to manage our monorepo.
The apps
directory contains the React application (front
) and the Cloudflare Worker (worker
) (along with the definition of the Durable Object).
The packages
directory contains code that's shared between the React application and Cloudflare worker.
The original Knucklebones game in Cult of the Lamb was created by Massive Monster. This is a fan-site and not an official implementation by Massive Monster. You can find the original game on the Cult of the Lamb website.
# based on this https://www.better-auth.com/docs/adapters/drizzle#schema-generation--migration
# generate auth-schema, only when updating better-auth configuration
pnpm gen-auth-schema
# generate SQL migrations
pnpm drizzle-kit generate
# run migrations
pnpm drizzle-kit migrate
- should generate the .dev.vars automatically
- start command should be wrangler pages dev --port 3000
- vite-env-only
- @t3-oss/env-core
Je setup l'authentification entre Better Auth et Convex. Pour ça il faut que le client récupère un JWT et l'expose à Convex : https://docs.convex.dev/auth/advanced/custom-auth#integrating-a-new-identity-provider
C'est ok avec la méthode authClient.token()
, mais ça en génère un nouveau à chaque fois, car ils sont pas stockés en BDD. Je sais pas si c'est une bonne ou une mauvaise chose, si je dois les stocker dans le local storage moi-même, et pourquoi il n'y a pas de refresh token à utiliser pour générer un nouveau JWT. Je sais pas trop quel processus ça suit. Peut-être avec le plugin bearer ça marcherait mieux ? Après techniquement, ça conviendrait à Convex, sur le papier. Mais ça a pas l'air opti.