https://github.com/shivamkumar24/idea-clan-social-media
This is a backend server application for a basic social media platform built with Node.js, Express, MongoDB, and GraphQL.
https://github.com/shivamkumar24/idea-clan-social-media
axios bcrypt chakra-ui cors dotenv express-graphql expressjs graphql jsonwebtoken mongoose nodejs nodemon react react-icons react-router-dom
Last synced: 20 days ago
JSON representation
This is a backend server application for a basic social media platform built with Node.js, Express, MongoDB, and GraphQL.
- Host: GitHub
- URL: https://github.com/shivamkumar24/idea-clan-social-media
- Owner: shivamkumar24
- Created: 2024-03-16T05:18:03.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-17T10:08:39.000Z (about 1 year ago)
- Last Synced: 2025-02-17T22:34:38.465Z (4 months ago)
- Topics: axios, bcrypt, chakra-ui, cors, dotenv, express-graphql, expressjs, graphql, jsonwebtoken, mongoose, nodejs, nodemon, react, react-icons, react-router-dom
- Language: JavaScript
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Social Media API
This is a backend server application for a basic social media platform built with Node.js, Express, MongoDB, and GraphQL.
## Table of Contents
1. [Introduction](#introduction)
2. [Features](#features)
3. [Setup](#setup)
4. [Endpoints](#endpoints)
5. [GraphQL](#graphql)
6. [Authentication](#authentication)
7. [Dependencies](#dependencies)
8. [License](#license)## Introduction
The Social Media API provides basic functionalities for user registration, authentication, posting content, following/unfollowing users, and retrieving posts. It is built using Node.js and Express framework, with MongoDB as the database. GraphQL is integrated for querying user profiles and posts.
## Features
- User registration and authentication
- Posting content (text-based)
- Following and unfollowing other users
- Retrieving user posts and following users' posts
- GraphQL endpoint for querying user profiles and posts## Setup
1. Clone the repository: `git clone `
2. Install dependencies: `npm install`
3. Set up environment variables by creating a `.env` file and defining the following variables:
- PORT=3000
- MONGODB_URI=
- JWT_SECRET=4. Start the server: `npm start`
## Endpoints
### User Endpoints
- `POST /register`: Register a new user
- `POST /login`: Login an existing user
- `GET /allusers`: Get all users
- `GET /user/posts/:userId`: Get posts for a specific user by userID
- `GET /following/posts/:userId`: Get posts including those posted by users the current user is following
- `POST /follow`: Follow a user
- `POST /unfollow`: Unfollow a user### Post Endpoints
- `POST /post`: Create a new post
## GraphQL
The GraphQL endpoint is available at `/graphql`. You can use GraphiQL to explore the schema and execute queries.
## Authentication
Authentication is implemented using JSON Web Tokens (JWT). When a user registers or logs in, a JWT token is generated and sent back to the client. This token should be included in the authorization header for protected routes.
## Dependencies
- express
- mongoose
- bcryptjs
- jsonwebtoken
- express-graphql (for GraphQL endpoint)
- dotenv (for environment variables)
- cors