A real-time Bitcoin price prediction game where users guess if the price will go up or down within 60 seconds.
- 🪙 Real-time Bitcoin price updates using Coinbase API and server-sent events
- ⏱ 60-second countdown for price predictions
- 📈 Score tracking system with animated feedback
- 🔐 User authentication via Clerk
- 🚀 Background job processing with Trigger.dev
- 🗄 SQLite database with Turso and Drizzle ORM
- 🎮 Interactive UI with motion animations
- 📊 Database migrations and schema management
- ✅ End-to-end type safety with TypeScript
- 🧪 Comprehensive test suite with Vitest (TODO: E2E tests)
- Node.js 22.x (recommended: Volta or nvm)
- pnpm 10.x:
npm install -g [email protected]
- Turso CLI:
curl -sSfL https://get.tur.so/install.sh | bash
- Clerk - Authentication provider
- Create application and get API keys
- Turso - Database hosting
- Create database and get connection URL (local or remote)
- Fly.io - Application hosting
- Install flyctl (for deployment)
- Trigger.dev - Background jobs
- Create project and get secret key
-
Clone repository
git clone https://github.com/stewarthsoj/bitduel cd bitduel
-
Install dependencies
pnpm install
-
Configure environment variables Create
.env
file with:NODE_ENV=development CLERK_SECRET_KEY=sk_test_... VITE_CLERK_PUBLISHABLE_KEY=pk_test_... TURSO_CONNECTION_URL=libsql://... TURSO_AUTH_TOKEN=... TRIGGER_SECRET_KEY=tr_dev_...
-
Initialize Turso database
- Local development:
turso dev --db-file <filepath>
- Remote database:
turso db create bitduel --org <your-org>
- Local development:
-
Run migrations
pnpm run db:migrate
-
Start DB Studio (optional)
pnpm run db:studio
-
Start Trigger.dev worker (in separate terminal)
pnpm run trigger:dev
-
Start development server
pnpm run dev
- Push production migrations
pnpm run db:migrate
-
Link your project
pnpm dlx @trigger.dev/cli@latest login pnpm dlx @trigger.dev/cli@latest init
-
Add environment variables
pnpm dlx @trigger.dev/cli@latest env:set TURSO_CONNECTION_URL=... TURSO_AUTH_TOKEN=...
-
Deploy triggers to production
pnpm dlx @trigger.dev/cli@latest deploy
-
Create fly application
flyctl launch
-
Set environment variables
flyctl secrets set \ NODE_ENV=production \ CLERK_SECRET_KEY=... \ TURSO_CONNECTION_URL=... \ TURSO_AUTH_TOKEN=... \ TRIGGER_SECRET_KEY=...
-
Deploy
flyctl deploy
Command | Description |
---|---|
pnpm dev |
Start dev server |
pnpm test |
Run Vitest suite |
pnpm lint:check |
Check code quality with Biome |
pnpm lint:write |
Fix linting issues |
pnpm type:check |
Validate TypeScript types |
pnpm build |
Create production build |
pnpm trigger:dev |
Start Trigger.dev worker |