NewsCurator is a personalized news platform that delivers trending articles filtered by user interests (e.g., tech, science, etc.). This repository contains the backend server powering NewsCurator, built with Node.js, Express, and TypeScript. It integrates with NewsAPI for fetching news, manages data with Prisma ORM on a MySQL database, and uses JWT for secure authentication.
Table of Contents
The NewsCurator backend handles all server-side operations, including:
-
User Management & Authentication:
- Secure sign-up and sign-in using JWT tokens.
-
News Aggregation:
- Fetches trending news articles from NewsAPI and supports pagination.
-
Filtering & Bookmarking:
- Enables filtering by predefined tags or custom text and manages user bookmarks.
-
Profile & Session Management:
- Allows users to view personal details and securely log out.
By leveraging Express with TypeScript and Prisma, the backend provides a robust, type-safe, and scalable environment for NewsCurator.
- Node.js: JavaScript runtime.
- Express.js: Web framework for building RESTful APIs.
- TypeScript: Provides type safety and improved code quality.
- Prisma: ORM for managing MySQL database interactions.
- MySQL: Relational database for persistent data storage.
- JWT: Authentication using JSON Web Tokens.
- Axios: Used for fetching data from NewsAPI.
Ensure you have the following installed:
-
Clone the Repository:
git clone https://github.com/jlokitha/NewsCurator-Backend.git cd NewsCurator-Backend
-
Install Dependencies:
npm install
-
Create MySQL Database:
npx prisma db push
-
Generate Prisma Client:
npx prisma generate
Create a .env
file in the project root and configure the following variables:
# MySQL connection string
DATABASE_URL="mysql://USER:PASSWORD@HOST:PORT/DATABASE_NAME"
# Base URL for API requests
BASE_URL="http://localhost:3000"
# JWT Secret Keys
SECRET_KEY="your_jwt_secret_key"
REFRESH_TOKEN="your_refresh_token_secret"
# News API Key
NEWS_API_KEY="your_news_api_key"
To start the development server with live reload, run:
npm start
This command uses nodemon to monitor changes and restart the server automatically.
Detailed API endpoint documentation is available via our Postman collection.
Access it here.
For a complete view of the project, check out the NewsCurator Frontend repository on GitHub here.
This project is licensed under the MIT License.
© 2025 Janindu Lokitha