How abhip47/nexdrive-backend works
1. This repo is a Spring Boot microservices system for “AppShala Drive,” a cloud document/media storage platform. The architecture is split into five deployable services plus shared platform infrastructure: API Gateway, Config Server, Eureka Server, User Service, User Group Service, and Storage Service.
2. The platform boundary is clearly service-oriented. Each service has its own Maven project, application entrypoint, tests, and domain model. That means deployment, scaling, and failure isolation happen per service rather than as one monolith.
3. apiGateway is the edge entrypoint. It sits in front of the backend services and is the place where client traffic is expected to be routed. In a diagram, it should be shown as the only public-facing service, with internal routing onward to the other services.
4. eurekaServer provides service discovery. The other services are designed to register and discover each other dynamically rather than hard-coding host locations. This is important for the cloud-native topology and horizontal scaling story.
5. configserver is the centralized configuration boundary. It externalizes service configuration so the runtime behavior of the services can be managed from one place instead of being embedded in each service. It is part of the platform control plane, not the business domain.
6. userService owns user lifecycle and profile-related business logic. Its structure includes a controller, service layer, repository, domain model, request/response payloads, validation/error handling, and a MailService. That suggests it handles user CRUD, user import/export or bulk operations, and user-facing notifications. It also defines a UserDeletedEvent, showing that user deletion is an event source for other services.
7. userGroupService owns groups, memberships, and authorization-like group membership rules. It has separate models for UserGroup and Membership, DTOs for requests/responses, repository and service layers, and enums for MemberRole, GroupSortBy, and SortDirection. It also contains a UserServiceClient, which indicates it calls back into the User Service for cross-service user information. The presence of UserDeletedEventListener/Listner indicates it reacts to user deletion events to clean up memberships.
8. storageservice is the storage integration layer. Its S3config and PresignedUrlResponse strongly indicate AWS S3 is the external persistence target for files, with the service generating presigned upload/download URLs rather than proxying file bytes itself. In the architecture diagram, this is the main boundary to an external cloud service.
9. The main business data flow is: client traffic enters the API Gateway, which routes to the appropriate service; User Service manages user records; User Group Service manages group/membership state and consults User Service when needed; Storage Service issues S3 presigned URLs for direct object storage access. The actual file content is therefore expected to move directly between the client and S3, while the Storage Service only handles authorization and URL issuance.
10. There is clear asynchronous coupling between services through domain events. User deletion is modeled as an event in User Service and consumed by User Group Service listeners, which implies eventual consistency for cross-service cleanup. This is a key architectural boundary: user state changes can propagate without synchronous orchestration.
11. There is also synchronous service-to-service communication via client abstractions. GroupServiceClient in User Service and UserServiceClient in User Group Service imply internal HTTP calls through service discovery rather than direct database sharing. That separation reinforces bounded contexts and avoids shared persistence.
12. The data layer appears service-local. Each business service has its own repository package, meaning each owns its own persistence boundary and schema. No shared database is visible in the tree, which is consistent with microservice isolation.
13. Common implementation patterns are Spring Boot controllers/services/repositories, payload DTOs for API contracts, enums for domain constraints, and global exception handling in User Service. These patterns make each service independently evolvable while keeping APIs explicit.
14. For an architecture diagram, the most important boxes and arrows are: public clients -> API Gateway; Gateway -> User Service / User Group Service / Storage Service; services -> Eureka for discovery; services -> Config Server for configuration; User Service -> User Group Service via events and client calls; Storage Service -> S3. The main boundary to emphasize is that the platform stores metadata in services but stores actual media in S3.
Main entry points: ApiGatewayApplication.java API Gateway · UserController.java User API · UserGroupController.java Group API · StorageController.java Storage API
Components 19
Edge
Public entry and request routing
- Clients · Web, mobile, or API clients entering the platform
- API Gateway · Single public-facing entrypoint that routes requests to backend services
apiGateway/src/main/java/com/appShala/apiGateway/ApiGatewayApplication.java
Platform
Shared control-plane infrastructure
- Config Server · Externalized configuration control plane for the services
configserver/src/main/java/com/appshala/configserver/ConfigserverApplication.java - Eureka Server · Registry used by services to discover each other dynamically
eurekaServer/src/main/java/com/appShala/eurekaServer/EurekaServerApplication.java
User service
User lifecycle and profile domain
- User API · HTTP boundary for user operations and imports
userService/src/main/java/com/appshala/userService/Controller/UserController.java - User Logic · User lifecycle, validation, and orchestration logic
userService/src/main/java/com/appshala/userService/ServcieImpl/UserServiceImpl.java - User Store · User persistence boundary and domain model
userService/src/main/java/com/appshala/userService/Repository/UserRepository.java - User Events · Publishes user deletion events consumed by other services
userService/src/main/java/com/appshala/userService/Event/UserDeletedEvent.java - Mail Service · User-facing email notification component
userService/src/main/java/com/appshala/userService/ServcieImpl/MailService.java
Group service
Groups, memberships, and cross-user rules
- Group API · HTTP boundary for groups and memberships
userGroupService/src/main/java/com/appShala/userGroupService/Controller/UserGroupController.java - Membership API · HTTP boundary for membership operations
userGroupService/src/main/java/com/appShala/userGroupService/Controller/MembershipController.java - Group Logic · Group and membership orchestration logic
userGroupService/src/main/java/com/appShala/userGroupService/ServiceImpl/UserGroupServiceImpl.java - Membership Logic · Membership-specific business logic
userGroupService/src/main/java/com/appShala/userGroupService/ServiceImpl/MembershipServiceImpl.java - Group Store · Group and membership persistence boundary
userGroupService/src/main/java/com/appShala/userGroupService/Repository/UserGroupRepository.java - User Client · Synchronous calls from group service back to user service
userGroupService/src/main/java/com/appShala/userGroupService/client/UserServiceClient.java - Delete Listener · Consumes user deletion events for cleanup
userGroupService/src/main/java/com/appShala/userGroupService/listener/UserDeletedEventListener.java
Storage service
Presigned URL access to object storage
- Storage API · HTTP boundary for presigned URL operations
storageservice/src/main/java/com/appshala/storageservice/controller/StorageController.java - Storage Logic · Generates presigned upload and download URLs
storageservice/src/main/java/com/appshala/storageservice/serviceImpl/StorageServiceImpl.java
External
Managed cloud dependency
- S3 · AWS S3 holds actual file and media bytes
Connections 28
- Clients → API Gateway: public traffic · Client requests enter through the gateway
- API Gateway → User API: routes · Gateway forwards user requests to the user service
- API Gateway → Group API: routes · Gateway forwards group requests to the group service
- API Gateway → Storage API: routes · Gateway forwards storage requests to the storage service
- User API → User Logic: uses · Controller delegates to service logic
- User Logic → User Store: persists · User logic reads and writes user records
- User Logic → Mail Service: notifies · User changes can trigger email notifications
- User Logic → User Events: publishes · User deletion emits a domain event
- Group API → Group Logic: uses · Controller delegates to group service logic
- Membership API → Membership Logic: uses · Controller delegates to membership service logic
- Group Logic → Group Store: persists · Group logic owns its persistence boundary
- Membership Logic → Group Store: persists · Membership logic stores membership state
- Group Logic → User Client: calls · Group service synchronously queries user service
- Delete Listener → Group Logic: reacts · User deletion events trigger membership cleanup
- User Events → Delete Listener: event flow · User service events are consumed asynchronously by group service
- Storage API → Storage Logic: uses · Controller delegates URL generation to storage logic
- Storage Logic → S3: issues URLs · Storage service generates presigned access for S3
- API Gateway → Eureka Server: discovers · Gateway resolves backend services through discovery
- User API → Eureka Server: registers · User service participates in service discovery
- Group API → Eureka Server: registers · Group service participates in service discovery
- Storage API → Eureka Server: registers · Storage service participates in service discovery
- API Gateway → Config Server: loads config · Gateway receives centralized configuration
- User API → Config Server: loads config · User service receives centralized configuration
- Group API → Config Server: loads config · Group service receives centralized configuration
- Storage API → Config Server: loads config · Storage service receives centralized configuration
- User API → API Gateway: behind · User API is only reachable through the gateway
- Group API → API Gateway: behind · Group API is only reachable through the gateway
- Storage API → API Gateway: behind · Storage API is only reachable through the gateway