b494da9fa4f1c6776fa158df63869a2b2281e584
ElysiaJS Boilerplate
Starter for the ElysiaJS coursework workspace: Bun + ElysiaJS + TypeScript, with MySQL (Drizzle ORM) and Redis wired up to the shared course databases.
Development
bun install
bun run db:push # creates the `notes` table from src/db/schema.ts
bun run dev
Open http://localhost:3000/swagger for interactive API docs (auto-generated
from the routes in src/index.ts).
What's here
src/index.ts- the app: a couple of example routes showing MySQL reads/ writes viasrc/dband Redis reads/writes viasrc/redis.ts. Delete the examples once you understand the pattern and start building your own.src/db/schema.ts- your Drizzle table definitions. Add tables here, then runbun run db:pushto sync them to MySQL (no migration files needed for coursework -pushjust diffs your schema against the live database).src/db/index.ts/src/redis.ts- pre-configured clients, reading connection details from environment variables. In your Coder workspace these are already set for you (MYSQL_*,REDIS_*) - you never need to type a password into code..env.example- only needed if you want to run this outside your Coder workspace, against your own local MySQL/Redis.
Notes
- Your Redis user can only touch keys under
student:<your-username>:*(enforced by the server) - that's whysrc/index.tsprefixes cache keys withREDIS_USERNAME. Keys outside that prefix will be rejected. - Your MySQL user only has access to your own database - no need to specify
it beyond what's already in
MYSQL_DATABASE.
Languages
TypeScript
100%