Skip to content

koredeowoblow/social-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Social API πŸš€

MIT License

A backend REST API for a social media application built using Node.js, Express, Sequelize, and MySQL.

This API handles user authentication, posts, likes, comments, notifications, and other core social features.


🌟 Features

βœ… User registration and login (with JWT)
βœ… Create, read, update, delete (CRUD) posts
βœ… Like and comment on posts
βœ… Follow and unfollow users
βœ… Notification system for likes, comments, follows
βœ… Sequelize ORM with MySQL database
βœ… Clean modular structure with separate models, controllers, routes


πŸ›  Tech Stack

  • Node.js
  • Express.js
  • Sequelize ORM
  • MySQL
  • JWT (JSON Web Tokens)
  • bcrypt (for password hashing)

πŸ“‚ Project Structure


/src
β”œβ”€β”€ config/         # Database configuration
β”œβ”€β”€ controllers/    # Request handlers
β”œβ”€β”€ middleware/     # Auth, validation middleware
β”œβ”€β”€ models/         # Sequelize models
β”œβ”€β”€ routes/         # API route definitions
└── app.js          # Main app entry point


βš™οΈ Setup Instructions

1️⃣ Clone the repository

git clone https://github.com/koredeowoblow/social-api.git
cd social-api

2️⃣ Install dependencies

npm install

3️⃣ Set up your .env file Create a .env file in the root:

PORT=5000
DB_HOST=localhost
DB_USER=your_mysql_user
DB_PASS=your_mysql_password
DB_NAME=social_media
JWT_SECRET=your_jwt_secret

4️⃣ Set up the database

  • Ensure your MySQL server is running.
  • Run Sequelize sync or migrations:

5️⃣ Start the server

npm run dev

Visit: http://localhost:5000



## πŸ“š API Endpoints (Core)

| Method | Endpoint                 | Description            |
| ------ | ------------------------ | ---------------------- |
| POST   | /api/auth/register       | Register new user      |
| POST   | /api/auth/login          | Login user             |
| GET    | /api/posts               | Get all posts          |
| POST   | /api/posts               | Create a new post      |
| POST   | /api/posts/\:id/like     | Like a post            |
| POST   | /api/posts/\:id/comment  | Comment on a post      |
| GET    | /api/users/\:id/follow   | Follow a user          |
| GET    | /api/users/\:id/unfollow | Unfollow a user        |
| GET    | /api/notifications       | Get user notifications |

πŸ“– API Documentation

Detailed API docs (with request/response samples) coming soon!


πŸ’‘ Contributing

Want to improve this project?

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

We welcome all contributions!


πŸ“„ License

This project is licensed under the MIT License.


✨ Author

Made with ❀️ by Shinaayomi Owolabi (koredeowoblow) LinkedIn | GitHub

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published