How lucasscheere/cobranca works
Cobrança API is a REST service for managing business clients, receivables, customer-service interactions, and users. Its main workflow starts with an HTTP request, passes through a domain controller and service, and reads or writes through a repository; creating accounts and interactions also checks the referenced client. Account status is computed during creation. PostgreSQL persistence and Flyway schema migrations are documented, but configuration and migration wiring were not excerpted, so those links rely on README evidence.
Main entry points: ClientRepository.kt Client repository · AccountService.kt Account service · InteractionService.kt Interaction service · ClientService.kt Client service
Components 23
REST API
- Client endpoints
src/main/kotlin/br/net/cobranca/client/ClientController.kt - Account endpoints
src/main/kotlin/br/net/cobranca/account/AccountController.kt - Interaction endpoints
src/main/kotlin/br/net/cobranca/interaction/InteractionController.kt - User endpoints
src/main/kotlin/br/net/cobranca/user/UserController.kt - Spring application
src/main/kotlin/br/net/cobranca/CobrancaApplication.kt - Global error handler
src/main/kotlin/br/net/cobranca/exception/GlobalExceptionHandler.kt
Clients and Billing
- Client service
src/main/kotlin/br/net/cobranca/client/ClientService.kt - Client model and DTOs
src/main/kotlin/br/net/cobranca/client/Client.kt - Client repository
src/main/kotlin/br/net/cobranca/client/ClientRepository.kt - Account service
src/main/kotlin/br/net/cobranca/account/AccountService.kt - Account model and enums
src/main/kotlin/br/net/cobranca/account/Account.kt - Account DTOs
src/main/kotlin/br/net/cobranca/account/dto/AccountRequestDTO.kt - Account repository
src/main/kotlin/br/net/cobranca/account/AccountRepository.kt
Customer Engagement
- Interaction service
src/main/kotlin/br/net/cobranca/interaction/InteractionService.kt - Interaction model
src/main/kotlin/br/net/cobranca/interaction/Interaction.kt - Interaction DTOs
src/main/kotlin/br/net/cobranca/interaction/dto/InteractionRequestDTO.kt - Interaction repository
src/main/kotlin/br/net/cobranca/interaction/InteractionRepository.kt
User Management
- User service
src/main/kotlin/br/net/cobranca/user/UserService.kt - User model
src/main/kotlin/br/net/cobranca/user/User.kt - User repository
src/main/kotlin/br/net/cobranca/user/UserRepository.kt
Persistence and Errors
- PostgreSQL
- Schema migrations
src/main/resources/db/migration/V1__create_clients.sql
Other components
- API caller
Connections 26
- API caller → Client endpoints: requests clients
README.md - API caller → Account endpoints: requests accounts
README.md - API caller → Interaction endpoints: requests interactions
README.md - API caller → User endpoints: requests users
README.md - Client endpoints → Client service: delegates to
src/main/kotlin/br/net/cobranca/client/ClientController.kt - Account endpoints → Account service: delegates to
src/main/kotlin/br/net/cobranca/account/AccountController.kt - Interaction endpoints → Interaction service: delegates to
src/main/kotlin/br/net/cobranca/interaction/InteractionController.kt - User endpoints → User service: delegates to
src/main/kotlin/br/net/cobranca/user/UserController.kt - Client service → Client repository: reads and saves
src/main/kotlin/br/net/cobranca/client/ClientService.kt - Account service → Account repository: reads and saves
src/main/kotlin/br/net/cobranca/account/AccountService.kt - Account service → Client repository: checks client
src/main/kotlin/br/net/cobranca/account/AccountService.kt - Interaction service → Interaction repository: reads and saves
src/main/kotlin/br/net/cobranca/interaction/InteractionService.kt - Interaction service → Client repository: checks client
src/main/kotlin/br/net/cobranca/interaction/InteractionService.kt - User service → User repository: reads and saves
src/main/kotlin/br/net/cobranca/user/UserService.kt - Client repository → Client model and DTOs: persists
src/main/kotlin/br/net/cobranca/client/ClientRepository.kt - Account repository → Account model and enums: persists
src/main/kotlin/br/net/cobranca/account/AccountRepository.kt - Interaction repository → Interaction model: persists
src/main/kotlin/br/net/cobranca/interaction/InteractionRepository.kt - User repository → User model: persists
src/main/kotlin/br/net/cobranca/user/UserRepository.kt - Account service → Account DTOs: maps data
src/main/kotlin/br/net/cobranca/account/AccountService.kt - Interaction service → Interaction DTOs: maps data
src/main/kotlin/br/net/cobranca/interaction/InteractionService.kt - Client service → Client model and DTOs: maps data
src/main/kotlin/br/net/cobranca/client/ClientService.kt - Client repository → PostgreSQL: stores records
README.md - Account repository → PostgreSQL: stores records
README.md - Interaction repository → PostgreSQL: stores records
README.md - User repository → PostgreSQL: stores records
README.md - Schema migrations → PostgreSQL: versions schema
README.md