Codey Village is a gamified developer productivity platform that rewards real-world coding activity with in-game currency. Solve a LeetCode problem, push a GitHub commit, or submit a job application β and watch your village grow.
Built as a full-stack web app with a Phaser 3 multiplayer game at its core, a Python FastAPI backend, a Node.js OAuth middleware server, and a Manifest v3 Chrome extension that passively monitors your activity across LeetCode, GitHub, and Workday.
- Best Gamification Hack β GDG Hacks 3
- Devpost: https://devpost.com/software/cozyvillage
- Demo Video: https://www.youtube.com/watch?v=_GpzlR9-mik
- Overview
- Features
- Architecture
- Tech Stack
- Getting Started
- Environment Variables
- Deployment
- API Overview
- Chrome Extension Details
- Multiplayer Architecture Notes
- License
Codey Village turns your daily developer workflow into a resource loop:
- A Chrome extension silently watches LeetCode, GitHub, and Workday.
- When it detects an accepted submission, a commit, or a job application, it fires a request to the FastAPI backend.
- The backend awards coins to your account and stores your activity in MongoDB.
- You spend those coins in the Next.js web app to build and decorate your island in a Phaser 3 top-down world.
- You can join multiplayer rooms (up to 5 players) over WebSockets and roam each other's villages in real time.
| Feature | Description |
|---|---|
| Coin Earning | Earn coins automatically from LeetCode solves, GitHub commits, and Workday job applications |
| Island Building | Purchase and place buildings/decorations using earned coins |
| Multiplayer Rooms | Real-time rooms supporting up to 5 simultaneous players via WebSockets |
| Player Interactions | Interact with other players in the same room |
| Shop System | Browse and buy items to customize your island |
| GitHub OAuth | Link your GitHub account for commit tracking via webhooks |
| Activity Tracking | Complete webhook and event pipeline from IDE β extension β backend β game |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Browser β
β β
β ββββββββββββββββββββββββ βββββββββββββββββββββββββββββ β
β β Next.js Frontend β β Chrome Extension β β
β β (Phaser 3 Game UI) β β (LeetCode / GitHub / β β
β β WebSocket client β β Workday content scripts)β β
β ββββββββββββ¬ββββββββββββ ββββββββββββ¬βββββββββββββββββ β
β β β β
βββββββββββββββΌβββββββββββββββββββββββββββΌβββββββββββββββββββββ
β HTTPS / WSS β HTTPS
βΌ βΌ
βββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ
β Python FastAPI Backend β β Node.js OAuth Server β
β βββββββββββββββββββββ β β ββββββββββββββββββββββ β
β REST API β β GitHub OAuth flow β
β WebSocket (rooms) β β GitHub webhook receiver β
β Coin system β β Activity tracker β
β Island / shop logic β ββββββββββββββββββββββββββββ
β Firebase auth verify β
β βββββββββββββββββββββ β
β MongoDB β
βββββββββββββββββββββββββββ
Data flow for a LeetCode coin award:
- User solves a LeetCode problem in the browser.
- The extension's
leetcode.jscontent script detects the accepted submission. - Extension sends a POST to the FastAPI backend
/coins/award. - Backend validates the Firebase auth token, increments user coins in MongoDB, and broadcasts to any active WebSocket room.
- The frontend updates the coin counter in real time.
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, React 19, TypeScript, Phaser 3.90, Tailwind CSS 4 |
| Auth | Firebase Authentication |
| Backend | Python 3.11, FastAPI, Uvicorn |
| Database | MongoDB (Atlas) via pymongo |
| Real-time | WebSockets (FastAPI native) |
| OAuth Server | Node.js, Express 4 |
| Chrome Extension | Manifest v3, Vanilla JS |
| External APIs | GitHub REST API, LeetCode (scraped), Workday |
| Deployment | Render (backend), Vercel (frontend) |
| Containerization | Docker (Python 3.11-slim) |
- Node.js 18+ and npm
- Python 3.11+
- MongoDB Atlas account (or local MongoDB instance)
- Firebase project with Authentication enabled
- Google Chrome (for the extension)
- A GitHub OAuth App (for the OAuth server)
cd backend
pip install -r requirements.txtCreate a .env file in backend/:
MONGO_URL=mongodb+srv://<user>:<pass>@<cluster>.mongodb.net/?appName=<app>
FIREBASE_API_KEY=<your-firebase-api-key>
WEBHOOK_URL=https://<your-backend-domain>Start the development server:
uvicorn main:app --reload --port 8000The API will be available at http://localhost:8000. Interactive docs are at http://localhost:8000/docs.
cd server
npm installCreate a .env file in server/:
GITHUB_CLIENT_ID=<your-github-oauth-app-client-id>
GITHUB_CLIENT_SECRET=<your-github-oauth-app-client-secret>
WEBHOOK_URL=https://<your-backend-domain>
PORT=3001Start the server:
npm startcd frontend
npm installCreate a .env.local file in frontend/:
NEXT_PUBLIC_IDENTITY_PLATFORM_API_KEY=<firebase-api-key>
NEXT_PUBLIC_IDENTITY_PLATFORM_AUTH_DOMAIN=<project>.firebaseapp.com
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
NEXT_PUBLIC_WS_URL=ws://localhost:8000Start the development server:
npm run devOpen http://localhost:3000 in your browser.
Available scripts:
npm run dev # Start development server (hot reload)
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint- Open Chrome and navigate to
chrome://extensions/. - Enable Developer mode (top-right toggle).
- Click Load unpacked and select the
extension/directory. - The Codey Village extension icon will appear in your toolbar.
- Sign in via the extension popup and connect your accounts.
The extension monitors:
leetcode.comβ problem submissionsgithub.comβ commit/push events- Workday job application portals β application submissions
| Variable | Description |
|---|---|
MONGO_URL |
MongoDB Atlas connection string |
FIREBASE_API_KEY |
Firebase project API key for token verification |
WEBHOOK_URL |
Public URL of this backend (used for webhook registration) |
| Variable | Description |
|---|---|
GITHUB_CLIENT_ID |
GitHub OAuth App Client ID |
GITHUB_CLIENT_SECRET |
GitHub OAuth App Client Secret |
WEBHOOK_URL |
Backend URL to forward GitHub webhook payloads |
PORT |
Port to listen on (default: 3000) |
| Variable | Description |
|---|---|
NEXT_PUBLIC_IDENTITY_PLATFORM_API_KEY |
Firebase API key |
NEXT_PUBLIC_IDENTITY_PLATFORM_AUTH_DOMAIN |
Firebase auth domain |
NEXT_PUBLIC_BACKEND_URL |
FastAPI backend base URL |
NEXT_PUBLIC_WS_URL |
WebSocket URL for multiplayer |
The Next.js app is deployed to Vercel. Connect the frontend/ directory as the Vercel project root and set the environment variables in the Vercel dashboard.
The FastAPI backend is deployed to Render. Connect your repository and set the environment variables in the Render dashboard. Use the following start command:
uvicorn main:app --host 0.0.0.0 --port 8000The FastAPI backend exposes the following route groups:
| Prefix | Description |
|---|---|
/users |
User CRUD β profile, username, stats |
/coins |
Coin award, balance, transaction history |
/rooms |
Room creation, joining, listing |
/island |
Island state, building placement |
/shop |
Item catalog, purchase |
/interactions |
Player-to-player interaction events |
/ws |
WebSocket endpoint for real-time multiplayer |
Full interactive documentation is available at /docs (Swagger UI) and /redoc when the backend is running.
The extension uses Manifest v3 with a persistent service worker and the following content scripts:
| Script | Injected On | Purpose |
|---|---|---|
leetcode.js |
leetcode.com/* |
Detects accepted problem submissions |
github.js |
github.com/* |
Tracks commit/push activity |
workday.js |
Workday job portals | Detects completed job applications |
webapp.js |
localhost:3000, production domain |
Bridges extension state with the game frontend |
toast.js |
All monitored pages | Renders coin-earned toast notifications |
An injected/interceptor.js script is injected into the page context (not the extension context) to intercept outgoing API requests from LeetCode and GitHub before they leave the browser, allowing the extension to detect events without polling.
The WebSocket room manager (backend/routes/ws_routes.py) holds all active room and player state in memory inside a RoomManager class. This means the backend must run as a single instance β splitting across multiple instances would cause players in the same room to connect to different instances with no shared state.
The natural path to horizontal scaling is to move room state to a Redis pub/sub layer, which would allow any number of backend instances to share room events. This is the primary scalability improvement for a production rollout.
GDG-HACKS3/
βββ frontend/ # Next.js web app
β βββ app/ # App Router pages (auth, lobby, game, room/[id])
β βββ src/
β β βββ game/ # Phaser 3 game config, scenes, entities, map gen
β β βββ components/ # Shared React components
β β βββ hooks/ # Custom hooks (useCoins, useRoom, usePlayer)
β β βββ lib/ # Firebase, API client, Supabase utils
β β βββ store/ # Zustand game store
β β βββ types/ # TypeScript type definitions
β βββ public/ # Static assets and game sprites
β
βββ backend/ # Python FastAPI service
β βββ main.py # App entrypoint, CORS, router registration
β βββ models/ # Pydantic data models
β βββ controllers/ # Business logic
β βββ routes/ # API route handlers + WebSocket manager
β βββ services/ # Firebase, GitHub, LeetCode integrations
β βββ database/ # MongoDB connection
β
βββ server/ # Node.js OAuth + webhook middleware
β βββ index.js # Express app (GitHub OAuth, webhook receiver)
β
βββ extension/ # Chrome Extension (Manifest v3)
β βββ manifest.json
β βββ background/ # Service worker
β βββ popup/ # Extension popup UI
β βββ content-scripts/ # Page-injected scripts (leetcode, github, workday)
β βββ injected/ # In-page context scripts (API interceptor)
β βββ icons/ # Extension icons (16, 48, 128px)
β
βββ LICENSE # GNU GPL v3
This project is licensed under the GNU General Public License v3.0. See LICENSE for the full text.


