A comprehensive personal finance management application built with Go backend and React frontend, designed to help users track expenses, manage budgets, set savings goals, and gain AI-powered financial insights.
FityBudget is a full-stack financial management platform that enables users to:
- Track income and expenses across multiple wallets
- Set and monitor savings goals with progress tracking
- Create and manage budgets with alerts and rollover options
- Visualize spending patterns with analytics and charts
- Receive AI-powered financial insights and recommendations
- Manage multiple payment methods (Mobile Money, Bank, Cash, Credit)
- Language: Go 1.21+
- Web Framework: Gin (HTTP web framework)
- Database: PostgreSQL 15+
- ORM: GORM (Go Object-Relational Mapping)
- Authentication: JWT (JSON Web Tokens)
- Password Hashing: bcrypt
- Validation: go-playground/validator
- Framework: React 19.2
- Language: TypeScript
- Build Tool: Vite 6.2
- UI Library: Lucide React (icons)
- Charts: Recharts 3.5
- AI Integration: Google Generative AI (Gemini)
- PostgreSQL 15+ with UUID primary keys
- GORM for migrations and ORM operations
- Soft deletes for data recovery
- Comprehensive indexing for performance
The backend follows Clean Architecture principles:
┌─────────────────────────────────────────────────────────────┐
│ HTTP Layer │
│ (Handlers/Controllers) │
├─────────────────────────────────────────────────────────────┤
│ Middleware Layer │
│ (Auth, CORS, Logging, Validation) │
├─────────────────────────────────────────────────────────────┤
│ Service Layer │
│ (Business Logic) │
├─────────────────────────────────────────────────────────────┤
│ Repository Layer │
│ (Database Operations) │
├─────────────────────────────────────────────────────────────┤
│ Data Layer │
│ (Models/Entities) │
└─────────────────────────────────────────────────────────────┘
fity-budget/
├── backend/ # Go backend application
│ ├── cmd/
│ │ ├── server/ # Main server entry point
│ │ └── migrate/ # Database migration utility
│ ├── internal/
│ │ ├── api/
│ │ │ ├── handlers/ # HTTP request handlers
│ │ │ ├── middleware/ # HTTP middleware (auth, CORS, logging)
│ │ │ └── routes/ # Route definitions
│ │ ├── models/ # Database models (GORM)
│ │ ├── repository/ # Data access layer
│ │ ├── services/ # Business logic layer
│ │ ├── config/ # Configuration management
│ │ └── utils/ # Utilities (JWT, response, validation)
│ ├── migrations/ # Database migration files
│ ├── tests/
│ │ ├── unit/ # Unit tests (75 test cases)
│ │ └── integration/ # Integration tests (42 test cases)
│ ├── go.mod
│ └── go.sum
├── frontend/ # React frontend application
│ ├── components/ # React components
│ ├── contexts/ # React contexts (auth, theme)
│ ├── hooks/ # Custom React hooks
│ ├── services/ # API service clients
│ ├── utils/ # Utility functions
│ ├── App.tsx # Main application component
│ ├── index.tsx # Application entry point
│ ├── types.ts # TypeScript type definitions
│ ├── constants.ts # Application constants
│ ├── package.json
│ └── vite.config.ts
├── docs/ # Documentation
│ ├── ARCHITECTURE.md # Architecture overview
│ ├── DATABASE_SCHEMA.md # Database schema details
│ ├── API_ENDPOINTS.md # API documentation
│ ├── SETUP_GUIDE.md # Development setup guide
│ └── TEST_SUMMARY.md # Test coverage summary
└── README.md # This file
- User Authentication: Secure registration and login with JWT tokens
- Transaction Management: Create, read, update, delete transactions with categorization
- Budget Tracking: Set category budgets with alerts and spending visualization
- Savings Goals: Track progress toward financial goals with deadlines and priorities
- Wallet Management: Multiple wallet support (Mobile Money, Bank, Cash, Credit)
- Analytics Dashboard: Real-time financial statistics and insights
- AI Insights: Gemini-powered financial recommendations
- JWT-based authentication
- Bcrypt password hashing (cost factor 12)
- CORS protection
- Input validation and sanitization
- Row-level security via user_id checks
- Soft deletes for data recovery
- Go 1.21 or higher
- Node.js 18 or higher
- PostgreSQL 15 or higher
- Git
-
Clone the repository
git clone https://github.com/yourusername/fity-budget.git cd fity-budget -
Set up the backend
cd backend # Install dependencies go mod tidy # Create .env file cp .env.example .env # Edit .env with your database credentials # Run migrations go run cmd/migrate/main.go # Start the server go run cmd/server/main.go
Backend will start on
http://localhost:8080 -
Set up the frontend
cd frontend # Install dependencies npm install # Create .env file cp .env.example .env.local # Edit .env.local with your API URL and Gemini API key # Start the development server npm run dev
Frontend will start on
http://localhost:5173 -
Set up the database
# Connect to PostgreSQL psql -U postgres # Create database CREATE DATABASE fity_budget; \q
For detailed setup instructions, see SETUP_GUIDE.md
The API provides RESTful endpoints for all features. See API_ENDPOINTS.md for complete documentation.
- Development:
http://localhost:8080/api/v1 - Production:
https://api.fitybudget.com/api/v1
Authentication
POST /auth/register- Register new userPOST /auth/login- Login userGET /auth/me- Get current userPUT /auth/profile- Update profilePOST /auth/onboarding- Complete onboarding
Transactions
GET /transactions- List transactions (paginated)POST /transactions- Create transactionGET /transactions/:id- Get transactionPUT /transactions/:id- Update transactionDELETE /transactions/:id- Delete transactionGET /transactions/stats- Get transaction statistics
Savings Goals
GET /goals- List goalsPOST /goals- Create goalGET /goals/:id- Get goalPUT /goals/:id- Update goalPATCH /goals/:id/progress- Update goal progressDELETE /goals/:id- Delete goal
Budgets
GET /budgets- List budgetsPOST /budgets- Create budgetGET /budgets/:id- Get budgetPUT /budgets/:id- Update budgetDELETE /budgets/:id- Delete budgetGET /budgets/summary- Get budget summary
Wallets
GET /wallets- List walletsPOST /wallets- Create walletGET /wallets/:id- Get walletPUT /wallets/:id- Update walletDELETE /wallets/:id- Delete wallet
Analytics
GET /analytics/dashboard- Get dashboard statsGET /analytics/money-flow- Get income/expense flowGET /analytics/spending- Get spending analysisGET /analytics/insights- Get AI insights
The application uses PostgreSQL with the following main tables:
- users - User accounts and authentication
- transactions - Financial transactions
- saving_goals - Savings goals with progress tracking
- budgets - Budget limits and alerts
- wallets - Payment methods and accounts
See DATABASE_SCHEMA.md for detailed schema information.
- Unit Tests: 75 test cases covering all handlers
- Integration Tests: 42 test cases covering full request/response cycles
- Total Coverage: 100% of API endpoints
# Backend unit tests
cd backend
go test ./tests/unit/... -v
# Backend integration tests
go test ./tests/integration/... -v
# Run with coverage
go test ./... -cover
# Run specific tests
go test -run TestAuthHandler ./tests/unit/handlers/... -v✅ Auth Handler: 15 tests passing
✅ Transaction Handler: 26 tests passing
✅ Goals Handler: 18 tests passing
✅ Budgets Handler: 4 tests passing
✅ Wallets Handler: 4 tests passing
✅ Analytics Handler: 8 tests passing
See TEST_SUMMARY.md for detailed test information.
cd backend
# Run server with hot reload (if air is installed)
air
# Format code
go fmt ./...
# Lint code (if golangci-lint is installed)
golangci-lint run
# Run tests
go test ./... -vcd frontend
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Type check
npx tsc --noEmitPORT=8080
ENV=development
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=your_password
DB_NAME=fity_budget
DB_SSLMODE=disable
JWT_SECRET=your-secret-key
JWT_EXPIRY=15m
CORS_ORIGINS=http://localhost:5173,http://localhost:3000
GEMINI_API_KEY=your-gemini-api-keyVITE_API_URL=http://localhost:8080/api/v1
VITE_GEMINI_API_KEY=your-gemini-api-key- Build the binary:
go build -o server cmd/server/main.go - Set production environment variables
- Run migrations:
./server migrate - Start the server:
./server
- Build the production bundle:
npm run build - Serve the
dist/directory with a web server (Nginx, Caddy, etc.) - Configure environment variables for production API URL
- Change JWT secret to a strong random value
- Set
ENV=productionin backend - Enable SSL/TLS for database connections
- Configure proper CORS origins
- Set up database backups
- Enable logging and monitoring
- Configure rate limiting
- Set up SSL certificates (Let's Encrypt)
- Configure reverse proxy (Nginx/Caddy)
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Go best practices and clean architecture principles
- Write tests for all new features
- Update documentation for API changes
- Use conventional commit messages
- Ensure all tests pass before submitting PR
This project is licensed under the MIT License - see the LICENSE file for details.
- Gin - HTTP web framework
- GORM - ORM library
- React - Frontend framework
- Vite - Build tool
- Recharts - Charting library
- Google Gemini - AI insights
For issues, questions, or contributions:
- Create an issue on GitHub
- Check the documentation in the
docs/folder - Review the setup guide for troubleshooting
- Mobile applications (iOS/Android)
- Recurring transactions
- Multi-currency support with conversion
- Bill reminders and notifications
- Family/shared budgets
- Export data (CSV, PDF)
- Bank account integration
- Receipt scanning with OCR
- Investment tracking
- Tax reporting