Skip to content

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Repository files navigation

Expense Tracker

Personal and family finance management system with multi-currency support and automatic balance calculation.

🎯 Project Status

  • βœ… Business Requirements - Complete
  • βœ… System Requirements - Complete
  • βœ… Database Schema - Complete (7 tables, production-ready)
  • βœ… Backend API - Complete (26 REST endpoints with JWT auth)
  • βœ… OpenAPI Documentation - Complete (Swagger UI available)
  • βœ… Frontend MVP - Complete (Full CRUD for Accounts, Categories, Transactions)
  • βœ… gRPC API - Complete (Stage 6: Mobile API with dual-protocol architecture)
  • πŸš€ Current release: v0.4.2 on staging (fixes BE-001: deleted transactions no longer block deleting a category or account; BE-002: category restore name clash returns 409 instead of 500); v0.5.0 (Flutter client) in development

✨ Features

  • πŸ’° Multi-currency support (RSD/EUR/USD with automatic conversion)
  • 🏦 Multiple account types (cash, bank, credit, savings, investment)
  • 🏷️ Hierarchical categories (parent-child structure for income/expense)
  • πŸ“Š Automatic balance calculation via database triggers
  • πŸ‘₯ Multi-user families with data isolation
  • πŸ” JWT authentication with family-based access control
  • πŸ“ˆ Transaction management with filters and pagination
  • πŸ“Š Financial dashboard with monthly summary
  • πŸ“± Responsive UI built with Vue.js 3 and Tailwind CSS
  • πŸ” Advanced filtering by type, account, date range
  • πŸ“„ Pagination for large transaction lists
  • πŸ“‘ gRPC API for mobile clients (dual-protocol: REST + gRPC)

πŸ—οΈ Tech Stack

Backend

  • Language: Go 1.25+
  • Router: Chi v5
  • Database: PostgreSQL 16
  • Query Builder: sqlc (type-safe SQL)
  • Authentication: JWT tokens
  • API Docs: Swagger/OpenAPI 2.0
  • gRPC: Protocol Buffers + gRPC (mobile API)

Frontend

  • Framework: Vue.js 3 (Composition API)
  • Styling: Tailwind CSS
  • Form Validation: VeeValidate + Zod
  • State Management: Pinia
  • HTTP Client: Axios
  • Build Tool: Vite
  • UI Components: Custom component library

πŸ“š Documentation

Business & System Requirements

Located in Documentation/:

API Documentation

Interactive Swagger UI: Available at /swagger/index.html when running the server

  • OpenAPI 2.0 specification with full endpoint documentation
  • Request/Response examples for all 26 endpoints
  • Try it out functionality for testing endpoints directly
  • Schema definitions for all DTOs
  • Authentication flow documentation

Generated specification files in Documentation/swagger/:

  • swagger.json - OpenAPI specification (machine-readable)
  • swagger.yaml - OpenAPI specification (human-readable)
  • docs.go - Embedded Go documentation

πŸ—„οΈ Database Schema

Production-ready PostgreSQL schema with:

  • 7 core tables: families, users, accounts, categories, transactions, exchange_rates, audit_log
  • 10 triggers: automatic timestamp updates, balance calculation, audit logging
  • 5 functions: timestamp updates, balance update, balance recalculation, audit trail, default categories
  • 33 indexes: optimized for common query patterns
  • Complete rollback migrations: every migration has a corresponding drop script

See database/migrations/README.md for details.

Quick Start (Database)

# Apply all migrations (in order; 008 is intentionally absent):
001 create families table
002 create users table
003 create accounts table
004 create categories table
005 create transactions table
006 create exchange rates table
007 create audit log table
009 create default categories function
010 fix account balance trigger
011 add user role
012 exchange rates provenance
013 account name unique
014 fix balance trigger account change

# Load demo data (not a migration):
database/seeds/008_demo_seed_data.sql

Demo credentials:

  • Email: demo@example.com
  • Password: Demo123!

πŸš€ API Endpoints

REST API (port 8080)

The REST API includes 26 endpoints across 8 groups:

Authentication

  • POST /api/v1/auth/login - User login with JWT
  • POST /api/v1/auth/register - Register a new user and family

Health

  • GET /health - Health check
  • GET /ready - Readiness probe

Accounts

  • GET /api/v1/accounts - List all accounts
  • POST /api/v1/accounts - Create account
  • GET /api/v1/accounts/{id} - Get account details
  • PATCH /api/v1/accounts/{id} - Update account
  • DELETE /api/v1/accounts/{id} - Delete account
  • GET /api/v1/accounts/{id}/balance - Get account balance

