sgivu-client) manages client (customer) accounts, profiles, and related business operations in the SGIVU platform.
Service Overview
Port
8082
Database
PostgreSQL
Migration
Flyway
Role
Client Management
Key Features
- Client (customer) account management
- Client profile and contact information
- Integration with Purchase-Sale Service
- Database migration with Flyway
- RESTful API with OpenAPI documentation
- Internal service authentication
Base Configuration
Server Settings
JPA Configuration
Disabling open-in-view prevents lazy loading exceptions by enforcing transaction boundaries.
Flyway Migration
Flyway Settings
Flyway Settings
- enabled: true: Runs migrations automatically on startup
- locations: Where migration scripts are stored
- baseline-on-migrate: Handles existing databases without version history
- baseline-version: 0: Starting version for baseline
- validate-on-migrate: true: Ensures migration integrity
Database Configuration
- Development
- Production
- SQL logging with formatting for debugging
- Baseline on migrate for existing databases
- Clean disabled (changed from false) for safety
Service Integration
Eureka Registration
The random instance ID allows multiple instances to run for horizontal scaling.
Service Discovery Map
Internal Service Authentication
This shared secret authenticates requests from other microservices, particularly Purchase-Sale Service.
Observability
Actuator Endpoints
- Development
- Production
Distributed Tracing
Tracing Configuration
Tracing Configuration
- probability: 0.1: Samples 10% of requests
- Reduces overhead while maintaining visibility
- All services use the same sampling rate
- Traces span across service boundaries
Logging
API Documentation
- Production
Database Schema
Migration Files
All migrations run automatically on startup. Use
validate-on-migrate: true to ensure schema integrity.Schema Validation
Required Environment Variables
All Environments
| Variable | Description | Example |
|---|---|---|
SERVICE_INTERNAL_SECRET_KEY | Shared secret for internal APIs | your-secret-key |
Development
| Variable | Description | Default |
|---|---|---|
DEV_CLIENT_DB_HOST | Database host | host.docker.internal |
DEV_CLIENT_DB_PORT | Database port | 5432 |
DEV_CLIENT_DB_NAME | Database name | Required |
DEV_CLIENT_DB_USERNAME | Database username | Required |
DEV_CLIENT_DB_PASSWORD | Database password | Required |
Production
| Variable | Description |
|---|---|
PROD_CLIENT_DB_HOST | Database host |
PROD_CLIENT_DB_PORT | Database port |
PROD_CLIENT_DB_NAME | Database name |
PROD_CLIENT_DB_USERNAME | Database username |
PROD_CLIENT_DB_PASSWORD | Database password |
OPENAPI_SERVER_URL | Public API documentation URL |
Optional
| Variable | Description | Default |
|---|---|---|
PORT | Service port | 8082 |
EUREKA_URL | Eureka server URL | http://sgivu-discovery:8761/eureka |
SGIVU_AUTH_URL | Auth service URL | http://sgivu-auth:9000 |
FLYWAY_BASELINE_ON_MIGRATE | Baseline existing DB | false |
API Endpoints
Typical Client Service endpoints (accessed via gateway):All endpoints require authentication through the gateway’s OAuth2 flow.
Client Data Model
Typical client entity includes:- Basic information (name, ID, tax ID)
- Contact details (phone, email, address)
- Client preferences and settings
- Created/updated timestamps
- Account status
Integration with Other Services
Purchase-Sale Service
The Purchase-Sale Service queries client data:Auth Service
Validates JWT tokens for API authorization:Security
OAuth2 Resource Server
The service validates JWT access tokens from the Auth Service.Internal API Protection
Internal endpoints require the shared secret:Performance Tuning
Connection Pooling
Default HikariCP configuration:Query Optimization
- Use
@EntityGraphto avoid N+1 queries - Index frequently queried columns
- Use projection DTOs for read operations
Configuration Files
sgivu-client.yml- Base configurationsgivu-client-dev.yml- Development overridessgivu-client-prod.yml- Production overrides
Related Services
Auth Service
Token validation
Purchase-Sale
Client data consumer
Gateway
API routing