Install Required Dependencies

Install the packages required for the application.

We will use the following dependencies:

  • express: Backend web framework.
  • mongoose: MongoDB object modeling library.
  • dotenv: Loads environment variables.
  • cors: Configures cross-origin browser access.
  • helmet: Sets security-related HTTP headers.
  • express-rate-limit: Protects HTTP endpoints against excessive requests.
  • zod: Validates request payloads.
  • jsonwebtoken: Signs and verifies JWT tokens.
  • bcryptjs: Hashes user passwords.

Install them using npm.

Install Production Dependencies

npm install express mongoose dotenv cors helmet express-rate-limit zod jsonwebtoken bcryptjs

Installs the core framework, database integration, security, validation, and authentication dependencies.

Key Takeaways
  • Express handles HTTP requests.

  • Mongoose provides MongoDB integration.

  • Zod validates incoming request data.

  • JWT and bcryptjs provide authentication-related functionality.