Categories

  • GET /api/v1/categories - List all categories
  • POST /api/v1/categories - Create category
  • GET /api/v1/categories/{id} - Get category details
  • PATCH /api/v1/categories/{id} - Update category
  • DELETE /api/v1/categories/{id} - Delete category
  • POST /api/v1/categories/{id}/restore - Restore a deleted category

Transactions

  • GET /api/v1/transactions - List transactions (with filters & pagination)
  • POST /api/v1/transactions - Create transaction
  • GET /api/v1/transactions/{id} - Get transaction details
  • PATCH /api/v1/transactions/{id} - Update transaction
  • DELETE /api/v1/transactions/{id} - Delete transaction

Reports

  • GET /api/v1/reports/spending-by-category - Spending analysis
  • GET /api/v1/reports/monthly-summary - Monthly financial summary

Currencies

  • GET /api/v1/currencies/rates - Get exchange rates
  • GET /api/v1/currencies/convert - Convert currency

Exchange Rates

  • POST /api/v1/exchange-rates/sync - Force exchange-rate sync from the Currency Rate Service

πŸ“š Full documentation with examples: Visit /swagger/index.html after starting the server

gRPC API (port 50051)

Mobile API using Protocol Buffers: 5 services, 16 RPCs. Proto definitions in proto/ (7 files).

Service RPCs Methods
AuthService 2 Login, ValidateToken
AccountService 4 ListAccounts, CreateAccount, UpdateAccount, DeleteAccount
TransactionService 4 ListTransactions, CreateTransaction, UpdateTransaction, DeleteTransaction
CategoryService 4 ListCategories, CreateCategory, UpdateCategory, DeleteCategory
ReportService 2 GetSpendingByCategory, GetMonthlySummary

common.proto holds shared messages; currency_rate.proto is the client contract for the external Currency Rate Service (not served by this backend).

Authentication: JWT token via gRPC metadata header authorization: Bearer <token>

Testing with grpcurl (from project root):

# Get JWT token first
curl -s -X POST http://localhost:8080/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"demo@example.com","password":"Demo123!"}' | jq .data.token

# List accounts
grpcurl -plaintext \
  -proto proto/accounts.proto \
  -H "authorization: Bearer <token>" \
  localhost:50051 expense_tracker.v1.AccountService/ListAccounts

# List transactions with filters
grpcurl -plaintext \
  -proto proto/transactions.proto \
  -H "authorization: Bearer <token>" \
  -d '{"month": "2025-12", "page": 1, "per_page": 20}' \
  localhost:50051 expense_tracker.v1.TransactionService/ListTransactions

🎨 Demo

Demo environment (Hetzner VPS):

Service URL
Web Frontend https://demo-expensetracker.digitlock.systems
REST API https://api-demo-expensetracker.digitlock.systems
REST API (direct) <demo-host>:8081
gRPC API <demo-host>:50051 (plaintext)

Demo credentials: demo@example.com / Demo123!

Note: gRPC is accessible via direct IP only β€” Cloudflare free plan does not proxy gRPC traffic.

πŸ“‹ Project Structure

