Skip to content

vivekbagal74/News-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

News App

A simple and responsive News App that fetches real-time news articles from various sources and displays them to users. This app is split into two main parts:

  • Frontend: A user interface for displaying news articles and interacting with the backend.
  • Backend: A server that handles requests to fetch news data from APIs.

Project Structure

News-App/
├── backend/               # The backend directory (API server)
│   ├── .env               # Environment variables (e.g., API keys, DB credentials)
│   ├── .gitignore         # Git ignore file for backend
│   ├── dbConnect.js       # Database connection logic
│   ├── models/            # Models for database schemas
│   │   ├── NewsItem.js    # Model for news items
│   │   └── UserModel.js   # Model for user data
│   ├── package-lock.json  # Backend package lock
│   ├── package.json       # Backend dependencies
│   ├── routes/            # API route definitions
│   │   ├── newsRoute.js   # Route for news-related requests
│   │   └── userRoute.js   # Route for user-related requests
│   ├── server.js          # Main server file (Node.js/Express)
│   └── vercel.json        # Vercel deployment configuration
│
├── frontend/              # The frontend directory (UI)
│   ├── .env               # Environment variables (e.g., API endpoint)
│   ├── .gitignore         # Git ignore file for frontend
│   ├── package-lock.json  # Frontend package lock
│   ├── package.json       # Frontend dependencies
│   ├── postcss.config.js  # PostCSS configuration for TailwindCSS
│   ├── public/            # Public assets
│   │   ├── index.html     # The main HTML file
│   │   └── news.png       # Image asset
│   ├── src/               # Source code for frontend
│   │   ├── App.css        # Global styles
│   │   ├── App.js         # Main component for frontend
│   │   ├── components/    # Reusable UI components
│   │   │   ├── Layout.js  # Layout component
│   │   │   ├── SideBar.js # Sidebar component
│   │   │   └── Spinner.js # Spinner component
│   │   ├── config/        # Configuration files
│   │   │   └── config.js  # API config and settings
│   │   ├── index.css      # Global styles
│   │   ├── index.js       # Entry point for React (if using React)
│   │   ├── pages/         # React pages/components
│   │   │   ├── AddNews.js        # Page for adding news
│   │   │   ├── EditNews.js       # Page for editing news
│   │   │   ├── HomePage.js       # Home page of the app
│   │   │   ├── LandingPage.js    # Landing page
│   │   │   ├── NewsDesc.js       # News description page
│   │   │   ├── PostedNewsItems.js # Page showing posted news
│   │   │   └── Profile.js        # User profile page
│   │   └── pages/images/        # Images for pages
│   │       └── profile.png       # Profile image
│   └── tailwind.config.js  # Tailwind CSS configuration
│
├── .gitignore             # Global git ignore file
├── Readme.md              # Project documentation
└── app.js                 # Main entry point for the application (or backend entry point)

Features

  • Real-time news fetching from multiple sources
  • Categorized news (Technology, Sports, Business, Entertainment, etc.)
  • Responsive and user-friendly interface
  • Search functionality to find specific news articles
  • Support for dark and light modes
  • Clean and modern design

Tech Stack

  • Frontend:
    • HTML, CSS, JavaScript (Vanilla, or you can use React/Vue)
  • Backend:
    • Node.js, Express.js
  • API Integration: News API (or any other news source API like Google News)

Installation

Frontend Setup

  1. Navigate to the frontend directory:
    cd frontend
  2. Install the frontend dependencies (if using Node.js, e.g., React):
    npm install
  3. Start the frontend development server:
    npm start
    You can now access the frontend in your browser (usually at http://localhost:3000).

Backend Setup

  1. Navigate to the backend directory:
    cd backend
  2. Install the backend dependencies:
    npm install
  3. Set up environment variables for the News API key. Create a .env file in the backend directory:
    API_KEY=your_news_api_key_here
    
  4. Start the backend server:
    npm start
    The backend will be available at http://localhost:5000 (or any port you've configured).

Running the Full App

  • Start the backend server first (npm start inside backend).
  • Then start the frontend server (npm start inside frontend).

Now, you should be able to access the full app, where the frontend fetches news from the backend.

API Usage

This app fetches news using a third-party API (e.g., News API). You need to sign up and get an API key to make requests.

  1. Go to the News API website.
  2. Sign up and get your API key.
  3. Replace the API key in the .env file located in the backend directory.

Demo

You can check out the live demo of the app here. (Link to the deployed app, if available).

Contributing

Contributions are welcome! Feel free to fork the repository, make improvements, and submit pull requests.

  1. Fork the repo
  2. Clone your forked repository
  3. Make your changes
  4. Commit and push to your fork
  5. Open a pull request to the main repository

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • News API for providing real-time news data
  • [Your favorite resources/tools]

### Key Updates:

* **Project Structure**: I added the structure of both the `frontend` and `backend` directories to help clarify the project setup.
* **Separate Setup Instructions**: Clear steps for setting up both the frontend and backend separately.
* **Environment Variables**: Instructions for adding the News API key to the backend.
* **Running the Full App**: Describes how to run both parts of the app together.

About

The News App is a web platform enabling users to read and share news articles. With features including user article posting, editing, and browsing, its frontend is developed with React.js.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors