- Video walkthrough: Watch the demo
Dev Code is a web platform for hosting time-bound CSS challenges. Players log in with Google, receive an HTML snippet and a reference image, and race to write CSS that visually matches the target. Submissions are auto-evaluated using headless rendering and pixel comparison. Includes upcoming/past contests and real-time standings.
- Backend: Node.js + Express + MongoDB
- Frontend: React + Tailwind CSS
- Auth: Google OAuth2 (client-side)
- Judging: Puppeteer screenshot comparison with pixel-diff
- Google Sign-In with one-click onboarding
- Upcoming and Past contests listing
- Code Playground to write CSS against an HTML prompt
- Automated verdict via headless rendering and image diff
- Contest window enforcement (1-hour window) and one valid submission per contest
- Contest standings with participant names and timestamps
flowchart LR
A[React Frontend] -- Axios --> B[(Express API)]
B -- Mongoose --> C[(MongoDB)]
B -- Puppeteer --> D[Headless Browser]
D -- PNG Buffer --> B
B -- JSON --> A
Dev_Code/
backend/
index.js # Express server & routes
comparision.js # Puppeteer + image comparison utilities
package.json
vercel.json
frontend/
src/pages/ # Home, Login, Upcoming, Past, Playground, etc.
src/components/ # Header, Footer
package.json
Backend (Dev_Code/backend/.env):
PORT=8000
MONGO=<your-mongodb-connection-string>
cd Dev_Code/backend
npm install
npm run server # dev with nodemon
# or
npm start # prodThe server listens on PORT (default 8000).
cd Dev_Code/frontend
npm install
npm startFrontend runs on React Scripts (default http://localhost:3000).
Base URL: http://localhost:8000
-
POST
/login- Body:
{ response: { credential: <google_id_token> } } - Returns: Google
sub(user id). Creates user if new.
- Body:
-
POST
/getuserdetails- Body:
{ u: <google_sub> } - Returns:
{ name, email }
- Body:
-
GET
/admin/override/createcontest- Creates a new contest with a random question starting now.
-
POST
/question- Body:
{ qId }→ Returns question{ element, image(base64), css }
- Body:
-
GET
/upcomingcontests- Returns contests with
startTime > now - 1h.
- Returns contests with
-
GET
/pastcontests- Returns contests with
startTime < now - ~1h.
- Returns contests with
-
POST
/submit- Body:
{ css, qId, cId, uId } - Validates during contest window (1 hour). If CSS matches target (pixel-equal), records submission and returns
true; elsefalse.
- Body:
-
POST
/conteststandings- Body:
{ cId } - Returns chronological submissions with user names/emails.
- Body:
-
POST
/addquestion- Body:
{ css, element }→ Generates preview image (base64) and stores the question.
- Body:
- The server renders two screenshots with Puppeteer: one for the user’s CSS and one for the canonical CSS against the same HTML snippet.
- Images are normalized and compared. If pixel difference is
0, the submission is accepted.
- Frontend Lead: Deepak (Me)
- Backend Lead: Ashish (https://github.com/ironwol2004)
- Open to contributions via PRs