A comprehensive personal finance management system supporting investment portfolio tracking, cash flow management, subscription/installment billing, and financial analytics with real-time valuations and detailed reporting.
- Overview
- Features
- Tech Stack
- Project Structure
- Getting Started
- Development
- Architecture
- Development Progress
- API Endpoints
- Documentation
- Contributing
- License
- Support
- Acknowledgments
Asset Manager is a full-stack application designed to help users manage their personal finances comprehensively. The system supports:
- Taiwan Stocks (台股)
- U.S. Stocks (美股)
- Cryptocurrencies (加密貨幣)
- Cash Holdings (現金)
- Cash Flow Tracking - Income and expense management with categorization
- Subscription Management - Track recurring subscriptions and auto-billing
- Installment Tracking - Manage payment plans with interest calculations
- Bank & Credit Card Management - Multi-account support with grouping
- Holdings Calculation - FIFO (First-In, First-Out) cost basis calculation
- Performance Analytics - Realized/unrealized P&L tracking
- Asset Allocation - Portfolio composition visualization
- Daily Snapshots - Historical valuation tracking
- Discord Integration - Automated daily reports and alerts
- ✅ Transaction management (Buy, Sell, Dividend, Fee, Tax)
- ✅ Multi-asset support (Taiwan stocks, U.S. stocks, cryptocurrencies, cash)
- ✅ FIFO cost basis calculation
- ✅ Holdings tracking with real-time valuations
- ✅ Asset allocation by type and individual assets
- ✅ CSV import/export for transactions
- ✅ Batch transaction creation
- ✅ Realized profit/loss calculation
- ✅ Unrealized profit/loss tracking
- ✅ Performance trends with daily snapshots
- ✅ Time-range based analytics (week, month, quarter, year, all)
- ✅ Top performing/underperforming assets
- ✅ Asset allocation visualization
- ✅ Income and expense tracking with categorization
- ✅ Predefined and custom categories
- ✅ Monthly/yearly cash flow reports
- ✅ Summary statistics and trends
- ✅ Discord integration for reports
- ✅ Subscription creation and management
- ✅ Automatic daily billing
- ✅ Installment tracking with interest calculations
- ✅ Payment progress visualization
- ✅ Expiration reminders and alerts
- ✅ Auto-renewal settings
- ✅ Bank account tracking
- ✅ Credit card management
- ✅ Credit card grouping
- ✅ Multi-account support
- ✅ JWT authentication
- ✅ Role-based access control
- ✅ Settings management (notifications, preferences)
- ✅ Discord webhook integration
- ✅ Scheduled tasks (daily snapshots, billing, reports)
- ✅ Exchange rate management
- ✅ Graceful API degradation with caching
- ✅ Comprehensive error handling
- Framework: Next.js 16 (App Router)
- Language: TypeScript 5
- UI Library: shadcn/ui (Tailwind CSS 4)
- State Management: TanStack Query 5 (React Query)
- Form Management: react-hook-form 7 + zod 4
- Charts: Recharts 2
- Date Handling: date-fns 4
- Notifications: Sonner
- Package Manager: pnpm
- Runtime: React 19, Node.js 18+
- Language: Go 1.24
- Web Framework: Gin 1.11
- Database: PostgreSQL 12+
- Cache/Queue: Redis 9
- Authentication: JWT (golang-jwt/jwt v5)
- Migration: golang-migrate
- Testing: testify 1.11
- Task Scheduling: robfig/cron v3
- HTTP Client: Standard library + custom clients
- Containerization: Docker
- Orchestration: Docker Compose
- Reverse Proxy: Nginx
- Deployment Target: AWS EC2
- CI/CD: GitHub Actions (ready for setup)
asset-manager/
├── frontend/ # Next.js frontend application
│ ├── src/
│ │ ├── app/ # Next.js App Router pages
│ │ │ ├── dashboard/ # Dashboard page
│ │ │ ├── transactions/ # Transaction management
│ │ │ ├── holdings/ # Holdings tracking
│ │ │ ├── cash-flows/ # Cash flow management
│ │ │ ├── recurring/ # Subscriptions & installments
│ │ │ ├── analytics/ # Performance analytics
│ │ │ ├── settings/ # User settings
│ │ │ └── user-management/ # User management
│ │ ├── components/ # React components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── lib/ # Utilities and API clients
│ │ ├── types/ # TypeScript type definitions
│ │ └── providers/ # Context providers
│ ├── doc/ # Documentation
│ └── package.json
│
├── backend/ # Go backend application
│ ├── cmd/
│ │ ├── api/ # Main API server
│ │ ├── snapshot/ # Snapshot utility
│ │ └── [other utilities]/ # Various CLI tools
│ ├── internal/
│ │ ├── api/ # HTTP handlers
│ │ ├── models/ # Data models and DTOs
│ │ ├── repository/ # Data access layer
│ │ ├── service/ # Business logic layer
│ │ ├── db/ # Database connection
│ │ ├── auth/ # Authentication
│ │ ├── middleware/ # HTTP middleware
│ │ ├── cache/ # Caching layer
│ │ ├── external/ # External API clients
│ │ ├── scheduler/ # Task scheduling
│ │ └── client/ # HTTP clients
│ ├── migrations/ # Database migrations (23 files)
│ ├── mock/ # Mock data
│ ├── test/ # Integration tests
│ ├── scripts/ # Utility scripts
│ ├── doc/ # Documentation
│ └── go.mod
│
├── scripts/ # Project-level scripts
├── docker-compose.yml # Docker Compose configuration
├── nginx.conf # Nginx configuration
└── README.md # This fileBefore you begin, ensure you have the following installed:
- Go 1.24 or higher (Download)
- PostgreSQL 12 or higher (Download)
- Redis 6+ (optional, for caching and scheduling)
- Node.js 18+ and pnpm (Installation Guide)
- Docker & Docker Compose (optional, for containerized setup)
The easiest way to get started is using Docker Compose:
# Clone the repository
git clone https://github.com/chienchuanw/asset-manager.git
cd asset-manager
# Start all services (PostgreSQL, Redis, Backend, Frontend)
docker-compose up -d
# Backend API: http://localhost:8080
# Frontend: http://localhost:3000cd backend
# Install Go dependencies
go mod download
# Create environment file
cp .env.example .env
# Edit .env with your database credentials
# Create databases
psql -U postgres -c "CREATE DATABASE asset_manager;"
psql -U postgres -c "CREATE DATABASE asset_manager_test;"
# Run migrations
make migrate-up
# Run tests
make test
# Start the server
make runThe API server will start at http://localhost:8080.
cd frontend
# Install dependencies
pnpm install
# Create environment file
cp .env.example .env.local
# Edit .env.local with API URL (default: http://localhost:8080)
# Start development server
pnpm devThe frontend will start at http://localhost:3000.
cd backend
make testmake test-unit# Set test database environment variables
export TEST_DB_HOST=localhost
export TEST_DB_PORT=5432
export TEST_DB_USER=postgres
export TEST_DB_PASSWORD=your_password
export TEST_DB_NAME=asset_manager_test
make test-integration# Backend
cd backend
# Install dependencies
make install
# Run linter
make lint
# Format code
make fmt
# Run migrations
make migrate-up
make migrate-down
# Seed test data
make seed
# Frontend
cd frontend
# Install dependencies
pnpm install
# Type check
pnpm tsc --noEmit
# Build
pnpm build
# Start dev server
pnpm dev-
Backend: Follow
.augment/rules/coding-standards.md- Use
gofmtandgoimportsfor formatting - Use
golangci-lintfor linting - Write tests using TDD approach
- Use meaningful variable names and comments in Chinese
- Use
-
Frontend: Follow
.augment/rules/coding-standards.md- Use Prettier for formatting
- Use ESLint with TypeScript rules
- Follow React best practices
- Use TypeScript strictly
The backend follows a clean architecture pattern with clear separation of concerns:
HTTP Request
↓
Middleware (Auth, CORS, Logging)
↓
API Handler Layer (HTTP handling, request/response formatting)
↓
Service Layer (Business logic, validation, orchestration)
↓
Repository Layer (Data access, SQL queries)
↓
Database (PostgreSQL) / Cache (Redis)
-
API Handler Layer (
internal/api/)- HTTP request/response handling
- Input validation and parsing
- Error handling and status codes
- 20+ handlers for different features
-
Service Layer (
internal/service/)- Business logic implementation
- Data validation and transformation
- Orchestration of multiple repositories
- External API integration
- 20+ services for different domains
-
Repository Layer (
internal/repository/)- Database CRUD operations
- SQL query construction
- Data mapping and transactions
- 15+ repositories for different entities
-
Models Layer (
internal/models/)- Data structure definitions
- Input/output DTOs
- Validation methods
- 30+ model types
- Middleware (
internal/middleware/) - Authentication, CORS, logging - Auth (
internal/auth/) - JWT token generation and validation - Cache (
internal/cache/) - Redis caching layer - External (
internal/external/) - External API clients - Scheduler (
internal/scheduler/) - Task scheduling and management - Database (
internal/db/) - Database connection and initialization
User Interface (Next.js Pages)
↓
React Components (Presentational)
↓
Custom Hooks (Data fetching, state management)
↓
API Client Layer (HTTP requests)
↓
Backend API
- Pages (
src/app/) - Next.js App Router pages - Components (
src/components/) - Reusable React components - Hooks (
src/hooks/) - Custom React hooks for data fetching - API Client (
src/lib/) - API communication layer - Types (
src/types/) - TypeScript type definitions - Providers (
src/providers/) - Context providers and configuration
For detailed architecture documentation, see backend/doc/ARCHITECTURE.md.
Status: Fully implemented and tested
- ✅ Database schema and migrations
- ✅ Transaction CRUD API
- ✅ Multi-asset support (stocks, crypto, cash)
- ✅ CSV import/export functionality
- ✅ Comprehensive test coverage
- ✅ Complete documentation
Status: Fully implemented with all core pages
- ✅ Dashboard with overview statistics
- ✅ Transaction management page
- ✅ Holdings tracking page
- ✅ API client layer with React Query
- ✅ Form validation with react-hook-form + zod
- ✅ Authentication system
Status: Fully implemented with FIFO calculations
- ✅ FIFO cost basis calculation
- ✅ Holdings API endpoints
- ✅ Realized/unrealized P&L tracking
- ✅ Asset allocation calculations
- ✅ Performance trends with daily snapshots
- ✅ Analytics dashboard with charts
Status: Fully implemented with categorization
- ✅ Income/expense tracking
- ✅ Category management
- ✅ Monthly/yearly reports
- ✅ Summary statistics
- ✅ Discord integration for reports
Status: Fully implemented with auto-billing
- ✅ Subscription creation and management
- ✅ Installment tracking with interest
- ✅ Automatic daily billing
- ✅ Payment progress visualization
- ✅ Expiration reminders
Status: Fully implemented
- ✅ Bank account tracking
- ✅ Credit card management
- ✅ Credit card grouping
- ✅ Multi-account support
Status: Fully implemented
- ✅ JWT authentication
- ✅ Settings management
- ✅ Discord webhook integration
- ✅ Scheduled tasks (snapshots, billing, reports)
- ✅ Exchange rate management
- ✅ Graceful API degradation with caching
- ✅ Docker containerization
- ✅ Nginx reverse proxy configuration
- Tax reporting and export
- Portfolio rebalancing recommendations
- Risk analysis and metrics
- Benchmark comparison
- Custom report generation
- Mobile app (React Native)
- Push notifications
- Email notifications
- SMS alerts
- Webhook support for custom integrations
- Multi-user support
- Role-based access control (RBAC)
- Shared portfolios
- Audit logging
- User activity tracking
- Machine learning for predictions
- Automated trading signals
- Portfolio optimization
- Tax-loss harvesting recommendations
- Integration with brokers (API)
- Multi-currency support (beyond TWD/USD)
- Advanced reporting (PDF/Excel export)
- Data backup and recovery
- API rate limiting and quotas
- White-label support
POST /auth/login- User loginPOST /auth/register- User registrationPOST /auth/refresh- Refresh JWT token
POST /api/transactions- Create transactionPOST /api/transactions/batch- Batch create transactionsGET /api/transactions- List transactions (with filters)GET /api/transactions/:id- Get transaction by IDPUT /api/transactions/:id- Update transactionDELETE /api/transactions/:id- Delete transactionGET /api/transactions/template- Download CSV templatePOST /api/transactions/parse-csv- Parse CSV file
GET /api/holdings- Get all holdingsGET /api/holdings/:symbol- Get holding by symbol
GET /api/analytics/summary- Get analytics summaryGET /api/analytics/performance- Get performance dataGET /api/analytics/top-assets- Get top performing assetsGET /api/analytics/unrealized- Get unrealized P&L
GET /api/allocation/current- Get current allocationGET /api/allocation/by-type- Get allocation by asset typeGET /api/allocation/by-asset- Get allocation by individual asset
POST /api/cash-flows- Create cash flow recordGET /api/cash-flows- List cash flows (with filters)GET /api/cash-flows/:id- Get cash flow by IDPUT /api/cash-flows/:id- Update cash flowDELETE /api/cash-flows/:id- Delete cash flowGET /api/cash-flows/summary- Get cash flow summary
POST /api/categories- Create categoryGET /api/categories- List categoriesPUT /api/categories/:id- Update categoryDELETE /api/categories/:id- Delete category
POST /api/subscriptions- Create subscriptionGET /api/subscriptions- List subscriptionsGET /api/subscriptions/expiring-soon- Get expiring subscriptionsPUT /api/subscriptions/:id- Update subscriptionDELETE /api/subscriptions/:id- Delete subscription
POST /api/installments- Create installmentGET /api/installments- List installmentsGET /api/installments/completing-soon- Get completing installmentsPUT /api/installments/:id- Update installmentDELETE /api/installments/:id- Delete installment
GET /api/settings- Get user settingsPUT /api/settings- Update user settings
POST /api/discord/test- Test Discord webhookPOST /api/discord/daily-report- Send daily report
For complete API documentation, see the backend documentation files in backend/doc/.
This is a personal project, but suggestions and feedback are welcome!
- Follow TDD (Test-Driven Development) approach
- Write tests before implementation
- Ensure all tests pass before committing
- Follow the coding standards in
.augment/rules/ - Use meaningful commit messages in English
-
Backend (Go)
- Use
gofmtandgoimportsfor formatting - Follow clean architecture principles
- Write comprehensive tests
- Use meaningful variable names and Chinese comments
- Handle all errors explicitly
- Use
-
Frontend (TypeScript/React)
- Use Prettier for formatting
- Follow React best practices
- Use TypeScript strictly
- Component-based architecture
- Write Chinese comments for complex logic
For detailed coding standards, see .augment/rules/coding-standards.md.
backend/doc/ARCHITECTURE.md- System architecturebackend/doc/QUICK_START.md- Quick start guidebackend/doc/TESTING_GUIDE.md- Testing guidebackend/doc/DEPLOYMENT.md- Deployment guidebackend/doc/ANALYTICS_COMPLETE_SUMMARY.md- Analytics feature documentation
frontend/doc/PHASE_6_SUMMARY.md- Frontend implementation summaryfrontend/README.md- Frontend setup guide
This project is for personal use.
For questions or issues:
- Check the documentation in
backend/doc/andfrontend/doc/directories - Review the Quick Start Guide
- Check the Architecture Documentation
- Review the Testing Guide
- Go - Programming language
- Gin - Web framework
- PostgreSQL - Database
- Redis - Cache and message broker
- testify - Testing framework
- golang-jwt - JWT authentication
- Next.js - React framework
- React - UI library
- TypeScript - Type safety
- shadcn/ui - Component library
- Tailwind CSS - Styling
- TanStack Query - Data fetching
- Recharts - Charting library
Last Updated: 2025-11-16 Current Version: Phase 7 Complete (All Core Features Implemented) Status: Production Ready