Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/exploring-solver/stuneckt_assignment
This project's goal is to build API endpoints for a microblogging platform like Twitter / LinkedIn where users can post content and follow each other.
https://github.com/exploring-solver/stuneckt_assignment
express javascript mongodb nextjs nodejs typescript
Last synced: about 2 months ago
JSON representation
This project's goal is to build API endpoints for a microblogging platform like Twitter / LinkedIn where users can post content and follow each other.
- Host: GitHub
- URL: https://github.com/exploring-solver/stuneckt_assignment
- Owner: exploring-solver
- License: mit
- Created: 2024-05-07T05:27:26.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-11T16:24:37.000Z (7 months ago)
- Last Synced: 2024-06-12T16:55:38.527Z (7 months ago)
- Topics: express, javascript, mongodb, nextjs, nodejs, typescript
- Language: JavaScript
- Homepage: https://stuneckt-assignment.onrender.com
- Size: 877 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Stuneckt - Microblogging Platform API
## Project Overview
This project aims to build API endpoints for a microblogging platform similar to Twitter or LinkedIn. Users can post content and follow each other. The backend is implemented in [Node.js](https://nodejs.org/) using [Express.js](https://expressjs.com/) framework, and data is stored in a [MongoDB](https://www.mongodb.com/) database and NextJs and TypeScript is used for Frontend.
## Features
- **User Management**: CRUD operations for user profiles.
- **Post Management**: CRUD operations for user posts.
- **Followers**: Ability to follow/unfollow users.
- **Pagination**: Paginated endpoints for posts and followers.
- **Error Handling**: Robust error handling for API endpoints.
- **Mock Data Feeder Script**: A script to feed mock data into the database.## Setup Instructions
1. Clone the repository: `git clone https://github.com/exploring-solver/Stuneckt_assignment.git`
2. Install dependencies for client: `cd client` `npm install`
2. Install dependencies for server: `cd client` `npm install`
3. Set up environment variables: Create a `.env` file in the root directory as per the format of `.env.example` file
4. Start the server: `npm run dev`
4. Start the client: `npm run dev`
5. The server should now be running on `http://localhost:5000`.
5. The client should now be running on `http://localhost:3000`.## API Endpoints
- `GET /api/users`: Get all users.
- `GET /users/api/v1/user/details`: Get logged in user's details.
- `GET /users/:username`: Get a user's details deom username.
- `POST /users/api/v1/signup`: Create a new user.
- `POST /users/api/v1/login`: Login a user.
- `POST /users/create-mock-users`: Create mock users.
- `PUT /api/users/`: Update a user.- `GET /posts/api/v1/posts`: Get all posts.
- `GET /posts/api/v1/posts/user`: Get logged in user's Posts.
- `GET /posts/api/v1/posts/user/:username`: Get a perticular user's Posts.
- `POST /posts/api/v1/posts`: Create a new post.
- `PUT /api/posts/:id`: Update a post.
- `GET /posts/api/v1/posts?page=M&limit=N`: Get Paginated posts from M to N.- `GET /follow/followcount/:username`: Get all followers count of a user.
- `GET /follow/follower/:username`: Get all followers of a user.
- `GET /follow/following/:username`: Get all following of a user.
- `POST /follow/follow/:username`: Follow a user.
- `DELETE /follow/unfollow/:username`: Unfollow a user.## Mock Data Feeder Script
To use the mock data feeder script, go to following route:
Authorization Required
POST: /users/create-mock-usersThis will populate the database with mock users and posts for testing purposes.
## Minimal Frontend to Showcase the API
![Screenshot 2024-05-12 235532](https://github.com/exploring-solver/Stuneckt_assignment/assets/123443485/c1d7c9b0-2677-49cb-9056-ebc12baa1dcc)
![image](https://github.com/exploring-solver/Stuneckt_assignment/assets/123443485/7bcd9659-043a-42e5-a8ce-273eb83df0fa)## Technologies Used
- Next.js
- TypeScript
- Node.js
- Express.js
- MongoDB
- JavaScript## Deployment
The backend is deployed on [Vercel](https://stuneckt-assignment-c16d.vercel.app/) and can be accessed at [API Base URL (Render)](https://stuneckt-assignment.onrender.com).
## Contributors
- Aman Sharma (@exploring-solver)