This project is a backend clone of LinkedIn, developed using Express.js. It's a simplified version of LinkedIn's actual backend, focusing on core functionalities such as profile management, experience handling, and post services.
- User Authentication and Authorization
- Profile Management
- Experience Management
- Posts Creation and Management
GET /me
: Get the current user's profileGET /:username
: Get a specific user's profilePOST /:username/picture
: Upload a profile picturePOST /
: Sign up a new userPUT /
: Update user profile
GET /:username/experiences
: Get experiences for a userPOST /:username/experiences
: Add an experiencePOST /:username/experiences/:expId/picture
: Upload a picture for a specific experience
POST /login
: Log in a userPOST /logout
: Log out the current userPOST /logoutAll
: Log out all sessions for the current userPOST /refreshToken
: Refresh authentication token
GET /:postId
: Get a specific postPOST /:postId/picture
: Upload a picture for a specific postGET /
: Get all postsPOST /:username
: Create a new postPUT /:postId
: Update a specific postDELETE /:postId
: Delete a specific post
To deploy this project, you need to set the following environment variables (values provided here are placeholders):
NODE_ENV
: Environment setting (e.g., development)PORT
: Port number for the server (e.g., 3003)JWT_SECRET
: Secret key for JWT authenticationREFRESH_JWT_SECRET
: Secret key for JWT refresh token
To set up and run the LinkedIn Clone Backend, follow these steps:
-
Clone the repository to your local machine.
-
Install the necessary dependencies by running: npm install
-
Set up the required environment variables. Create a
.env
file in the root directory and include the following: NODE_ENV=development PORT=3003 JWT_SECRET=your_jwt_secret REFRESH_JWT_SECRET=your_refresh_jwt_secret -
To start the server, you have several script options defined in your
package.json
:
-
To run tests:
npm run test
-
For development, using nodemon for automatic server restarts on code changes:
npm run dev
-
To debug the application:
npm run debug
-
To start the server in production mode:
npm start
Replace the JWT secret values with your own secure keys.
Free for usage, give proper credit.