DailyNews is configured through two environment variable scopes: backend variables that control the Express server and MongoDB connection, and a frontend variable that tells the Vite app where to reach the API. Backend variables are loaded at runtime byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/miikorz/DailyNews/llms.txt
Use this file to discover all available pages before exploring further.
dotenv from the root .env file (or from Docker Compose’s inline environment: block), while the frontend variable is embedded into the production bundle at build time by Vite.
Backend Variables
These variables are consumed bybackend/src/server.ts (for PORT) and backend/src/infrastructure/database/connect.ts (for MONGO_URI). Both files call dotenv.config() and read from process.env.
The port the Express server binds to. Docker Compose sets this to
3001 via the inline environment: block.Example: PORT=3001Full MongoDB connection string passed to
mongoose.connect(). When running inside Docker Compose, the hostname is the Compose service name mongo. For local development outside Docker, point this at your local MongoDB instance.Docker Compose example: MONGO_URI=mongodb://mongo:27017/feed-dbLocal development example: MONGO_URI=mongodb://localhost:27017/feed-dbFrontend Variables
Vite only exposes variables that are prefixed withVITE_ to the client-side bundle. These are read at build time via import.meta.env — not at runtime — so the container must be rebuilt after changing them.
Base URL of the backend feed endpoint, intended for use in
frontend/src/utils/apiConstants.ts to construct all API endpoint paths (getAllFeeds, createFeed, searchFeedsByTitle, etc.).The VITE_ prefix is mandatory for Vite to include this variable in the client bundle. Variables without this prefix are stripped from the build and will be undefined in the browser.Note: The line that reads this variable in apiConstants.ts is currently commented out and the URL is hardcoded. The variable has no effect until that file is updated. See the warning at the bottom of this page for details.Example: VITE_BACKEND_BASE_URI=http://localhost:3001/feedConfiguration Files
DailyNews reads environment variables from two.env files, each consumed by a different layer of the stack:
Root .env (backend)
Path: .env (project root)
Consumed by the backend Docker Compose service via env_file: .env. Also loaded directly by dotenv.config() inside server.ts and connect.ts when running outside Docker. The file is currently empty in the repository — values are supplied inline by Docker Compose — but you can add overrides here for local development:
frontend/.env (Vite)
Path: frontend/.env
Consumed by Vite at build time. The repository ships this file with the following content:
Docker Compose Inline Environment
In addition to the file-based variables above,docker-compose.yml declares environment variables inline under each service’s environment: key. These values take precedence over the file-based .env entries for the running container:
| Service | Variable | Value |
|---|---|---|
backend | PORT | 3001 |
backend | MONGO_URI | mongodb://mongo:27017/feed-db |
frontend | VITE_BACKEND_BASE_URI | http://localhost:3001/feed |
backend service also uses env_file: .env to load the root .env file. Any variables set in that file will be available to the container, but variables declared in the inline environment: block will override them if there is a conflict.
The
MONGO_URI in Docker Compose uses mongo as the hostname — the Compose service name. This only resolves correctly inside the Docker network. For local development without Docker, use localhost instead.Local Development
To run the backend and frontend outside of Docker, create the two.env files manually and point them at a locally running MongoDB instance.
Root .env
frontend/.env
npm run dev (uses nodemon), and start the frontend dev server with npm run dev (uses vite) from their respective directories.