Skip to content

NewsCurator backend is built with Node.js, Express, and TypeScript to deliver personalized, trending articles. It seamlessly integrates NewsAPI, Prisma ORM, MySQL, and secure JWT authentication.

License

Notifications You must be signed in to change notification settings

jlokitha/NewsCurator-Backend

Repository files navigation

NewsCurator Backend


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

Overview

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.


Tech Stack

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

Getting Started

Prerequisites

Ensure you have the following installed:

Installation

  1. Clone the Repository:

    git clone https://github.com/jlokitha/NewsCurator-Backend.git
    cd NewsCurator-Backend
  2. Install Dependencies:

    npm install
  3. Create MySQL Database:

    npx prisma db push
  4. Generate Prisma Client:

    npx prisma generate

Environment Variables

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"

Development

To start the development server with live reload, run:

  npm start

This command uses nodemon to monitor changes and restart the server automatically.


API Documentation

Detailed API endpoint documentation is available via our Postman collection.
Access it here.


Frontend Repository

For a complete view of the project, check out the NewsCurator Frontend repository on GitHub here.


License

This project is licensed under the MIT License.



© 2025 Janindu Lokitha


About

NewsCurator backend is built with Node.js, Express, and TypeScript to deliver personalized, trending articles. It seamlessly integrates NewsAPI, Prisma ORM, MySQL, and secure JWT authentication.

Topics

Resources

License

Stars

Watchers

Forks