Welcome to the Twitter Backend project! This Node.js application aims to resemble the backend functionality of the popular social media platform Twitter. It provides essential features for users, tweets, and authentication.
To get started with the Twitter Backend project, follow these steps:
- Clone the repository:
git clone https://github.com/saad662/twitter-backend.git
- Navigate to the project directory:
cd twitter-backend
- Install the project dependencies:
npm install
To run the Twitter Backend application, use the following command:
npm run dev
This command starts the development server using nodemon and listens on http://localhost:3000
. You can access the application by opening this URL in your web browser or making API requests.
The project includes a config
folder where you can configure various settings. Make sure to update these configurations according to your requirements:
config/authConfig.ts
: Configure your secret key for JSON Web Tokens (JWT) and other authentication settings.config/sendgridConfig.ts
: Configure your SendGrid API key for sending email notifications.
The Twitter Backend project includes the following API routes:
/user
: User-related endpoints./tweet
: Tweet-related endpoints./auth
: Authentication-related endpoints.
You can find the route definitions in the respective route files located in the routes
folder.
The application uses middleware for authentication. The authenticateToken
middleware is applied to routes that require authentication. You can find this middleware in the middlewares/authMiddleware.ts
file.
The project uses several dependencies, which are listed in the package.json
file:
- @prisma/client: Prisma Client for database interaction.
- @sendgrid/mail: SendGrid library for sending email notifications.
- express: Web framework for building the API.
- jsonwebtoken: Library for working with JSON Web Tokens (JWT).
- @types/express: Type definitions for Express.
- @types/jsonwebtoken: Type definitions for JSON Web Tokens.
- @types/node: Type definitions for Node.js.
- nodemon: Utility for restarting the server during development.
- prisma: Prisma CLI for database migrations and management.
- ts-node: TypeScript execution environment.
- typescript: TypeScript language support.
If you'd like to contribute to this project, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature-name
orgit checkout -b bugfix/your-bug-fix
. - Make your changes and commit them:
git commit -m "Your commit message here"
. - Push your changes to your fork:
git push origin feature/your-feature-name
. - Open a pull request to the
main
branch of the original repository.
This project is licensed under the ISC License. See the LICENSE file for details.
Thank you for using Twitter Backend! If you have any questions or encounter any issues, please feel free to open an issue. Happy coding!