A monorepo for Bangmod Hackathon 2026, containing the website, server, and supporting services, built with TanStack Start, Elysia, and other modern tools.
The framework-neutral @bmhk-2026/api package owns oRPC contracts, authorization policy, application workflows, and persistence adapters. The server application mounts the composed router but does not own feature logic.
API code is organized by feature under packages/api/src/features/<feature>/:
*.router.tsdefines oRPC routes, input and output contracts, authenticated request values, transport policy, and request logging.*.schema.tsdefines Zod validation and public contract types.*.service.tsimplements application workflows and business decisions.*.repository.tsdefines persistence ports and their Drizzle adapters.
packages/api/src/router.ts is the composition root. It creates repositories, injects them into feature services, injects those services into feature routers, and combines the feature routers into AppRouter. Tests can replace repositories through ApiDependencies while exercising behavior through the public RPC seam.
The dependency flow is:
server -> app router -> feature router -> feature service -> repository or external service
Feature routers should remain transport adapters. Database coordination, not-found and conflict decisions, file processing, pagination, response mapping, and other application workflows belong in feature services.
-
Install dependencies:
bun install
-
Configure environment files.
Create
apps/server/.env:cp apps/server/.env.example apps/server/.env
Set
BETTER_AUTH_SECRETto a random value with at least 32 characters. For local PostgreSQL, use:BETTER_AUTH_SECRET=replace-with-a-random-secret-at-least-32-characters-long BETTER_AUTH_URL=http://localhost:3000 AWS_ACCESS_KEY_ID=rustfsadmin AWS_S3_BUCKET=uploads AWS_ENDPOINT_URL_S3=http://localhost:9000 AWS_REGION=us-east-1 AWS_SECRET_ACCESS_KEY=rustfssecret CORS_ORIGIN=http://localhost:3001,http://localhost:3002 DATABASE_URL=postgresql://postgres:password@localhost:5432/bmhk-2026 GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret MICROSOFT_CLIENT_ID=your_microsoft_client_id MICROSOFT_CLIENT_SECRET=your_microsoft_client_secret MICROSOFT_TENANT_ID=organizations NODE_ENV=development PORT=3000
Participants sign in with Google on the web app, staff sign in with Microsoft on the staff app. Configure both redirect URIs as:
http://localhost:3000/api/auth/callback/google http://localhost:3000/api/auth/callback/microsoftGenerate a secret with:
openssl rand -base64 32
Create
apps/web/.envandapps/staff/.envwith:VITE_SERVER_URL=http://localhost:3000
Create
apps/discord/.env(if using the Discord bot):cp apps/discord/.env.example apps/discord/.env
DISCORD_TOKEN=your_bot_token_here DISCORD_CLIENT_ID=your_client_id_here DISCORD_GUILD_ID=your_guild_id_here # GLOBAL=true # Optional: set to true to deploy commands globally instead of guild-scoped
-
Start local services and apply the database schema:
bun run services:start bun run db:push
Local services:
- PostgreSQL:
localhost:5432 - RustFS S3 API: http://localhost:9000
- RustFS console: http://localhost:9001
- RustFS development credentials:
rustfsadmin/rustfssecret - Create configured bucket
uploadsin the RustFS console before starting the server.
Seed local data in this order:
bun run db:seed:auth # Creates or updates local authentication accounts bun run db:seed:dev # Adds example registrations and a staff check-in fixture
db:seed:devdoes not create authentication accounts. It requires the member and registration-staff and staff accounts created bydb:seed:auth.The staff check-in fixture records
BMHK 2026 Staff 2as present and approved byBMHK 2026 Registration Staff, so/staffhas an example checked-in row.Use
bun run db:migratein migration-managed environments such as staging and production. It applies the committed migration history in order. - PostgreSQL:
-
Discord Bot setup (optional):
-
Create an application and bot in the Discord Developer Portal.
-
Enable Privileged Gateway Intents under Bot settings:
- Server Members Intent
- Message Content Intent
-
Deploy slash commands to Discord:
bun run deploy:discord
-
-
Start all applications:
bun run dev
Open:
- Website: http://localhost:3001
- Staff app: http://localhost:3002
- API: http://localhost:3000
Run one app only with
bun run dev:web,bun run dev:staff,bun run dev:server, orbun run dev:discord. -
Run checks before committing:
bun run check bun run test bun run build