Full stack application · Laravel and Vue
Personal Finance
Monthly expense tracking with a Laravel REST API and a Vue SPA, organized in layers with contract-based repositories.
- REST API with JWT and data isolated per user
- Repositories with a contract and an Eloquent implementation
- Reports aggregated in the database by type and category
- Type
- Personal project
- Period
- Jul 2026
- Stack
- Laravel 12, PHP, PostgreSQL, JWT

Architecture overview
01Frontend
Vue 2.7 SPA — Input
Vuex, Vue Router, Chart.js
HTTP client — Deterministic code
axios injects the token and handles expired sessions
02HTTP
Form Requests — Deterministic code
validation before the controller
Controllers — Deterministic code
Auth, Categoria, Lançamento, Relatório
03Domain
Services — Deterministic code
entry type derived from the category; summary and report
04Data
Repositories — Deterministic code
interfaces in Contracts, implementation in Eloquent
PostgreSQL — Data
SUM and GROUP BY per month
- Input and output
- Deterministic code
- Data
01Context and problem
Personal finance tracking usually lives in spreadsheets that mix categories, entry types and the month’s result, and that don’t scale as the volume grows.
02Goal
A system that is simple to use but built like a product backend: well-defined layers, rules in the domain, data always isolated per user and reports computed in the database.
03How it works
- 1.
Categories
The user creates categories, each one either income or expense.
- 2.
Entries
The month’s entries are recorded by category. The entry type automatically follows the type of the chosen category.
- 3.
Dashboard
Monthly summary with total income, total expenses and balance, plus a chart of expenses by category.
- 4.
Monthly report
Totals, aggregation by category and the list of entries for the period.
System screens



04Technical architecture
A Laravel REST API and a Vue SPA in separate folders of the same repository. Every route except login and sign-up requires the JWT token.
Controllers
In
app/Http/Controllers/Api, they only handle HTTP: they receive the validated request and return JSON.Services
AuthService,CategoriaService,LancamentoServiceandRelatorioServicehold the business rules and throw domain exceptions.Repositories
Interfaces in
Repositories/Contractsand implementations inRepositories/Eloquent, bound byRepositoryServiceProvider. Aggregations useSUMandGROUP BYin the database.Frontend
API calls centralized in
src/repositories, axios configured insrc/services/http.js, authentication state in Vuex and screens insrc/views.
05Technologies
- Backend
- Laravel 12 · PHP 8.2+ · tymon/jwt-auth · Eloquent
- Data
- PostgreSQL
- Frontend
- Vue 2.7 · Vuex · Vue Router · Chart.js · axios
06Engineering decisions
Contract-based repositories
Services depend on interfaces such as
LancamentoRepositoryInterface, not on Eloquent. Swapping the persistence layer or isolating rules in tests doesn’t require touching the domain.Rules derived on the server
The entry type doesn’t come from the client: the service derives it from the category, which prevents an expense entry in an income category.
User scope on every query
Repositories always receive the authenticated user’s id. Another user’s record is simply not found.
Aggregation in the database
Totals by type and by category are computed with
SUMandGROUP BYin PostgreSQL, instead of summing collections in the application.
07Technical challenges
Expired sessions in the SPA
The JWT token expires while the user is navigating. The HTTP client centralizes token injection and expired-session handling, without spreading that logic across the screens.
Consistent reports
The dashboard and the monthly report use the same repository queries, so the totals shown on both screens always match.
08What was implemented
- Sign-up, login, logout and JWT token refresh
- Category and entry CRUD with validation
- Monthly summary with a chart by category
- Detailed monthly report
- Controller → Service → Repository → Model layers
09Possible next steps
Future improvements — not implemented yet
- Feature tests for the endpoints — the repository only has Laravel’s default example tests today.
- Restrict CORS to the frontend origin before any deployment (a limitation documented in the README).
- Migrate the frontend to Vue 3.
10Code and demo
- Source code on GitHub (opens in a new tab)
No public demo. The repository README explains how to run the project locally.
