The backend for the AR Car Showcase mobile application. Built with Spring Boot (Java 17) and a Python microservice for 3D model processing. Exposes a RESTful API for car data, user authentication, customization, and AI-powered recommendations.
| Layer | Technology |
|---|---|
| Core API | Spring Boot 3.x (Java 17) |
| Build Tool | Maven |
| Security | Spring Security + JWT |
| Database | PostgreSQL / MySQL (JPA/Hibernate) |
| 3D Processing | Python 3.x + Flask + Blender headless |
| Recommendation Engine | Java (Spring Service) + Python ML |
| Static Model Hosting | Spring Boot Static Resources |
- π JWT Authentication β Stateless sign-in/sign-up with token-based session management
- π Car Catalog API β Full CRUD for car data with filtering by brand, body type, fuel type, and budget
- π¨ 3D Customization Engine β Triggers a Python/Blender microservice to generate custom GLB models
- π€ Recommendation Engine β Personalized car suggestions based on user preferences and viewing history
- πΎ Customization Persistence β Saves and retrieves user-specific design configurations
- π Cross-Origin Support β Configured for React Native / Expo mobile client
graph TB
subgraph "Mobile Client (React Native / Expo)"
UI["User Interface"]
API_Client["Fetch / AsyncStorage"]
end
subgraph "Spring Boot Core Server (Java 17)"
AuthController["AuthController\n/api/auth/**"]
CarController["CarController\n/api/cars/**"]
CustomController["CustomizationController\n/api/customizations/**"]
RecController["RecommendationController\n/api/recommendations/**"]
AuthService["AuthService"]
CarService["CarService"]
CustomService["CustomizationService"]
RecService["RecommendationService"]
JwtFilter["AuthTokenFilter (JWT)"]
SecurityConfig["WebSecurityConfig"]
CarRepo["CarRepository (JPA)"]
UserRepo["UserRepository (JPA)"]
CustomRepo["CustomizationRepository (JPA)"]
end
subgraph "Microservices"
BlenderSvc["Blender Service\n(Python/Flask :5000)"]
MLSvc["Recommendation ML\n(Python :8000)"]
end
DB[(PostgreSQL)]
ModelStore[("Static .glb Files\n/resources/static/models")]
API_Client <--> AuthController
API_Client <--> CarController
API_Client <--> CustomController
API_Client <--> RecController
JwtFilter --> SecurityConfig
AuthController --> AuthService
CarController --> CarService
CustomController --> CustomService
RecController --> RecService
AuthService --> UserRepo
CarService --> CarRepo
CustomService --> CustomRepo
CustomService --> BlenderSvc
RecService --> MLSvc
CarRepo --> DB
UserRepo --> DB
CustomRepo --> DB
BlenderSvc --> ModelStore
ModelStore --> API_Client
sequenceDiagram
participant U as User
participant UI as LoginScreen
participant AC as AuthContext
participant CL as API Client
participant S as Spring Boot Server
participant AS as AsyncStorage
U->>UI: Enter Credentials
UI->>AC: signIn(user, pass)
AC->>CL: post('/auth/signin')
CL->>S: POST /api/auth/signin
S-->>CL: Response (JWT + User Data)
CL-->>AC: Adapted Data
alt Success
AC->>AS: Save Token & User Body
AC->>UI: Update Auth State
UI->>U: Navigate to Home
else Failure
AC->>UI: Return Error Message
UI->>U: Display Alert
end
sequenceDiagram
participant U as User
participant HS as HybridScreen (3D Studio)
participant CC as CarContext (React)
participant CD as CustomizationDrawer
participant AR as ARHybridScene (Viro)
participant BV as Blender Microservice (Python)
U->>HS: Select Car from Catalog
HS->>CC: updateVehicle(carData)
U->>HS: Toggle Customizer Workspace
HS->>CD: mount(isPickerVisible=true)
U->>CD: Modify Material Color (e.g. #FF0000)
CD->>CC: updateMaterialColor(part, color)
CC-->>HS: trigger(r3f-re-render)
HS->>HS: Apply Material to Mesh Object
U->>HS: Click "Apply to AR"
HS->>BV: generateCustomModel(vehicleId, materials)
activate BV
BV->>BV: Load Base .blend
BV->>BV: Update Cycles/Eevee Materials
BV->>BV: Export .glb Stream
BV-->>HS: Return Model Metadata & Filename
deactivate BV
HS->>HS: setGeneratedModelUrl(newUrl)
HS->>AR: mount(viroAppProps)
AR->>AR: initialize(ARSession)
AR->>AR: fetch(customModelUrl)
AR-->>U: Project Customized Car in AR
sequenceDiagram
participant U as User
participant SC as Search/Home Screen
participant AC as AuthContext
participant RA as Recommendation API
participant S as Spring Boot Server
participant RE as Java Recommendation Engine
U->>SC: Enter Search Query / View Home
SC->>AC: Get User Preferences
SC->>RA: getUserRecommendations()
RA->>S: GET /api/recommendations/personalized
S->>RE: Query Preferred Matches
RE-->>S: List of Recommended Cars
S-->>RA: JSON Data
RA-->>SC: Map to UI Components
SC->>U: Display "Recommended for You"
U->>SC: Click on a Car
SC->>RA: trackInteraction(carId, 'view')
RA->>S: POST /api/recommendations/feedback
S->>RE: Update User Behavior Model
classDiagram
class AuthController {
+authenticateUser(LoginRequest) ResponseEntity
+registerUser(SignupRequest) ResponseEntity
}
class CarController {
+allCars() ResponseEntity~List~Car~~
+getCarsById(id) Car
+allBrands() ResponseEntity~List~String~~
+allModels(brand) ResponseEntity
+allVariants(brand, model) ResponseEntity
+getVariant(brand, model, variant) ResponseEntity
}
class CustomizationController {
+createCustomization(CustomizationRequest) ResponseEntity
+getUserCustomizations() ResponseEntity
}
class AuthService {
+authenticateUser(LoginRequest) JwtResponse
+registerUser(SignupRequest) MessageResponse
}
class CarService {
<<interface>>
+GetAllCars() List~Car~
+searchCars(keyword) List~Car~
+getCarsById(id) Car
+getAllBrands() List~String~
+getAllModels(brand) List~String~
+getAllVariants(brand, model) List~CarVariant~
+getVariant(brand, model, variant) CarVariant
}
class CustomizationService {
+createCustomization(CustomizationRequest) CustomizationResponse
+getUserCustomizations() List~CustomizationResponse~
}
class RecommendationService {
+getRecommendedCars(carId) List~Car~
+getPersonalizedRecommendations(userId) List~Car~
}
class User {
+Long id
+String username
+String email
+String password
+String phoneNumber
+String profilePic
+Set~String~ favBrands
+Set~String~ preferredBodyTypes
+Set~String~ preferredFuelTypes
+Set~String~ preferredTransmissions
+String drivingCondition
+Double maxBudget
+Set~Role~ roles
}
class Car {
+Long id
+String brand
+String model
+String fuelType
+String transmissionType
+String bodyType
+Double minPriceLakhs
+Double maxPriceLakhs
+String modelUrl
}
class Customization {
+UUID id
+User user
+String vehicleId
+String materials
+String modelUrl
+LocalDateTime createdAt
}
class JwtUtils {
+generateJwtToken(auth) String
+validateJwtToken(token) boolean
+getUserNameFromJwtToken(token) String
}
class AuthTokenFilter {
+doFilterInternal(req, res, chain) void
}
AuthController --> AuthService
CarController --> CarService
CustomizationController --> CustomizationService
AuthService --> JwtUtils
AuthService --> User
CarService --> Car
CustomizationService --> Customization
Customization --> User
AuthTokenFilter --> JwtUtils
stateDiagram-v2
[*] --> Guest_State
state Guest_State {
[*] --> Home_Browse
Home_Browse --> Details_View
Details_View --> Home_Browse
Details_View --> 3D_Studio_Limited
}
Guest_State --> Authenticated_State : Login Success
state Authenticated_State {
[*] --> Dashboard
Dashboard --> Customization_Studio
Customization_Studio --> AR_Mode
AR_Mode --> Customization_Studio
Dashboard --> Comparison_Tool
Dashboard --> Personal_Showroom
state Customization_Studio {
[*] --> Exterior_View
Exterior_View --> Interior_View
Interior_View --> Exterior_View
}
}
Authenticated_State --> Guest_State : Logout
AR-Car-Showcase-Server/
β
βββ src/
β βββ main/
β βββ java/com/arcarshowcaseserver/
β β βββ controller/ # REST Controllers (Auth, Car, Customization, Recommendation)
β β βββ service/ # Business logic layer
β β βββ repository/ # Spring Data JPA repositories
β β βββ model/ # JPA Entities (User, Car, Customization)
β β βββ payload/ # Request/Response DTOs
β β βββ security/ # JWT utils, AuthTokenFilter, WebSecurityConfig
β β βββ ArCarShowcaseServerApplication.java
β βββ resources/
β βββ application.properties
β βββ static/models/ # Hosted .glb 3D model files
β βββ data/cars_data_final.json # Car catalog seed data
β
βββ blender-service/ # Python Flask microservice
β βββ server.py # Flask API entry point
β βββ generate.py # Blender headless script
β βββ requirements.txt
β
βββ car-recommendation-service/ # Recommendation microservice
βββ pom.xml # Maven build file
βββ mvnw / mvnw.cmd # Maven wrapper scripts
- Java 17+
- Maven 3.8+
- PostgreSQL (or MySQL) running locally
- Python 3.9+ with Blender installed (for 3D generation)
-
Clone the repository
git clone https://github.com/AdepuSriCharan/AR-Car-Showcase-Server.git cd AR-Car-Showcase-Server -
Configure the database β edit
src/main/resources/application.properties:spring.datasource.url=jdbc:postgresql://localhost:5432/arcarshowcase spring.datasource.username=your_user spring.datasource.password=your_password spring.jpa.hibernate.ddl-auto=update
-
Run the server
./mvnw spring-boot:run
The API will be available at
http://localhost:8080.
cd blender-service
pip install -r requirements.txt
python server.pyThe Blender microservice will start on http://localhost:5000.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/signin |
Login and receive JWT |
POST |
/api/auth/signup |
Register a new user |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/cars/allcars |
Get all cars |
GET |
/api/cars/{id} |
Get car by ID |
GET |
/api/cars/search?q= |
Search cars by query |
GET |
/api/cars/filter |
Filter by body type, fuel, budget |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/customizations |
Save a customization |
GET |
/api/customizations/user/{userId} |
Get user's saved designs |
GET |
/api/customizations/{id} |
Get specific customization |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/recommendations/personalized |
Personalized car feed |
GET |
/api/recommendations/similar/{carId} |
Similar cars |
POST |
/api/recommendations/feedback |
Record user interaction |
sequenceDiagram
participant C as Client
participant F as AuthTokenFilter
participant SC as SecurityContext
participant CTR as Controller
C->>F: HTTP Request + Authorization: Bearer <token>
F->>F: validateJwtToken(token)
alt Token Valid
F->>SC: setAuthentication(userDetails)
F->>CTR: Forward Request
CTR-->>C: 200 Response
else Token Invalid / Missing
F-->>C: 401 Unauthorized
end
The Python microservice receives customization requests from the Spring Boot server and generates a new .glb model file with the specified colors applied.
Spring Boot β POST /generate β Flask Server β subprocess(blender --background --python generate.py) β New .glb β Return URL β Spring Boot β Frontend
Input payload:
{
"base_model": "car.glb",
"materials": {
"CAR_BODY_PRIMARY": "#FF0000",
"CAR_RIM": "#C0C0C0"
}
}Output:
{
"model_url": "/models/custom_abc123.glb",
"filename": "custom_abc123.glb"
}| Dependency | Purpose |
|---|---|
spring-boot-starter-web |
REST API framework |
spring-boot-starter-data-jpa |
ORM / Database access |
spring-boot-starter-security |
Authentication & authorization |
jjwt |
JWT generation & validation |
postgresql / mysql-connector |
Database driver |
lombok |
Boilerplate reduction |
spring-boot-starter-validation |
Bean validation (@Valid) |
MIT License β See LICENSE for details.