USAGE.mdā¢3.71 kB
# Expense Tracker - Usage Guide
## Getting Started
### 1. Start the Server
```bash
cd server
python start.py
```
This will start both the API server (port 8002) and MCP server (port 9002).
### 2. Access the Dashboard
Open your browser and navigate to:
```
http://localhost:8002/
```
### 3. Add Sample Data
To see the dashboard in action with sample transactions:
```bash
python seed_data.py
```
This will create sample income and expense transactions.
## Using the Dashboard
### Overview Cards
The dashboard displays three main statistics:
1. **Total Income** - Sum of all income transactions (green)
2. **Total Expenses** - Sum of all expense transactions (red)
3. **Net Balance** - Income minus expenses (green/red based on value)
### Category Summary
- Shows breakdown of transactions by category
- Displays total amount and transaction count per category
- Visual progress bars show percentage of total
- Categories are sorted by amount (highest first)
### Latest Transactions
- Displays the 10 most recent transactions
- Shows title, category, type (income/expense), amount, and date
- Color-coded amounts (green for income, red for expenses)
- Auto-refreshes every 30 seconds
## API Usage
### Create a Transaction
```bash
curl -X POST "http://localhost:8002/transactions" \
-H "Content-Type: application/json" \
-d '{
"title": "Coffee",
"amount": 5.50,
"type": "expense",
"category": "food",
"description": "Morning coffee",
"tags": ["coffee", "daily"]
}'
```
### Get All Transactions
```bash
curl "http://localhost:8002/transactions"
```
### Get Summary
```bash
curl "http://localhost:8002/summary"
```
### Get Category Summary
```bash
curl "http://localhost:8002/summary/categories"
```
### Search Transactions
```bash
curl "http://localhost:8002/transactions/search?q=coffee"
```
## Available Categories
### Income Categories
- `salary` - Regular salary payments
- `freelance` - Freelance work income
- `investment` - Investment returns
- `business` - Business income
- `other_income` - Other income sources
### Expense Categories
- `food` - Food and dining
- `transportation` - Transport and fuel
- `housing` - Rent and housing costs
- `utilities` - Bills and utilities
- `healthcare` - Medical expenses
- `entertainment` - Entertainment and subscriptions
- `shopping` - Shopping and purchases
- `education` - Educational expenses
- `travel` - Travel costs
- `other_expense` - Other expenses
## Interactive API Documentation
FastAPI provides automatic interactive documentation:
- **Swagger UI**: http://localhost:8002/docs
- **ReDoc**: http://localhost:8002/redoc
Use these interfaces to:
- Test API endpoints
- View request/response schemas
- Execute API calls directly from the browser
## Tips
1. **Auto-refresh**: The dashboard automatically refreshes every 30 seconds
2. **Mobile-friendly**: The dashboard is responsive and works on all devices
3. **Dark theme**: Optimized for comfortable viewing in any lighting
4. **Real-time**: All changes are reflected immediately in the dashboard
## Troubleshooting
### Dashboard not loading?
- Ensure the server is running: `python start.py`
- Check http://localhost:8002/health to verify server is up
### No data showing?
- Run `python seed_data.py` to add sample transactions
- Create transactions via the API or interactive docs
### Port already in use?
- Change the port in `config.py`
- Or set environment variable: `PORT=8003 python start.py`
## Next Steps
- Integrate with the MCP server for AI assistant functionality
- Use the Telegram bot to add transactions on the go
- Extend the dashboard with charts and visualizations
- Add user authentication and multi-user support