Skip to content

RESTful API for social media built with Node.js and MySQL

Notifications You must be signed in to change notification settings

carpodok/node-mysql-social-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node MySQL Social App

This project is a RESTful API for a social media platform built using Node.js and MySQL. It supports user authentication with JWT and provides core social media functionalities like user management, posting, and interactions (followers). The project follows a structured MVC architecture, with routes, controllers, and configuration files. Additionally, Swagger is used for documenting the API. This repository is designed to offer scalable and maintainable solutions for social media applications.

Endpoints

Below is an overview of the available endpoints and their functionalities.

  • To explore the Swagger UI schema and view available endpoints, navigate to http://localhost:3000/api-docs after running the server.
  • You can also test these endpoints via this Postman collection

auth comments likes posts relationships stories users

Key Features

This project implements the following key features to ensure a robust, secure, and scalable web application:

  • CRUD Operation: Full implementation of Create, Read, Update, and Delete functionalities for users, posts, stories and interactions.
  • JWT-Based Authentication: Secure user authentication using JSON Web Tokens (JWT) to manage user sessions.
  • Password Hashing: Secure password storage with hashing using the bcryptjs package.
  • Server-Side Validation: Input validation using the express-validator package to ensure data integrity and security.
  • Pagination: Implemented pagination for efficient result retrieval in larger datasets.
  • API Documentation: Integrated Swagger for easy and structured API documentation, improving developer experience and collaboration.

Installation

  1. Clone the repository
  git clone https://github.com/carpodok/node-mysql-social-app.git
  1. Navigate to the project directory:
 cd node-mysql-social-app
  1. Install required dependencies
 npm install

Configuration

  1. Creat a .env file on the root of the project and add the following environment variables.
PORT=3000
JWT_SECRET ="your-jwt-secret"

DB_HOST = "localhost"
DB_USER = "root"
DB_PASSWORD = "your-mysql-password"
DB_NAME="your-db-name"

Running the Application

  1. To start the server, run the following command on the root of the project path;
npm start

For the development purpose;

npm run dev
  1. The application will be running on http://localhost:3000

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or suggestions.

License

This project is licensed under the MIT License.

About

RESTful API for social media built with Node.js and MySQL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published