expense-tracker/
β”œβ”€β”€ Documentation/          # Business and system requirements
β”‚   β”œβ”€β”€ expense_tracker_brd.md
β”‚   β”œβ”€β”€ expense_tracker_srs_mvp.md
β”‚   β”œβ”€β”€ swagger/           # OpenAPI documentation
β”‚   β”‚   β”œβ”€β”€ docs.go        # Generated Swagger docs
β”‚   β”‚   β”œβ”€β”€ swagger.json   # OpenAPI 2.0 spec
β”‚   β”‚   └── swagger.yaml   # OpenAPI 2.0 spec (YAML)
β”œβ”€β”€ proto/                  # Protocol Buffer definitions
β”‚   β”œβ”€β”€ auth.proto          # AuthService (2 RPCs)
β”‚   β”œβ”€β”€ accounts.proto      # AccountService (4 RPCs)
β”‚   β”œβ”€β”€ transactions.proto  # TransactionService (4 RPCs)
β”‚   β”œβ”€β”€ categories.proto    # CategoryService (4 RPCs)
β”‚   β”œβ”€β”€ reports.proto       # ReportService (2 RPCs)
β”‚   β”œβ”€β”€ common.proto        # Shared messages
β”‚   └── currency_rate.proto # Currency Rate Service client contract
β”œβ”€β”€ database/
β”‚   └── migrations/        # SQL migration files
β”œβ”€β”€ cmd/
β”‚   └── server/           # Application entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ api/              # HTTP handlers and routing
β”‚   β”‚   β”œβ”€β”€ handlers/     # Request handlers (with Swagger annotations)
β”‚   β”‚   └── middleware/   # Auth, logging, recovery
β”‚   β”œβ”€β”€ auth/             # JWT service
β”‚   β”œβ”€β”€ config/           # Configuration management
β”‚   β”œβ”€β”€ database/         # Database layer
β”‚   β”‚   β”œβ”€β”€ queries/      # SQL queries for sqlc
β”‚   β”‚   └── sqlc/         # Generated type-safe code
β”‚   β”œβ”€β”€ dto/              # Data transfer objects (with Swagger tags)
β”‚   β”œβ”€β”€ grpc/             # gRPC server
β”‚   β”‚   β”œβ”€β”€ pb/           # Generated protobuf Go code
β”‚   β”‚   β”œβ”€β”€ handlers/     # gRPC service implementations
β”‚   β”‚   β”œβ”€β”€ interceptors/ # Auth and logging interceptors
β”‚   β”‚   └── server.go     # gRPC server setup
β”‚   └── repository/       # Business logic layer
β”œβ”€β”€ frontend/             # Vue.js 3 application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/         # API client
β”‚   β”‚   β”œβ”€β”€ components/  # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ forms/   # Form components
β”‚   β”‚   β”‚   β”œβ”€β”€ modals/  # Modal dialogs
β”‚   β”‚   β”‚   └── ui/      # Base UI components
β”‚   β”‚   β”œβ”€β”€ composables/ # Vue composables
β”‚   β”‚   β”œβ”€β”€ router/      # Vue Router config
β”‚   β”‚   β”œβ”€β”€ schemas/     # Zod validation schemas
β”‚   β”‚   β”œβ”€β”€ stores/      # Pinia stores
β”‚   β”‚   β”œβ”€β”€ types/       # TypeScript types
β”‚   β”‚   └── views/       # Page components
β”‚   β”œβ”€β”€ public/
β”‚   └── package.json
β”œβ”€β”€ buf.yaml              # buf lint configuration
β”œβ”€β”€ buf.gen.yaml          # buf code generation configuration
β”œβ”€β”€ .env                  # Environment variables
β”œβ”€β”€ go.mod               # Go module definition
└── sqlc.yaml            # sqlc configuration

πŸš€ Roadmap

Phase 1: Database Foundation βœ…

  • Schema design
  • Migration scripts
  • Automatic balance calculation
  • Audit logging
  • Demo seed data

Phase 2: Backend API βœ…

  • Database package (Go + sqlc)
  • REST API endpoints (26 endpoints)
  • JWT authentication
  • Business logic layer
  • Input validation
  • CORS configuration
  • Family-based data isolation

Phase 3: Documentation βœ…

  • OpenAPI/Swagger specification
  • Interactive API documentation (Swagger UI)
  • Request/Response examples
  • Authentication flow documentation
  • Postman collection export

Phase 4: Frontend βœ…

  • Vue.js 3 setup with Vite
  • API client with Axios
  • Authentication UI (Login)
  • Dashboard with financial summary
  • Accounts management (full CRUD)
  • Categories management (full CRUD with hierarchy)
  • Transactions management (full CRUD with filters)
  • Form validation with VeeValidate + Zod
  • Responsive design with Tailwind CSS
  • Reusable component library

Phase 5: Testing & QA πŸ§ͺ

  • Manual testing (in progress)
  • Bug fixes and improvements
  • Unit tests (backend)
  • Integration tests
  • E2E tests (frontend)
  • Performance optimization
  • Security audit

Phase 6: gRPC API βœ…

  • Protocol Buffer definitions (5 services, 16 RPCs)
  • Code generation with buf + protoc
  • gRPC server with dual-protocol architecture (REST :8080 + gRPC :50051)
  • JWT auth interceptor (reuses existing JWT service)
  • Logging interceptor
  • All 16 RPCs across Auth, Account, Transaction, Category and Report services (v0.4.0)
  • Tested with grpcurl

Phase 7: Deployment πŸ“‹

  • Docker containerization
  • CI/CD pipeline
  • Production deployment
  • Monitoring and logging
  • Backup strategy

πŸ“„ License

This project is licensed under the MIT License.
See the LICENSE file for details.

πŸ‘€ Author

Igor Kudinov

This project is part of my professional portfolio demonstrating:

  • Requirements analysis and documentation
  • Database design and implementation
  • Backend development (Go)
  • REST API design
  • OpenAPI/Swagger documentation
  • Type-safe code generation (sqlc)
  • Frontend development (Vue.js 3)
  • gRPC API design and implementation
  • Dual-protocol architecture (REST + gRPC)
  • Protocol Buffers and code generation
  • Full-stack application architecture
  • DevOps and deployment

πŸ”— Links

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages