1. Project Description:
This repository serves as the backend for the Tech Freak e-commerce web application. It handles functionalities like:
- User authentication and management (signup, login, password reset)
- Product data management (CRUD operations)
- Order processing
- Email notifications
2. Technologies:
- Node.js: https://nodejs.org/en - Open-source, cross-platform JavaScript runtime environment for building server-side and networking applications.
- Express.js: https://expressjs.com/ - A popular web framework for Node.js that provides a robust set of features for building web applications and APIs.
- MongoDB: https://www.mongodb.com/ - A NoSQL document database that offers flexible data storage and retrieval capabilities.
- Mongoose: https://www.mongodb.com/developer/languages/javascript/getting-started-with-mongodb-and-mongoose/ - An object data modeling (ODM) library for MongoDB in Node.js, providing a convenient way to interact with the database using JavaScript objects.
- JWT (JSON Web Token): https://jwt.io/ - An open standard (RFC 7519) for representing claims secured by cryptographic signatures. Used for secure information transmission between parties, often in the context of authentication and authorization.
- Nodemailer: https://github.com/nodemailer/nodemailer - A popular Node.js library for sending emails.
- Stripe: https://stripe.com/ - A payment processing platform that allows businesses to accept online payments.
3. Security Features:
- Rate limiting: Implemented to prevent malicious overuse of the API and protect against denial-of-service attacks.
- CORS (Cross-Origin Resource Sharing) handling: Ensures secure communication between the frontend and backend, preventing unauthorized cross-origin requests.
- Robust error handling: Provides informative error messages for troubleshooting and prevents unexpected application crashes.
- CSRF (Cross-Site Request Forgery) protection: Mitigates the risk of unauthorized actions being performed on a user's account by an attacker.
4. Frontend:
This backend is designed to work seamlessly with the corresponding frontend repository: https://github.com/duske953/ecommerce-frontend.
Prerequisites:
- Node.js and npm (or yarn) installed on your machine.
Installation:
- Clone this repository.
- Navigate to the project directory.
- Run
npm install
(oryarn install
) to install all required dependencies.
Configuration:
- Create a
.env
file in the project root directory. - Add environment variables for sensitive information like:
- Database connection details (URI, username, password)
- JWT secret key
- Stripe API keys
6. Important Note:
- This project is intended solely for demonstration purposes. Please note that while Stripe integration is included, it is not intended for real-world transactions and should not be used in a production environment.
7. Additional Notes:
- Refer to the official documentation of each technology listed above for detailed usage and configuration information.
- The backend architecture utilizes:
- Express.js for building the RESTful API.
- Mongoose for interacting with the MongoDB database.
- JWT for user authentication and authorization.
- Nodemailer for sending email notifications.
- Stripe for payment processing