Skip to content

med260/sparky-platform

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sparky Platform - Social Networking Backend

Node.js Express MongoDB

Overview

Sparky Platform is a robust backend API designed to power a modern social networking experience. Built with Node.js, Express, and MongoDB, it provides a solid foundation for handling user authentication, post management, social interactions, and real-time notifications. This project emphasizes scalability, maintainability, and security, providing a performant and reliable backend infrastructure.

Key Features

  • User Authentication and Authorization: Secure user registration, login, and authorization using JWT (JSON Web Tokens) and bcryptjs for password hashing.
  • Post Management: Comprehensive functionality for creating, retrieving, updating, and deleting posts, including pagination for efficient data handling.
  • Social Interactions: Core social features such as following/unfollowing users, retrieving follower/following lists, and managing "sparks" (likes).
  • Real-time Notifications: Integrated notification system to alert users of new follows, sparks, and comments, enhancing user engagement.
  • RESTful API: Well-defined RESTful API endpoints for seamless integration with frontend applications.
  • Error Handling: Robust error handling and logging to ensure application stability and facilitate debugging.

Tech Stack

  • Backend: Node.js, Express
  • Database: MongoDB
  • Data Modeling: Mongoose
  • Authentication: JWT, bcryptjs
  • Environment Variables: dotenv

Architecture

Sparky Platform follows a modular architecture, separating concerns into distinct components:

  • Routes: Define API endpoints and handle routing requests to appropriate controllers.
  • Controllers: Implement the application's business logic, handling requests and interacting with models.
  • Models: Define data schemas and interact with the MongoDB database using Mongoose.
  • Middlewares: Handle authentication, authorization, error handling, and other cross-cutting concerns.

Setup and Installation

Prerequisites

  • Node.js (version 16 or higher)
  • MongoDB (running locally or a cloud instance)

Installation

  1. Clone the repository: git clone https://github.com/Mohammed-Khaledx/sparky-platform.git

  2. Navigate to the server directory: cd Mohammed-Khaledx-sparky-platform/server

  3. Install dependencies: npm install or yarn install

  4. Create a .env file in the server directory and configure the following environment variables:

    MONGODB_URI=mongodb://127.0.0.1:27017/sparky_platfrom_db # Your MongoDB connection string
    JWT_SECRET=YOUR_JWT_SECRET                          # A secret key for JWT signing
    

Running the Server

  • npm start or yarn start (uses nodemon for automatic restarts during development)

API Endpoints (Examples)

  • POST /users/register: Register a new user.
  • POST /users/login: Log in an existing user.
  • GET /users/:id: Get user information.
  • POST /posts: Create a new post.
  • GET /posts: Get all posts (with pagination).
  • POST /followOrUnfollow/:id/follow: Follow a user.
  • POST /followOrUnfollow/:id/unfollow: Unfollow a user.
  • ... more

(Refer to the API documentation or route files for a complete list of endpoints.)

Future Enhancements

  • Implement more advanced notification features (e.g., real-time updates using WebSockets).
  • Implement image/video upload functionality for posts.

Contributing

Contributions are welcome! Please fork the repository and submit pull requests.

About

Sparky - Full-stack social media app built with MEAN (MongoDB, Express, Angular, Node.js) stack.Designed to simulate a social network experience.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%