MLSAKIIT / devblogs-backend

DevBlogs : A blogging website made for developers by developers. This repository contains the backend for the project
MIT License
3 stars 14 forks source link
authentication backend beginner-friendly express expressjs full-stack hacktoberfest hacktoberfest2024 jwt jwt-authentication mongodb mongoose mvc mvc-architecture nodejs

DevBlogs Backend

Overview

This is the backend API for DevBlogs, a Full Stack Blogging site for Developers by Developers. It's part of the MLSA HACKTOBER 2024: WEBDEV project.

Tech Stack

Features

  1. User authentication and authorization
  2. Blog post creation and retrieval
  3. Pagination for blog posts
  4. Request body validation
  5. Rate limiting
  6. CORS protection

Prerequisites

Getting Started

  1. Clone the repository to your local machine.
  2. Navigate to the backend directory of the project.
  3. Install the required dependencies:
    npm install

    or

    yarn install
  4. Set up your environment variables:
    • Create a .env file in the backend directory.
    • Add necessary variables such as MONGODB_URI and JWT_SECRET.
  5. Start the server:
    npm run dev

    or

    yarn dev
  6. The backend should now be running, typically on http://localhost:3000.

Installation with Docker

  1. Clone the repository:

    git clone https://github.com/MLSAKIIT/devblogs-backend.git
  2. Navigate to the project directory:

    cd devblogs-backend
  3. Configure your .env file:

    Before running Docker, ensure you have correctly set up your environment variables.

  4. Run the following command to start the application:

    docker compose up -d   

Folder Structure

.
├── controllers/
│   └── auth.js
├── index.js
├── models/
│   ├── Blogs.js
│   └── User.js
├── package.json
├── routes/
│   ├── auth.js
│   └── blog.js
└── utils/
    └── jwtHelper.js

API Routes

For detailed API documentation, refer to the Swagger documentation (to be implemented).

Contributing

We welcome contributions to improve this project! Here's how you can contribute:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Issues & Features

Check the main project documentation for a list of current issues and tasks for the backend.

References