Welcome to the E-Commerce Microservices Application! This document serves as a guide to understanding the structure, components, and setup of our e-commerce application, which is built using a microservices architecture, follows the layered architecture pattern, and utilizes Apollo GraphQL Federation for seamless integration.
- Introduction
- Technologies
- Architecture
- Services
- Getting Started
- Configuration
- Running the Application
- GraphQL Federation
- License
Our e-commerce application is designed to provide a scalable and modular solution for online retail. It employs microservices to break down complex functionalities into smaller, manageable services. Each service is responsible for a specific domain, such as User Management, Product Catalog, Order Processing, and Mail Notifications.
- TypeScript: A typed superset of JavaScript that compiles to plain JavaScript.
- Amazon S3: Object storage service offered by Amazon Web Services.
- Apollo GraphQL: A comprehensive toolset for building GraphQL applications.
- Mailgun: Email automation and delivery platform.
- dotenv: Zero-dependency module for loading environment variables.
- Express.js: Web application framework for Node.js.
- MongoDB: NoSQL database program.
- Git: Distributed version control system.
- GitHub: Web-based platform for version control and collaboration.
- GraphQL: A query language for APIs.
- RabbitMQ: Open-source message broker software.
The application follows a microservices architecture, promoting loose coupling and independent deployment of services. It is structured around the layered architecture pattern, ensuring a clear separation of concerns. The front-end communicates with the back-end services through GraphQL APIs provided by Apollo Federation.
Our application consists of the following microservices:
- User Service: Manages user profiles, authentication, and authorization.
- Product Service: Handles the product catalog, inventory, category and details.
- Order Service: Facilitates order placement, processing, and tracking.
- Mail Service: Responsible for sending notifications and order-related emails.
Each service is self-contained and communicates with other services as needed.
To set up the application locally, follow these steps:
- Clone the repository:
git clone https://github.com/capstone-bazaar/e-commerce-api
- Navigate to the project directory:
cd e-commerce-api
- Install dependencies for each service:
cd <service-folder> && npm install
- Repeat step 3 for all services and
Gateway
. - Configure environment variables (see Configuration).
- Install RabbitMQ.
- Start each service (see Running the Application).
Each service has its own configuration requirements. Create .env.development
file for each service. Refer to the respective service's .env.example
file for configuration details. Common configurations include database connections, API keys, and service ports.
To run the application locally:
- Start services using
npm run start-services:dev
in the root directory. - Start the gateway in a separate terminal using
npm run start-gateway:dev
.
We utilize Apollo GraphQL Federation to unify the GraphQL schema across services. This enables us to compose a holistic API while maintaining the autonomy of individual services. The federated schema is available at the designated gateway service.
Our application is licensed under the MIT License. Make sure to review the terms before using or contributing to the project.
Thank you for your interest in our E-Commerce Microservices Application! If you have any questions or need further assistance, feel free to contact us or open an issue in the repository. Happy coding!