Rafael Andrade
  • PT
  • EN (current language)
All projects

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
November 2026 dashboard (in Portuguese) with income of R$7,650.00, expenses of R$5,536.20, a balance of R$2,113.80 and a donut chart of expenses by category.
Monthly dashboard, with expenses by category. Project running locally, with a sample account and sample entries. The interface is in Portuguese.

Architecture overview

  1. 01Frontend

    • Vue 2.7 SPA — Input

      Vuex, Vue Router, Chart.js

    • HTTP client — Deterministic code

      axios injects the token and handles expired sessions

  2. 02HTTP

    • Form Requests — Deterministic code

      validation before the controller

    • Controllers — Deterministic code

      Auth, Categoria, Lançamento, Relatório

  3. 03Domain

    • Services — Deterministic code

      entry type derived from the category; summary and report

  4. 04Data

    • Repositories — Deterministic code

      interfaces in Contracts, implementation in Eloquent

    • PostgreSQL — Data

      SUM and GROUP BY per month

  • Input and output
  • Deterministic code
  • Data
Each layer has one responsibility: HTTP in the controller, rules in the service, data access in the repository.

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. 1.

    Categories

    The user creates categories, each one either income or expense.

  2. 2.

    Entries

    The month’s entries are recorded by category. The entry type automatically follows the type of the chosen category.

  3. 3.

    Dashboard

    Monthly summary with total income, total expenses and balance, plus a chart of expenses by category.

  4. 4.

    Monthly report

    Totals, aggregation by category and the list of entries for the period.

System screens

Login screen (in Portuguese) with a chart illustration and the line “Your finances, clear as day.”
Login on the Vue SPA. The JWT is stored and sent by the centralized HTTP client.
November monthly report with income, expense and balance cards and the table of totals by category.
Monthly report: totals by category and the month’s entries, assembled by RelatorioService on the backend.
Dashboard on a phone, with the income, expense and balance cards stacked above the chart.
On small screens, the cards and the chart stack.

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, LancamentoService and RelatorioService hold the business rules and throw domain exceptions.

  • Repositories

    Interfaces in Repositories/Contracts and implementations in Repositories/Eloquent, bound by RepositoryServiceProvider. Aggregations use SUM and GROUP BY in the database.

  • Frontend

    API calls centralized in src/repositories, axios configured in src/services/http.js, authentication state in Vuex and screens in src/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 SUM and GROUP BY in 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