REST API for managing personal debts with JWT authentication.
- Java 25
- Spring Boot 4.0.2
- Spring Security + JWT
- PostgreSQL 16.13
- Maven
- Java 25+
- PostgreSQL 16+
- Maven
- Create a PostgreSQL database
- Configure environment variables or create an
application-local.propertiesfile (see Environment Variables) - Run
mvn spring-boot:run
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/auth/register |
Create a new account | No |
| POST | /api/auth/login |
Authenticate and receive JWT | No |
| GET | /api/public/debt/types |
Get all possible debt categories | No |
| GET | /api/debt/entries |
List all debt entries | JWT |
| POST | /api/debt/entries |
Create a new debt entry | JWT |
| GET | /api/debt/entry/{id} |
Get a specific debt entry | JWT |
| PUT | /api/debt/entry/{id} |
Update a specific debt entry | JWT |
| DELETE | /api/debt/entry/{id} |
Delete a specific debt entry | JWT |
| GET | /api/debt/total-remaining |
Get total outstanding debt | JWT |
| Variable | Description |
|---|---|
DB_USER |
Database username |
DB_PASS |
Database password |
JWT_SECRET |
Secret key for JWT signing |
Or use application-local.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/your_database
spring.datasource.username=your_user
spring.datasource.password=your_password
jwt.secret=your_secret_keyPOST /api/auth/register
Content-Type: application/json
{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"password": "SecurePass123",
"confirmPassword": "SecurePass123"
}Validation rules:
firstName: 2-50 characterslastName: 2-50 charactersemail: 5-100 characters, valid email formatpassword: 8-100 characters, must contain at least one uppercase, one lowercase, one number, and no spaces
POST /api/debt/entries
Authorization: Bearer <your-jwt-token>
Content-Type: application/json
{
"description": "Medical consultation",
"moneyAmount": 75000,
"creditor": "Clínica Los Andes",
"type": {
"id": 1
},
"dateLimit": "2026-05-15T10:00:00"
}Validation rules:
description: max 150 charactersmoneyAmount: positive number, cannot be nullcreditor: max 100 characterstype: must be a valid debt type IDdateLimit: must be a future dateisPaid: defaults tofalseisActive: defaults totrue
- Unit and integration tests (JUnit 5, Mockito)
- Frontend client (React or Angular)