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.

DailyNews is a full-stack news aggregator that automatically scrapes the top five latest headlines from two of Spain’s most-read newspapers — El País and El Mundo — and delivers them through a clean REST API. Beyond automated scraping, it gives you full CRUD control over a MongoDB-backed feed, letting you create, read, update, and delete custom news items alongside the scraped ones. Whether you’re a developer exploring Domain-Driven Design in a real-world Node.js project, or looking for a reference architecture for a React + Express + MongoDB stack, DailyNews is designed to be readable, testable, and ready to extend.

What You Get

Automated Web Scraping

On every GET /feed request, Cheerio scrapes the top 5 articles from El País (elpais.com) and El Mundo (elmundo.es) in real time — no cron jobs or background workers required.

Full CRUD REST API

Express routes cover every operation: list all feeds, get by ID, create, update by ID, delete by ID, and search by title. All responses are JSON.

React Frontend

A Vite-powered React app connects to the API and provides an interactive UI for browsing scraped news and managing custom items, styled with Tailwind CSS.

One-Command Docker Deployment

A single docker-compose up --build spins up the frontend (port 3000), backend (port 3001), and a MongoDB container — fully wired together with no manual setup.

Tech Stack

Backend

TechnologyRole
Node.js + TypeScriptRuntime and type-safe application code
ExpressHTTP server and routing (src/app.ts, src/api/routes.ts)
MongooseODM for MongoDB — schema definition and database queries
CheerioServer-side HTML parsing for scraping El País and El Mundo
dotenvEnvironment variable loading (PORT, MONGO_URI)
Jest + SuperTestUnit and integration (API-level) testing
ESLint + PrettierCode quality and consistent formatting

Frontend

TechnologyRole
React 18 + TypeScriptComponent-based UI with strong typing
ViteFast dev server with hot module replacement and optimised production builds
React Router DOMClient-side routing between views
Tailwind CSSUtility-first styling — no component library dependencies
Jest + React Testing LibraryComponent unit tests in a jsdom environment
ESLint + PrettierCode quality and consistent formatting

Project Structure

The repository is split into three top-level concerns: the Express backend, the React frontend, and the Docker Compose file that ties them together with MongoDB.
DailyNews/
├── backend/
│   ├── src/
│   │   ├── api/
│   │   │   ├── controllers/       # Express request handlers (feedController)
│   │   │   ├── routes.ts          # Route definitions (GET/POST/PUT/DELETE /feed)
│   │   │   └── apiConstants.ts    # Shared HTTP status constants
│   │   ├── application/
│   │   │   └── services/
│   │   │       ├── FeedService.ts      # Orchestrates CRUD + scraping
│   │   │       └── ScrapperService.ts  # Delegates to a scrapper implementation
│   │   ├── domain/
│   │   │   └── model/
│   │   │       └── Feed.ts        # Feed interface + FeedDTO class
│   │   ├── infrastructure/
│   │   │   ├── database/
│   │   │   │   └── connect.ts     # Mongoose connection helper
│   │   │   └── repositories/
│   │   │       ├── feed/
│   │   │       │   ├── FeedRepository.ts          # Mongoose implementation
│   │   │       │   ├── FeedRepositoryInterface.ts # CRUD contract
│   │   │       │   └── FeedODMModel.ts            # Mongoose schema/model
│   │   │       └── scrapper/
│   │   │           ├── ScrapperRepositoryInterface.ts
│   │   │           ├── elpais/
│   │   │           │   └── ElPaisScrapperRepository.ts
│   │   │           └── elmundo/
│   │   │               └── ElMundoScrapperRepository.ts
│   │   ├── app.ts                 # Express app setup (middleware, CORS, routes)
│   │   └── server.ts              # Entry point — connects DB then starts server
│   ├── Dockerfile
│   └── package.json
├── frontend/
│   ├── src/
│   │   ├── components/            # Page-level React components (NewsHome, NewsList, NewsDetail, NewsSearch)
│   │   ├── context/               # React context providers (ToastContext)
│   │   ├── customHooks/           # Shared hooks (useDebounce, useFeedManagement)
│   │   ├── icons/                 # Inline SVG icon components
│   │   ├── ui/                    # Reusable UI primitives (Header, Modal, Toast, MultiTool)
│   │   ├── utils/                 # API constants, helpers, and shared interfaces
│   │   ├── test/                  # Jest + React Testing Library test suites
│   │   └── main.tsx               # Vite entry point
│   ├── Dockerfile
│   └── package.json
└── docker-compose.yml
Scraping runs automatically on every GET /feed request — there is no scheduled cron job or background worker. Each call to the list endpoint fetches live headlines from El País and El Mundo, deduplicates them by URL against the database, and persists only new articles before returning the full combined feed.

Build docs developers (and LLMs) love