This project is a simple implementation of the popular word-guessing game, Wordle. The game allows users to guess a 5-letter word within 6 attempts, providing feedback on each guess.
- Frontend: React + Tailwind CSS, fully interactive Wordle UI
- Backend: Express API serving
/api/random-word
&/api/word-valid/:word
, with full Swagger docs - Deployment: Monorepo deploy via Vercel
Live Wordle Game: https://the-wordle-game.vercel.app/. Feel free to give it a try!
- Frontend: React (TypeScript), Tailwind CSS
- Backend: Node.js (TypeScript), Express,
undici
for fetch,serve-favicon
, in-memory cache + GitHub list fallback - Docs: OpenAPI (inline), Swagger UI
- Deploy: Vercel (Functions + Static Build)
/
βββ backend/
β βββ index.ts # Express API + Swagger spec in one file
β βββ favicon.ico # Favicon served by Express
β βββ package.json # backend dependencies & scripts
β βββ tsconfig.json # TypeScript config
β βββ vercel.json # Serverless Function config
βββ src/
β βββ (... more) # React components
β βββ App.tsx # Main React component (game logic + UI)
β βββ TileRow.tsx # Row of 5 tiles
β βββ Keyboard.tsx # On-screen keyboard
β βββ GameWon.tsx # βYou wonβ screen
β βββ GameOver.tsx # βGame overβ screen
βββ package.json # Frontend dependencies & scripts (CRA/Vite)
βββ README.md # This file
- Node.js v16+
- npm or yarn
- (Optional) Vercel CLI for local emulation & deploy (
npm i -g vercel
)
First, clone the repo. Then, install dependencies for both frontend and backend:
# Frontend
cd <project-root>
npm install
# Backend
cd backend
npm install
You can run frontend and backend in parallel (two terminals).
cd <project-root>
npm start
- Opens at http://localhost:3000
- Proxy is configured so
/api/...
β backend
cd backend
npm run build # compiles TypeScript β dist/
npm start # starts express on http://localhost:3001/api/
Once the backend is running at http://localhost:3001
, you have:
- URL:
http://localhost:3001/api-docs
- JSON spec:
http://localhost:3001/swagger.json
Method | Path | Response |
---|---|---|
GET | /api/random-word |
{ "word": "<random 5-letter word>" } |
GET | /api/word-valid/:word |
{ "valid": true } or { "valid": false } |
GET | /swagger.json |
OpenAPI JSON spec |
GET | /api-docs |
Swagger UI |
GET | / |
Redirects to /api-docs |
# Random word
curl http://localhost:3001/api/random-word
# β {"word":"apple"}
# Validate guess
curl http://localhost:3001/api/word-valid/hello
# β {"valid":true}
curl http://localhost:3001/api/word-valid/zzzzz
# β {"valid":false}
cd <project-root>
npm run build
Produces optimized static files (e.g. build/
for CRA or dist/
for Vite).
No special build step beyond TypeScript compile:
cd backend
npm run build
This monorepo has both a staticβbuild (frontend) and a Node function (backend). From the repo root:
-
Login & link:
vercel
-
Deploy:
vercel --prod
-
Live URL:
https://<your-vercel-app>/
- Frontend at
/
- API at
/api/random-word
,/api/word-valid/:word
- Swagger UI at
/api-docs
- Frontend at
- Backend fetch fails: you'll see a console warning and the built-in 108-word fallback will be used.
- Port conflict: set
PORT
beforenpm start
inbackend
. - CORS issues: the frontend proxies
/api
to the backend in dev; production calls same origin.
This project is licensed under the MIT License. See the LICENSE file for details.