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.
- 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.
- Backend: Node.js, Express
- Database: MongoDB
- Data Modeling: Mongoose
- Authentication: JWT, bcryptjs
- Environment Variables: dotenv
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.
- Node.js (version 16 or higher)
- MongoDB (running locally or a cloud instance)
-
Clone the repository:
git clone https://github.com/Mohammed-Khaledx/sparky-platform.git -
Navigate to the server directory:
cd Mohammed-Khaledx-sparky-platform/server -
Install dependencies:
npm installoryarn install -
Create a
.envfile in theserverdirectory 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
npm startoryarn start(uses nodemon for automatic restarts during development)
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.)
- Implement more advanced notification features (e.g., real-time updates using WebSockets).
- Implement image/video upload functionality for posts.
Contributions are welcome! Please fork the repository and submit pull requests.