Skip to main content

Documentation 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.

This page walks you through getting the entire DailyNews stack — React frontend, Express backend, and MongoDB — running on your machine in roughly five minutes. The recommended path is Docker Compose, which handles every dependency automatically. If you prefer running services directly on your host, there is also a manual setup section at the bottom.

Prerequisites

Docker + Docker Compose

Required for the recommended one-command setup. Docker Compose v2 is bundled with Docker Desktop.

Node.js (latest LTS)

Only needed if you want to run the backend or frontend directly on your host without Docker.

Git

Required to clone the repository. Any recent version works.

Setup Steps

1

Clone the repository

Clone the DailyNews repository and navigate into the project root:
git clone https://github.com/miikorz/DailyNews.git
cd DailyNews
2

Review environment configuration

DailyNews uses two environment files — one for Docker Compose at the project root, and one inside the frontend folder.Root .env (consumed by Docker Compose for the backend service):
# .env — project root
PORT=3001
MONGO_URI=mongodb://mongo:27017/feed-db
Docker Compose also injects these values directly via the environment block in docker-compose.yml, so the root .env acts as an override file for local customisation.frontend/.env (consumed by Vite at build time):
# frontend/.env
VITE_BACKEND_BASE_URI=http://localhost:3001/feed
The VITE_BACKEND_BASE_URI variable tells the React app where to reach the API. When running via Docker Compose, the default value http://localhost:3001/feed is already set in docker-compose.yml under the frontend service’s environment block — you only need to change it if you deploy to a different host or port.
3

Start the full stack with Docker Compose

From the project root, build images and start all three services (frontend, backend, MongoDB) in one command:
docker-compose up --build
Docker Compose will:
  1. Pull the official mongo image and start it on port 27017.
  2. Build and start the backend container on port 3001, waiting for MongoDB to be ready.
  3. Build and start the frontend container on port 3000, waiting for the backend.
You will see interleaved logs from all three containers. The backend prints Server is running on port 3001 when it is ready.
4

Open the app

Once all containers are running, open these URLs in your browser:
ServiceURL
React frontendhttp://localhost:3000
REST APIhttp://localhost:3001
The frontend automatically connects to the API using the VITE_BACKEND_BASE_URI environment variable.
5

Make your first API call

With the stack running, hit the GET /feed endpoint to trigger a live scrape of El País and El Mundo and retrieve the full feed:
curl http://localhost:3001/feed
The response is a JSON object with a data array of Feed objects and an error field. Each item in data matches the Feed interface defined in backend/src/domain/model/Feed.ts, with _id added by MongoDB:
{
  "data": [
    {
      "_id": "64f1a2b3c4d5e6f7a8b9c0d1",
      "title": "Ejemplo de titular extraído de El País",
      "description": "Breve descripción del artículo tal como aparece en la portada.",
      "author": "Nombre Apellido",
      "link": "https://elpais.com/seccion/2024-01-15/articulo.html",
      "portrait": "https://imagenes.elpais.com/resizer/abc123.jpg",
      "newsletter": "El País",
      "createdAt": "2024-01-15T10:30:00.000Z"
    },
    {
      "_id": "64f1a2b3c4d5e6f7a8b9c0d2",
      "title": "Titular scrapeado de El Mundo",
      "description": "",
      "author": "",
      "link": "https://www.elmundo.es/seccion/articulo.html",
      "portrait": null,
      "newsletter": "El Mundo",
      "createdAt": "2024-01-15T10:30:00.000Z"
    }
  ],
  "error": null
}
portrait may be null for some articles. El País and El Mundo only include images in article cards when the image is present in the listing page’s HTML — articles that require navigating to the detail page to load an image will have a null or empty portrait.
You can also exercise the other endpoints:
# Create a custom news item
curl -X POST http://localhost:3001/feed \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My Custom News",
    "description": "A manually added news item.",
    "author": "Jane Doe",
    "link": "https://example.com/news/1",
    "portrait": "https://example.com/image.jpg",
    "newsletter": "Custom"
  }'

# Search by title (case-insensitive, partial match)
curl -X POST http://localhost:3001/feed/search \
  -H "Content-Type: application/json" \
  -d '{ "searchValue": "Custom" }'

# Get a single feed by MongoDB ObjectId
curl http://localhost:3001/feed/<id>

# Update a feed by ID
curl -X PUT http://localhost:3001/feed/<id> \
  -H "Content-Type: application/json" \
  -d '{ "title": "Updated Title" }'

# Delete a feed by ID
curl -X DELETE http://localhost:3001/feed/<id>
Running the test suites — both backend and frontend ship with Jest. Navigate into the respective folder and run:
# Backend (Jest + SuperTest integration tests)
cd backend && npm run test

# Frontend (Jest + React Testing Library)
cd frontend && npm run test

Running Without Docker

If you want to run the backend and frontend directly on your host — for example to get faster hot-reload iteration — you will need a running MongoDB instance accessible at mongodb://localhost:27017. Backend:
cd backend
npm install
# Set env vars (or create a .env file in the backend folder)
export PORT=3001
export MONGO_URI=mongodb://localhost:27017/feed-db
npm run dev
npm run dev uses nodemon to watch src/server.ts and restart on changes. Frontend:
cd frontend
npm install
# Ensure the backend URL is set
echo "VITE_BACKEND_BASE_URI=http://localhost:3001/feed" > .env
npm run dev
Vite starts on http://localhost:5173 by default in dev mode (not port 3000, which is the Docker-served production build). Update VITE_BACKEND_BASE_URI accordingly if the backend runs on a different address.

Build docs developers (and LLMs) love