Welcome to my social media REST API, a Twitter-inspired backend project, designed and developed with versatility and robust functionality in mind.
- About the project
- Deploy
- Stack
- Database Diagram
- Clone
- Endpoints
- Future functionalities
- Contributions
- Development
- Appreciations
- Contact
The main idea for the project was recreating a social media and to be exact I had Twitter (now X) in mind. Constructed with the use of non-relational database technology (MongoDB in conjunction with the Mongoose library), this API gives birth to a social media application where users can engage, share, and interact through texts posts.
Our API boasts an array of features focused on delivering an engaging and seamless user experience. The core functionalities include:
-
User Management: Enabling users to register, log in, update their profile, and check out their personal details on their profile.
-
Post Management: Users can create, update, and delete their posts. They can also view their own posts as well as posts created by other users. The option to find a specific post adds an additional layer of navigation.
-
Interaction: Users can like or dislike posts to express their sentiments. A follow/unfollow feature is also available, allowing users to curate the posts they see based on their preferences.
-
Admin Control: Special functionalities are available exclusively for administrators and super administrators, ensuring streamlined content and community management.
-
In addition, the use of seeders offers a quick and efficient method for data insertion during a database refresh. Middleware support exists for implementing authentication processes such as tokenization.
With successfully achieving the development milestone and deploying the project to production, the next exciting step is creating a dynamic front-end view using React. This will not only enhance the user interface but also ensure a cohesive, interactive, and intuitive user experience!
Stay tuned for this exciting update! :)
Used technologies for the project:
- 1 Strong entitiy - Users (can exist by itself without depending on another entitiy).
- 1 Weak entitiy - Posts (depends on users, it must be written/posted by a user).
Even that we have a non relational database project, there is a relation between the posts and users as a post cannot exist by itself. A post can have likes such as user can have users that he/she follows and on the contrary users that are following.
- Clone the repository from the url:
git clone https://github.com/yoanastamenova/Social_media.git
- Connect the cloned repo with MongoDB
- If you dont have Mongo we can use already existing Mongo container from Docker with the following command:
docker run -d -p 27017:27017 --name mongo -v mongo_data:/data/db -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=root mongo:latest
npm install
(to get all the npm needed packages)npm run dev
to run our servernpm run seed
to fill our documents
Method | URI | Action | Auth | Body |
---|---|---|---|---|
POST | /api/auth/register | Register user | N/A (public) | { "email": "[email protected]", "password": "yourPassword" } |
POST | /api/auth/login | Login user | N/A (public) | { "email": "[email protected]", "password": "yourPassword" } |
Method | URI | Action | Auth | Body |
---|---|---|---|---|
GET | /api/users/all | View all users | Token (admin) | |
GET | /api/users/profile | View user profile | Token (user) | |
PUT | /api/users/profile/update | Update user profile | Token (user) | info to update |
GET | /api/users/email | Get user by email | Token (user) | "email": "[email protected]" |
DELETE | /api/users/:id | Delete user by id | Token (user) | |
PUT | /api/users/role | Update user role | Token (user) | "role": "admin" |
Method | URI | Action | Auth | Body |
---|---|---|---|---|
POST | /api/posts/create | Create post | Token (user) | |
DELETE | /api/posts/delete/:id | Delete post | Token (user) | |
PUT | /api/posts/update/:id | Update post | Token (user) | info to change |
GET | /api/posts/own | Get own posts | Token (user) | |
GET | /api/posts/all | Get all posts | Admin | |
GET | /api/posts/:id | Get post by id | Admin | |
GET | /api/users/posts/user/:id | Get posts by a user id | Admin |
Method | URI | Action | Auth | Body |
---|---|---|---|---|
POST | /api/posts/likePost/:id | Like/Dislike post by id | Token (user) |
Method | URI | Action | Auth | Body |
---|---|---|---|---|
POST | /api/users/followUnf/:id | Follow/Unfollow user from id | Token (user) |
Method | URI | Action | Auth | Body |
---|---|---|---|---|
GET | /api/users/timeline | Shows user timeline | Token (user) |
✅ Add timeline option
⬜ Add user biometrics
⬜ Include profile privacy options
Feel free to suggest an improvment or functionality to my project.
There are two ways of doing this:
- Opening an issue
- Creating a fork of the repository
- Creating a new branch
$ git checkout -b feature/yourUsername -feat
- Make a commit with your changes
$ git commit -m 'feat: this X thing'
- Make a push to the branch
$ git push origin feature/yourUsername -feat
- Opening a Pull Request
- Creating a new branch
const developer = "yoanastamenova";
console.log("Developed by: " + developer);
Forever gratefull to GeeksHubs Academy for the oportunety to learn and grow on my career path. <3