REST API for banking operations built with Spring Boot and PostgreSQL.
- Client management with encrypted passwords (BCrypt)
- Deposit, withdrawal and transfer between accounts
- Transaction history
- Credit and debit card management with tiers and variants
- Loan requests with simple and compound interest calculation
- Global exception handling with structured error responses
- API documentation with Swagger UI
docker-compose up --buildAPI → http://localhost:8080
Swagger → http://localhost:8080/swagger-ui/index.html
Requirements: Java 19, Maven, PostgreSQL
- Create the database:
CREATE DATABASE sistema_bancario;- Create
src/main/resources/application-local.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/sistema_bancario
spring.datasource.username=postgres
spring.datasource.password=your_password
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.open-in-view=false-
Set active profile to
localin your IDE run configuration. -
Run the application.
| Method | Endpoint | Description |
|---|---|---|
| POST | /banco/cliente |
Create client |
| GET | /banco/saldo |
Get balance |
| Method | Endpoint | Description |
|---|---|---|
| POST | /transacoes/deposito |
Deposit |
| POST | /transacoes/saque |
Withdrawal |
| POST | /transacoes/transferencia |
Transfer between accounts |
| GET | /transacoes/historico |
Transaction history |
| Method | Endpoint | Description |
|---|---|---|
| POST | /cartoes |
Create card |
| GET | /cartoes |
List all cards |
| GET | /cartoes/ativos |
List active cards |
| PATCH | /cartoes/{id}/bloquear |
Block card |
| PATCH | /cartoes/{id}/cancelar |
Cancel card |
| POST | /cartoes/{id}/usar-limite |
Use credit limit |
| POST | /cartoes/{id}/pagar-fatura |
Pay bill |
| Method | Endpoint | Description |
|---|---|---|
| POST | /emprestimos |
Request loan |
| GET | /emprestimos |
List loans |
| POST | /emprestimos/{id}/pagar |
Pay installment |
| Tier | Credit Limit |
|---|---|
| N1 | R$ 500 |
| N2 | R$ 1,500 |
| N3 | R$ 3,000 |
| N4 | R$ 5,000 |
GOLD · PLATINUM · BLACK
src/main/java/com/exemplo/saudacao_api/
├── config/ # Security configuration
├── controller/ # REST controllers
├── exception/ # Custom exceptions and global handler
├── model/
│ ├── dto/ # Data transfer objects
│ ├── entity/ # JPA entities
│ └── types/ # Enums
├── repository/ # JPA repositories
├── response/ # API error response structure
└── service/ # Business logic