How ahmedmohamedezz/quickbite_core_service__java_version works
Purpose and runtime
QuickBite is a Spring Boot backend for a Talabat-like food-ordering domain: users authenticate, manage addresses, discover restaurant branches, and manage restaurants/products. The application starts at src/main/java/com/quickbite/core/CoreApplication.java; Maven build/dependency/runtime definition is pom.xml. Persistence is PostgreSQL-oriented, including PostGIS geospatial queries and Flyway-style SQL migrations.
HTTP request and platform boundary
Controllers are the API entry points and delegate to domain services, which use repositories and map entities to response DTOs. Cross-cutting request handling establishes correlation IDs, request logging, JWT authentication, security policy, and standardized failures:
• src/main/java/com/quickbite/core/common/filter/CorrelationIdFilter.java
• src/main/java/com/quickbite/core/common/filter/JwtAuthenticationFilter.java
• src/main/java/com/quickbite/core/common/config/SecurityConfig.java
• src/main/java/com/quickbite/core/common/exception/GlobalExceptionHandler.java
Authentication state is derived from JWTs and exposed as a UserPrincipal; auth tokens are handled as HTTP-only cookies.
Identity, authentication, and authorization
Authentication supports registration/login plus password-reset lifecycle. AuthService coordinates user lookup, credential handling, token creation, reset-token persistence, and auth responses; JwtService is the token boundary. System roles reside on users, while restaurant-scoped RBAC is modeled separately through roles, permissions, and restaurant memberships.
• src/main/java/com/quickbite/core/auth/controller/AuthController.java
• src/main/java/com/quickbite/core/auth/service/AuthService.java
• src/main/java/com/quickbite/core/common/security/JwtService.java
• src/main/java/com/quickbite/core/rbac/domain/RestaurantMemberEntity.java
• src/main/java/com/quickbite/core/user/domain/UserEntity.java
Restaurant and branch management
Restaurants are owned/managed resources with status and administrative update paths. Branches belong to restaurants and add operational state, address/location, delivery radius, ordering acceptance, and currency. The branch repository contains the spatial discovery boundary: a native PostGIS ST_DWithin query returns active branches of active restaurants near a customer coordinate.
• src/main/java/com/quickbite/core/restaurant/service/RestaurantService.java
• src/main/java/com/quickbite/core/restaurant/domain/RestaurantEntity.java
• src/main/java/com/quickbite/core/branch/service/BranchService.java
• src/main/java/com/quickbite/core/branch/repository/BranchRepository.java
Product catalog and branch-specific availability
The product subsystem models categories and canonical products, with ProductBranchDetailsEntity providing the join/override layer for a product at a particular branch. ProductService is the orchestration point for catalog CRUD and branch detail projections, separating API DTOs from database entities.
• src/main/java/com/quickbite/core/product/controller/ProductController.java
• src/main/java/com/quickbite/core/product/service/ProductService.java
• src/main/java/com/quickbite/core/product/domain/ProductEntity.java
• src/main/java/com/quickbite/core/product/domain/ProductBranchDetailsEntity.java
Customer profile data
Customer addresses are independently managed records, typed by address category. This is the customer-location input boundary likely used alongside branch proximity results, but no ordering/cart/payment subsystem is present in the repository.
• src/main/java/com/quickbite/core/customer_addresses/controller/CustomerAddressesController.java
• src/main/java/com/quickbite/core/customer_addresses/service/CustomerAddressesService.java
• src/main/java/com/quickbite/core/customer_addresses/domain/CustomerAddressEntity.java
Data and operational infrastructure
Database schema evolution is versioned from users and password resets through restaurant geography, catalog, and RBAC seed data. Typed application configuration centralizes environment, database pool, JWT, cookie, and migration settings. A health endpoint explicitly checks database connectivity for deployment/platform probes.
• src/main/resources/db/migration/V1__create_users_table.sql
• src/main/resources/db/migration/V6__create_restaurant_branches_table.sql
• src/main/resources/db/migration/V7__create_products_tables.sql
• src/main/java/com/quickbite/core/common/config/AppConfig.java
• src/main/java/com/quickbite/core/health/controller/HealthController.java
Main entry points: UserEntity.java Domain entities · AuthService.java Auth service · BranchService.java Branch service · CoreApplication.java Spring Boot app
Components 18
HTTP API
- Auth API
src/main/java/com/quickbite/core/auth/controller/AuthController.java - Product API
src/main/java/com/quickbite/core/product/controller/ProductController.java - Address API
src/main/java/com/quickbite/core/customer_addresses/controller/CustomerAddressesController.java - Health API · Database connectivity probe.
src/main/java/com/quickbite/core/health/controller/HealthController.java
Domain services
- Auth service · Registration, login, and password-reset lifecycle.
src/main/java/com/quickbite/core/auth/service/AuthService.java - JWT service · Creates and validates token state.
src/main/java/com/quickbite/core/common/security/JwtService.java - Restaurant service · Restaurant ownership and administration.
src/main/java/com/quickbite/core/restaurant/service/RestaurantService.java - Branch service · Branch operations and nearby discovery.
src/main/java/com/quickbite/core/branch/service/BranchService.java - Product service · Catalog CRUD and branch-detail projections.
src/main/java/com/quickbite/core/product/service/ProductService.java - Address service
src/main/java/com/quickbite/core/customer_addresses/service/CustomerAddressesService.java
Persistence
- Branch repository · PostGIS proximity query for active branches.
src/main/java/com/quickbite/core/branch/repository/BranchRepository.java - Domain entities · Users, memberships, restaurants, products, branch details, and addresses.
src/main/java/com/quickbite/core/user/domain/UserEntity.java - PostgreSQL + PostGIS
- Schema migrations · Versioned user, branch, catalog, and RBAC schema.
src/main/resources/db/migration/V1__create_users_table.sql
Other components
- Spring Boot app · Application bootstrap.
src/main/java/com/quickbite/core/CoreApplication.java - Security pipeline · JWT authentication, policy, correlation, and error handling.
src/main/java/com/quickbite/core/common/config/SecurityConfig.java - JWT filter
src/main/java/com/quickbite/core/common/filter/JwtAuthenticationFilter.java - Application config · Environment, pool, JWT, cookie, and migration settings.
src/main/java/com/quickbite/core/common/config/AppConfig.java
Connections 19
- Spring Boot app → Security pipeline: installs
- Spring Boot app → Application config: loads
- Security pipeline → JWT filter: authenticates requests
- JWT filter → JWT service: validates JWT
- Auth API → Auth service: delegates
- Product API → Product service: delegates
- Address API → Address service: delegates
- Auth service → JWT service: issues tokens
- Auth service → Domain entities: manages users and reset tokens
- Restaurant service → Domain entities: manages restaurants and memberships
- Branch service → Branch repository: discovers nearby branches
- Branch service → Domain entities: manages branches
- Product service → Domain entities: manages catalog and branch overrides
- Address service → Domain entities: manages customer addresses
- Branch repository → PostgreSQL + PostGIS: PostGIS ST_DWithin
- Domain entities → PostgreSQL + PostGIS: persists
- Schema migrations → PostgreSQL + PostGIS: evolves schema
- Health API → PostgreSQL + PostGIS: checks connectivity
- Application config → PostgreSQL + PostGIS: configures connection