Building a Full-Stack Bookkeeping Ledger Using Antigravity
Source: Dev.to

I recently built a full‑stack bookkeeping application to help track borrowed money and loan repayments. The goal was to create a secure, practical tool from scratch while gaining hands‑on experience with a modern, decoupled architecture.
The project was developed using Google Antigravity IDE, where I supplied the requirements, reviewed the AI‑generated plan and code, and added suggestions.
The Tech Stack
- Backend: Java, Spring Boot 3, Spring Data JPA
- Database: PostgreSQL (hosted on Neon.tech)
- Frontend: Vanilla JavaScript, HTML, CSS
- Security: Spring Security 6 with stateless JWTs
- Deployment: Render (backend) & GitHub Pages (frontend) with GitHub Actions for CI/CD
- IDE: Google Antigravity
Core Features
1. Partial Repayment Logic
An endpoint allows partial repayments. When a repayment amount is submitted, the backend updates the loan balance. If the balance reaches zero or below, the loan record is automatically deleted; otherwise, the active record is securely updated.
2. Stateless Security and JWTs
Authentication is handled with JSON Web Tokens. Tokens are sent to the client in an HttpOnly cookie, avoiding exposure to XSS attacks.
3. Handling Cross‑Origin Requests
Because the frontend (GitHub Pages) and backend (Render) are on different domains, CORS is configured to accept only JSON payloads and explicitly whitelist the GitHub Pages domain. This allows the browser’s preflight OPTIONS request to neutralize CSRF threats without third‑party cookies.
4. Brute‑Force Protection
Bucket4j is integrated into the authentication flow as an API rate limiter, restricting login attempts to 5 per minute per IP address.
Repository and Deployment
A GitHub Actions pipeline runs JUnit and Mockito integration tests on every push, ensuring stability.
- GitHub Repository:
https://github.com/rohithv07/BookKeeping - Live Frontend: https://rohithv07.github.io/BookKeeping/
Note: The app may feel slow due to the limited resources of free‑tier deployments.
What Was Implemented
Spring Boot App
A robust REST API built with Java 21 and Gradle.
Database Models
// Borrower
// Fields: name, email, phone
// Loan
// Fields: amount, dateLent, dueDate (exactly 1 month later), status (ACTIVE | REPAID)
Core API Endpoints
POST /api/borrowers– create a borrowerGET /api/borrowers– list borrowersPOST /api/loans– create a loanGET /api/loans– list loansPUT /api/loans/{id}/repay– submit a repayment (partial or full)
Notification Job
A scheduled NotificationService runs daily at 08:00 AM, queries for active loans whose due date is today or earlier, and sends an email notification to a personal Gmail account.
System Architecture Upgrades
- Interface‑Driven Design: Service layer uses interfaces (
BorrowerService,LoanService) for loose coupling. - Data Transfer Objects (DTOs): API payloads are represented by
BorrowerDtoandLoanDtoto decouple persistence models from external contracts.