extremely claude-assisted go game based on atproto! working on cleaning up and giving a more unique design, still has a bit of a slop vibe to it.
Bug Fixes - Local Development Setup#
Summary#
Fixed critical issues blocking local development after Cloudflare migration.
Issues Fixed#
1. OAuth API Breaking Changes (✅ Fixed)#
Problem: @atcute/oauth-node-client v1.1.0 removed importJwkKey export
Solution:
- Updated to use
ClientAssertionPrivateJwktype directly - Parse JWK JSON and pass as array to keyset parameter
- Updated key generation script to use
generateClientAssertionKey
Files Changed:
src/lib/server/auth.tsscripts/generate-key.ts
2. Missing Local Development Fallbacks (✅ Fixed)#
Problem: App required Cloudflare D1 and KV which aren't available in local dev
Solution:
- Database: Falls back to better-sqlite3 when D1 not available
- OAuth Storage: Falls back to MemoryStore when KV not available
- Environment: Reads from process.env when platform.env not available
- Added dotenv back for local development
Files Changed:
src/lib/server/db.tssrc/lib/server/auth.tssrc/hooks.server.ts
3. ESM/CommonJS Module Issues (✅ Fixed)#
Problem: require is not defined error in ESM modules
Solution:
- Use
createRequirefrom 'module' to enable CommonJS in ESM - Keep getDb synchronous to avoid breaking 16+ call sites
Files Changed:
src/lib/server/db.ts
4. OAuth Key Generation (✅ Fixed)#
Problem: Key generation script using old API, detecting commented keys
Solution:
- Updated to use
generateClientAssertionKeyfrom @atcute/oauth-crypto - Fixed regex to only detect uncommented PRIVATE_KEY_JWK lines
Files Changed:
scripts/generate-key.ts
Current Status#
✅ Working#
- OAuth key generation (
npm run setup:key) - Database initialization (SQLite local fallback)
- Environment configuration (.env loading)
- Build process (
npm run build)
⚠️ Needs Testing#
- Dev server runtime (
npm run dev) - OAuth login flow
- Game creation and moves
- Image generation endpoints
📋 Next Steps#
- Test dev server with all endpoints
- Verify OAuth flow works end-to-end
- Test game creation and gameplay
- Add reactions feature
- Deploy to Cloudflare Pages
Development Setup#
To run locally:
# 1. Install dependencies
npm install
# 2. Generate OAuth keys
npm run setup:key
# 3. Start dev server
npm run dev
The app will use:
- SQLite database at
./data/app.db - MemoryStore for sessions/state
- OAuth with generated JWK keys
Deployment Notes#
For Cloudflare Pages deployment:
- D1 database will be used instead of SQLite
- KV namespaces will be used instead of MemoryStore
- Environment secrets from Cloudflare dashboard
- See
CLOUDFLARE_DEPLOYMENT.mdfor details