.env file. The frontend requires a one-line code change to point at your server.
Server environment variables
The server reads configuration from a.env file in the server/ directory using python-dotenv.
| Variable | Default | Description |
|---|---|---|
MONGO_URI | mongodb://localhost:27017/wordgrid | MongoDB connection string. The database name is taken from the URI path. |
PORT | 5000 | Port the Flask server listens on. |
DEBUG | True | Flask debug mode. Set to False in production. |
.env.example
The repository ships with an.env.example you can copy as a starting point:
.env.example
.env and update the values for your environment:
Using MongoDB Atlas
To connect to a MongoDB Atlas cluster, replace the defaultMONGO_URI with your Atlas connection string:
.env
Connecting the frontend to your server
The frontend’s API base URL is defined as a constant near the top ofapp.js:
app.js
app.js
Where API_URL is used
API_URL is referenced in two functions in app.js:
fetchLeaderboardForDate(dateStr) — fetches the top scores for a given date:
app.js
submitLeaderboardEntry(name, scoreVal, dateStr) — posts a completed score to the leaderboard:
app.js
The leaderboard API does not require authentication. Any client that can reach the server can submit scores. If you want to restrict submissions, you will need to add your own authentication layer in front of the Flask server.