Secure RESTful backend for personal finance tracking
User authentication (JWT), transaction CRUD (income/expense/transfer), PostgreSQL + Flyway, clean architecture
Live Demo: https://transaction-service-29ts.onrender.com
Swagger UI (local): http://localhost:8080/swagger-ui.html
- JWT Authentication — secure registration, login, role-based claims
- Transaction Management — create, list income/expense/transfer entries
- Input Validation — DTOs + Jakarta Bean Validation + clean error responses
- Database — Flyway migrations, PostgreSQL (production), H2 (dev/tests)
- Clean Architecture — layered structure (controllers → services → repositories)
- Testing — unit tests (Mockito), context loading with Flyway integration
- Deployment Ready — Render-friendly with environment variables
| Category | Technology |
|---|---|
| Language | Java 17 |
| Framework | Spring Boot 3 |
| Security | Spring Security + JWT |
| Persistence | Spring Data JPA + Hibernate |
| Database | PostgreSQL (prod) / H2 (dev/test) |
| Migrations | Flyway |
| Validation | Jakarta Bean Validation |
| Testing | JUnit 5 + Mockito |
| Deployment | Render |
| Documentation | Springdoc OpenAPI / Swagger UI |
-
Clone the repository
git clone https://github.com/LauraBaillie/transaction-service.git cd transaction-service -
Set environment variables (or create .env file)
export DB_URL=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
export DB_USERNAME=sa
export DB_PASSWORD=""
export JWT_SECRET=super-secret-local-test-key-do-not-use-in-production-abcdefghijklmnopqrstuvwxyz123456
export JWT_EXPIRATION=86400000 # 24 hours in ms
- Build & run
mvn clean spring-boot:run
Test endpoints (Postman / curl)
POST /api/auth/register → { "username": "testuser", "password": "test123" }
POST /api/auth/login → get JWT token
POST /api/transactions (with Authorization: Bearer <token>) → create transaction
GET /api/transactions → list user's transactions
🧪 Testing All tests pass with clean separation: Bashmvn clean test
- Unit tests — service layer (Mockito)
- Integration-style — context loading + Flyway migrations in H2
- Coverage — focused on business logic & security mocking
🌐 Deployment (Render)
- Connect GitHub repo to Render
- Build command: mvn clean package
- Start command: java -jar target/transaction-service-*.jar
- Set environment variables in Render dashboard:
- DB_URL, DB_USERNAME, DB_PASSWORD (use Render PostgreSQL add-on)
- JWT_SECRET, JWT_EXPIRATION