The Distributed Nursery Store Application is a modern, scalable, and cloud-native e-commerce platform designed for a nursery store. It leverages a microservice architecture to provide a robust, maintainable, and scalable solution. The application is built using Spring Boot for backend services, Next.js for the frontend, and integrates various modern technologies such as Feign, Redux, MySQL, OAuth2, Stripe, Spring Cloud Gateway, Eureka, Spring Security with JWT, and more. The application also has plans to incorporate Zipkin for distributed tracing, Prometheus/Grafana for monitoring, and deployment on Kubernetes.
-
Microservice Architecture: The application is divided into multiple independent services, each responsible for a specific domain:
- Account Service: Manages user accounts, authentication, and authorization.
- Address Service: Handles user addresses and location-related data.
- Catalogue Service: Manages product listings, categories, and inventory.
- Order Service: Handles order creation, tracking, and management.
- Payment Service: Integrates with Stripe for payment processing.
- Service Registry: Uses Eureka for service discovery and registration.
-
Frontend: Built with Next.js and Redux for state management, providing a responsive and dynamic user interface.
-
Backend: Built with Spring Boot, using Feign for inter-service communication and Spring Cloud Gateway for API routing.
-
Security: Implements OAuth2 resource server with JWT-based authentication using Spring Security.
-
Database: Uses MySQL for persistent data storage across services.
-
Payment Integration: Integrates with Stripe for secure and seamless payment processing.
-
Monitoring and Tracing:
- Zipkin: Planned for distributed tracing to monitor requests across microservices.
- Prometheus/Grafana: Planned for monitoring and visualizing application metrics.
-
Deployment: Designed to be deployed on Kubernetes for scalability and resilience.
- Spring Boot: Framework for building microservices.
- Spring Cloud Gateway: API gateway for routing and filtering requests.
- Eureka: Service registry and discovery.
- Feign: Declarative REST client for inter-service communication.
- Spring Security: Implements OAuth2 and JWT-based authentication.
- Stripe API: Payment processing integration.
- MySQL: Relational database for persistent storage.
- Zipkin (Planned): Distributed tracing.
- Prometheus/Grafana (Planned): Monitoring and visualization.
- Next.js: React framework for server-side rendering and static site generation.
- Redux: State management library for React.
- Kubernetes: Container orchestration for deploying and scaling microservices.
- Docker: Containerization of services.
- Java 17 or higher
- Node.js 16 or higher
- MySQL 8.x
- Docker
- Kubernetes cluster (optional for local development)
- Stripe API key
-
Clone the Repository:
git clone https://github.com/your-repo/nursery-store-app.git cd nursery-store-app -
Set Up MySQL:
- Create a MySQL database and update the
application.ymlfiles in each microservice with the correct database credentials.
- Create a MySQL database and update the
-
Set Up Eureka Server:
- Navigate to the
eureka-serverdirectory and run:./mvnw spring-boot:run
- Navigate to the
-
Run Microservices:
- Start each microservice (
account-service,address-service,catalogue-service,order-service,payment-service) by navigating to their respective directories and running:./mvnw spring-boot:run
- Start each microservice (
-
Run Spring Cloud Gateway:
- Navigate to the
gatewaydirectory and run:./mvnw spring-boot:run
- Navigate to the
-
Set Up Frontend:
- Navigate to the
frontenddirectory and install dependencies:npm install
- Start the Next.js application:
npm run dev
- Navigate to the
-
Access the Application:
- Open your browser and navigate to
http://localhost:3000.
- Open your browser and navigate to
- Stripe API Key: Set the
STRIPE_API_KEYenvironment variable in thepayment-service. - JWT Secret: Set the
JWT_SECRETenvironment variable in theaccount-service. - MySQL Credentials: Update the
application.ymlfiles in each microservice with the correct database credentials.
- Use the provided Kubernetes manifests (
k8s/) to deploy the application on a Kubernetes cluster. - Ensure you have a running Kubernetes cluster and
kubectlconfigured.
API documentation is available via Swagger UI:
- Access Swagger UI for each microservice at
http://localhost:<port>/swagger-ui.html.
-
Zipkin:
- Deploy Zipkin for distributed tracing to monitor requests across microservices.
-
Prometheus/Grafana:
- Set up Prometheus for metrics collection and Grafana for visualization.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature/your-feature). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or feedback, please reach out to:
- Sagar Subedi - sagarsubedi01@gmail.com
- Project Repository - GitHub Repo
Thank you for using the Distributed Nursery Store Application! 🌱