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.
/api/random-word
& /api/word-valid/:word
, with full Swagger docs
Live Wordle Game: https://the-wordle-game.vercel.app/. Feel free to give it a try!
undici
for fetch, serve-favicon
, in-memory cache + GitHub list fallback/
βββ 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
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
/api/...
β backendcd 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:
http://localhost:3001/api-docs
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>/
/
/api/random-word
, /api/word-valid/:word
/api-docs
PORT
before npm start
in backend
./api
to the backend in dev; production calls same origin.This project is licensed under the MIT License. See the LICENSE file for details.