This is a backend service for a mall application, built using the Spring Cloud ecosystem. The application currently implements user authentication and authorization using JWT, as well as service registration and discovery using Nacos.
- Spring Cloud: A set of tools for building distributed systems and microservices in Java.
- Nacos: Service discovery and configuration management platform.
- Spring Gateway: A gateway service that handles routing and provides a unified entry point for microservices.
- OpenFeign: A declarative HTTP client for making REST API calls between microservices.
- JWT (JSON Web Token): Used for securing APIs via authentication and authorization.
- Spring Security: Provides comprehensive security services for Java applications.
- MyBatis: A persistence framework that simplifies the implementation of SQL in Java.
- Redis: Used for caching user session data.
- Elasticsearch (Planned): Will be used for implementing search functionality on the main page.
Manages user registration, login, and session management.
Handles all incoming requests, routes them to the appropriate microservice, and performs JWT-based authentication.
Holds utility classes, shared DTOs, and exception handling mechanisms.
Handles search functionalities for the mall’s products using Elasticsearch.
mall_backend/
├── api/ # API gateway service
├── common/ # Shared utilities and configurations
├── gateway/ # Spring Cloud Gateway service
├── search-service/ # Elasticsearch-based search service (Planned)
└── user-service/ # User management and authentication service
- Java 11 or higher
- Maven 3.x
- MySQL
- Redis
- Nacos: Download and run Nacos as a service registry.
- Elasticsearch (for future implementation): Download and run Elasticsearch.
Make sure to configure the database, Nacos server, Redis, and other properties in the application.yml
files located in each module.
-
Start the Nacos server:
sh startup.sh -m standalone
-
Start the Redis server.
-
Start each microservice using Maven:
mvn spring-boot:run
- User Registration & Login:
POST /user/login
- User loginPOST /user/register
- User registration- The JWT token returned upon successful login should be used in the
Authorization
header for subsequent requests.
- Elasticsearch Integration: Implementing a search service for products on the main page using Elasticsearch.
- Authorization: Implementing role-based access control to manage user permissions.
Feel free to fork this repository and submit pull requests. Contributions, issues, and feature requests are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.