Blame
|
1 | # Pocket Change Showdown |
||||||
| 2 | ||||||||
| 3 | > Track every penny of your moving expenses with style! 💰 |
|||||||
| 4 | ||||||||
| 5 | <div align="center"> |
|||||||
| 6 | ||||||||
|
7 | <img src="https://teb.codes/2-Code/Flask/Pcs/logo.png" alt="logo" width="200"/> |
||||||
| 8 | [logo.png](./logo.png) |
|||||||
|
9 | |||||||
| 10 |  |
|||||||
| 11 |  |
|||||||
| 12 |  |
|||||||
| 13 |  |
|||||||
| 14 | ||||||||
| 15 | [Features](#features) • [Quick Start](#quick-start) • [Installation](#installation) • [Documentation](#documentation) • [Contributing](#contributing) |
|||||||
| 16 | ||||||||
| 17 | </div> |
|||||||
| 18 | ||||||||
| 19 | --- |
|||||||
| 20 | ||||||||
| 21 | ## 📋 Table of Contents |
|||||||
| 22 | ||||||||
| 23 | - [Features](#features) |
|||||||
| 24 | - [Screenshots](#screenshots) |
|||||||
| 25 | - [Quick Start](#quick-start) |
|||||||
| 26 | - [Installation](#installation) |
|||||||
| 27 | - [Docker](#docker) |
|||||||
| 28 | - [Kubernetes](#kubernetes) |
|||||||
| 29 | - [Local Development](#local-development) |
|||||||
| 30 | - [Configuration](#configuration) |
|||||||
| 31 | - [Usage](#usage) |
|||||||
| 32 | - [API Documentation](#api-documentation) |
|||||||
| 33 | - [Development](#development) |
|||||||
| 34 | - [Contributing](#contributing) |
|||||||
| 35 | - [License](#license) |
|||||||
| 36 | ||||||||
| 37 | ## ✨ Features |
|||||||
| 38 | ||||||||
| 39 | ### Core Functionality |
|||||||
| 40 | - 📸 **Receipt Management** - Upload and store receipt images/PDFs (up to 16MB) |
|||||||
| 41 | - 💳 **Multiple Payment Methods** - Track how you paid (Cash, Credit, Debit, etc.) |
|||||||
| 42 | - 🏷️ **Smart Categorization** - Pre-defined PCS categories (Moving, Travel, Housing, etc.) |
|||||||
| 43 | - 📊 **Analytics Dashboard** - Interactive charts with Chart.js |
|||||||
| 44 | - 🎨 **8 Color Themes** - Personalize your experience |
|||||||
| 45 | - 📱 **Mobile Responsive** - Track expenses on the go |
|||||||
| 46 | - 🔒 **No Login Required** - Simple, secure, and private |
|||||||
| 47 | ||||||||
| 48 | ### Data Management |
|||||||
| 49 | - 📥 **CSV Import** - Bulk upload expenses from spreadsheets |
|||||||
| 50 | - 📤 **CSV Export** - Download all data for records |
|||||||
| 51 | - 📄 **Template Download** - Get started with the right format |
|||||||
| 52 | - 💾 **Persistent Storage** - Data survives container restarts |
|||||||
| 53 | ||||||||
| 54 | ### PCS-Specific Categories |
|||||||
| 55 | - 🚚 Moving |
|||||||
| 56 | - ✈️ Travel |
|||||||
| 57 | - 🏠 Housing |
|||||||
| 58 | - 📦 Storage |
|||||||
| 59 | - 🚗 Transportation |
|||||||
| 60 | - 🏨 Lodging |
|||||||
| 61 | - 🍔 Food |
|||||||
| 62 | - 📦 Supplies |
|||||||
| 63 | - 🛎️ Services |
|||||||
| 64 | - ➕ Custom Categories |
|||||||
| 65 | ||||||||
| 66 | ## 📸 Screenshots |
|||||||
| 67 | ||||||||
| 68 | <details> |
|||||||
| 69 | <summary>Click to view screenshots</summary> |
|||||||
| 70 | ||||||||
| 71 | ### Dashboard |
|||||||
| 72 | Interactive analytics with spending trends and category breakdowns. |
|||||||
| 73 | ||||||||
| 74 | ### Expense Entry |
|||||||
| 75 | Simple form with receipt upload and auto-complete fields. |
|||||||
| 76 | ||||||||
| 77 | ### Settings |
|||||||
| 78 | Manage categories, payment methods, and themes. |
|||||||
| 79 | ||||||||
| 80 | </details> |
|||||||
| 81 | ||||||||
| 82 | ## 🚀 Quick Start |
|||||||
| 83 | ||||||||
| 84 | ### Docker (Recommended) |
|||||||
| 85 | ||||||||
| 86 | ```bash |
|||||||
| 87 | # Pull and run the latest image |
|||||||
| 88 | docker run -d \ |
|||||||
| 89 | --name pcs-tracker \ |
|||||||
| 90 | -p 5001:5001 \ |
|||||||
| 91 | -v pcs-data:/app/data \ |
|||||||
| 92 | -v pcs-uploads:/app/uploads \ |
|||||||
| 93 | tebwritescode/pocket-change-showdown:latest |
|||||||
| 94 | ||||||||
| 95 | # Access at http://localhost:5001 |
|||||||
| 96 | ``` |
|||||||
| 97 | ||||||||
| 98 | ### Docker Compose |
|||||||
| 99 | ||||||||
| 100 | ```bash |
|||||||
| 101 | # Clone the repository |
|||||||
| 102 | git clone https://github.com/tebwritescode/pocket-change-showdown.git |
|||||||
| 103 | cd pocket-change-showdown |
|||||||
| 104 | ||||||||
| 105 | # Start with Docker Compose |
|||||||
| 106 | docker-compose up -d |
|||||||
| 107 | ||||||||
| 108 | # Access at http://localhost:5001 |
|||||||
| 109 | ``` |
|||||||
| 110 | ||||||||
| 111 | ## 📦 Installation |
|||||||
| 112 | ||||||||
| 113 | ### Docker |
|||||||
| 114 | ||||||||
| 115 | #### Multi-Architecture Support |
|||||||
| 116 | Images are available for: |
|||||||
| 117 | - `linux/amd64` (Intel/AMD) |
|||||||
| 118 | - `linux/arm64` (Apple Silicon, ARM servers) |
|||||||
| 119 | - `linux/arm/v7` (Raspberry Pi) |
|||||||
| 120 | ||||||||
| 121 | ```bash |
|||||||
| 122 | # Pull specific architecture |
|||||||
| 123 | docker pull --platform linux/arm64 tebwritescode/pocket-change-showdown:latest |
|||||||
| 124 | ||||||||
| 125 | # Or let Docker auto-select |
|||||||
| 126 | docker pull tebwritescode/pocket-change-showdown:latest |
|||||||
| 127 | ``` |
|||||||
| 128 | ||||||||
| 129 | #### Docker Run Options |
|||||||
| 130 | ||||||||
| 131 | ```bash |
|||||||
| 132 | # Basic deployment |
|||||||
| 133 | docker run -d \ |
|||||||
| 134 | --name pcs-tracker \ |
|||||||
| 135 | -p 5001:5001 \ |
|||||||
| 136 | tebwritescode/pocket-change-showdown:latest |
|||||||
| 137 | ||||||||
| 138 | # With persistent storage |
|||||||
| 139 | docker run -d \ |
|||||||
| 140 | --name pcs-tracker \ |
|||||||
| 141 | -p 5001:5001 \ |
|||||||
| 142 | -v $(pwd)/data:/app/data \ |
|||||||
| 143 | -v $(pwd)/uploads:/app/uploads \ |
|||||||
| 144 | tebwritescode/pocket-change-showdown:latest |
|||||||
| 145 | ||||||||
| 146 | # With environment variables |
|||||||
| 147 | docker run -d \ |
|||||||
| 148 | --name pcs-tracker \ |
|||||||
| 149 | -p 5001:5001 \ |
|||||||
| 150 | -e SECRET_KEY="your-secret-key-here" \ |
|||||||
| 151 | -e FLASK_ENV="production" \ |
|||||||
| 152 | -v pcs-data:/app/data \ |
|||||||
| 153 | -v pcs-uploads:/app/uploads \ |
|||||||
| 154 | tebwritescode/pocket-change-showdown:latest |
|||||||
| 155 | ``` |
|||||||
| 156 | ||||||||
| 157 | ### Kubernetes |
|||||||
| 158 | ||||||||
| 159 | ```bash |
|||||||
| 160 | # Apply all manifests |
|||||||
| 161 | kubectl apply -f k8s/ |
|||||||
| 162 | ||||||||
| 163 | # Or individually |
|||||||
| 164 | kubectl apply -f k8s/namespace.yaml |
|||||||
| 165 | kubectl apply -f k8s/secret.yaml |
|||||||
| 166 | kubectl apply -f k8s/pvc.yaml |
|||||||
| 167 | kubectl apply -f k8s/deployment.yaml |
|||||||
| 168 | kubectl apply -f k8s/service.yaml |
|||||||
| 169 | kubectl apply -f k8s/ingress.yaml # Optional |
|||||||
| 170 | ||||||||
| 171 | # Check deployment status |
|||||||
| 172 | kubectl get all -n pcs-tracker |
|||||||
| 173 | ||||||||
| 174 | # Access via NodePort (default: 30001) |
|||||||
| 175 | http://<node-ip>:30001 |
|||||||
| 176 | ``` |
|||||||
| 177 | ||||||||
| 178 | #### Kubernetes Features |
|||||||
| 179 | - **Persistent Volumes** - Data and uploads stored in PVCs |
|||||||
| 180 | - **Health Checks** - Liveness and readiness probes |
|||||||
| 181 | - **Resource Limits** - CPU and memory constraints |
|||||||
| 182 | - **Multi-Service** - LoadBalancer and NodePort options |
|||||||
| 183 | - **Ingress Ready** - Configure for your domain |
|||||||
| 184 | ||||||||
| 185 | ### Local Development |
|||||||
| 186 | ||||||||
| 187 | ```bash |
|||||||
| 188 | # Clone repository |
|||||||
| 189 | git clone https://github.com/tebwritescode/pocket-change-showdown.git |
|||||||
| 190 | cd pocket-change-showdown |
|||||||
| 191 | ||||||||
| 192 | # Create virtual environment |
|||||||
| 193 | python3 -m venv venv |
|||||||
| 194 | source venv/bin/activate # On Windows: venv\Scripts\activate |
|||||||
| 195 | ||||||||
| 196 | # Install dependencies |
|||||||
| 197 | pip install -r requirements.txt |
|||||||
| 198 | ||||||||
| 199 | # Run application |
|||||||
| 200 | python app.py |
|||||||
| 201 | ||||||||
| 202 | # Access at http://localhost:5001 |
|||||||
| 203 | ``` |
|||||||
| 204 | ||||||||
| 205 | ## ⚙️ Configuration |
|||||||
| 206 | ||||||||
| 207 | ### Environment Variables |
|||||||
| 208 | ||||||||
| 209 | | Variable | Description | Default | |
|||||||
| 210 | |----------|-------------|---------| |
|||||||
| 211 | | `SECRET_KEY` | Flask secret key for sessions | `pcs-secret-key-2024` | |
|||||||
| 212 | | `FLASK_ENV` | Environment mode (`development`/`production`) | `production` | |
|||||||
| 213 | | `DATABASE_URL` | SQLAlchemy database URL | `sqlite:///data/pcs_tracker.db` | |
|||||||
| 214 | | `MAX_CONTENT_LENGTH` | Maximum upload size in bytes | `16777216` (16MB) | |
|||||||
| 215 | ||||||||
| 216 | ### Data Persistence |
|||||||
| 217 | ||||||||
| 218 | The application stores data in two locations: |
|||||||
| 219 | - `/app/data` - SQLite database |
|||||||
| 220 | - `/app/uploads` - Receipt images (stored in database as BLOB) |
|||||||
| 221 | ||||||||
| 222 | Mount these directories as volumes to persist data. |
|||||||
| 223 | ||||||||
| 224 | ## 📱 Usage |
|||||||
| 225 | ||||||||
| 226 | ### Adding Expenses |
|||||||
| 227 | ||||||||
| 228 | 1. Click **"Add Expense"** from the navigation or homepage |
|||||||
| 229 | 2. Fill in expense details (only title is truly required) |
|||||||
| 230 | 3. Upload receipt photo/screenshot (optional) |
|||||||
| 231 | 4. Save expense |
|||||||
| 232 | ||||||||
| 233 | ### Importing Data |
|||||||
| 234 | ||||||||
| 235 | 1. Navigate to **Import/Export** → **Import CSV** |
|||||||
| 236 | 2. Download the template for correct format |
|||||||
| 237 | 3. Fill in your data |
|||||||
| 238 | 4. Upload CSV file |
|||||||
| 239 | ||||||||
| 240 | ### CSV Format |
|||||||
| 241 | ||||||||
| 242 | ```csv |
|||||||
| 243 | Date,Title,Description,Category,Cost,Payment Method,Location,Vendor,Notes,Tags |
|||||||
| 244 | 2024-01-15,Moving Truck,U-Haul rental,Moving,299.99,Credit Card,Downtown,U-Haul,26ft truck,moving |
|||||||
| 245 | 2024-01-16,Hotel Stay,Overnight stay,Lodging,125.00,Company Card,Holiday Inn,Holiday Inn,1 night,travel |
|||||||
| 246 | ``` |
|||||||
| 247 | ||||||||
| 248 | ### Managing Categories & Payment Methods |
|||||||
| 249 | ||||||||
| 250 | 1. Go to **Settings** |
|||||||
| 251 | 2. Add custom categories with colors |
|||||||
| 252 | 3. Add custom payment methods |
|||||||
| 253 | 4. Delete non-default items |
|||||||
| 254 | 5. Change color theme |
|||||||
| 255 | ||||||||
| 256 | ### Analytics Dashboard |
|||||||
| 257 | ||||||||
| 258 | - Filter by time period (Week/Month/Quarter/Year) |
|||||||
| 259 | - View spending by category (Doughnut chart) |
|||||||
| 260 | - Payment method breakdown (Bar chart) |
|||||||
| 261 | - Daily spending trends (Line chart) |
|||||||
| 262 | - Top categories table with percentages |
|||||||
| 263 | ||||||||
| 264 | ## 🔌 API Documentation |
|||||||
| 265 | ||||||||
| 266 | ### Endpoints |
|||||||
| 267 | ||||||||
| 268 | | Method | Endpoint | Description | |
|||||||
| 269 | |--------|----------|-------------| |
|||||||
| 270 | | GET | `/` | Homepage with statistics | |
|||||||
| 271 | | GET | `/expenses` | List all expenses | |
|||||||
| 272 | | GET/POST | `/expense/new` | Add new expense | |
|||||||
| 273 | | GET/POST | `/expense/<id>/edit` | Edit expense | |
|||||||
| 274 | | POST | `/expense/<id>/delete` | Delete expense | |
|||||||
| 275 | | GET | `/expense/<id>/receipt` | View receipt image | |
|||||||
| 276 | | GET | `/dashboard` | Analytics dashboard | |
|||||||
| 277 | | GET | `/api/expense_data` | JSON data for charts | |
|||||||
| 278 | | GET/POST | `/settings` | Application settings | |
|||||||
| 279 | | POST | `/settings/category/add` | Add category | |
|||||||
| 280 | | POST | `/settings/payment/add` | Add payment method | |
|||||||
| 281 | | GET | `/export` | Export CSV | |
|||||||
| 282 | | GET/POST | `/import` | Import CSV | |
|||||||
| 283 | | GET | `/template` | Download CSV template | |
|||||||
| 284 | ||||||||
| 285 | ### API Response Example |
|||||||
| 286 | ||||||||
| 287 | ```json |
|||||||
| 288 | GET /api/expense_data?period=month |
|||||||
| 289 | ||||||||
| 290 | { |
|||||||
| 291 | "categories": { |
|||||||
| 292 | "labels": ["Moving", "Travel", "Housing"], |
|||||||
| 293 | "data": [1250.50, 890.25, 2100.00] |
|||||||
| 294 | }, |
|||||||
| 295 | "payment_methods": { |
|||||||
| 296 | "labels": ["Credit Card", "Cash", "Company Card"], |
|||||||
| 297 | "data": [3500.75, 450.00, 290.00] |
|||||||
| 298 | }, |
|||||||
| 299 | "daily_trend": { |
|||||||
| 300 | "labels": ["2024-01-01", "2024-01-02"], |
|||||||
| 301 | "data": [125.50, 340.25] |
|||||||
| 302 | } |
|||||||
| 303 | } |
|||||||
| 304 | ``` |
|||||||
| 305 | ||||||||
| 306 | ## 🛠️ Development |
|||||||
| 307 | ||||||||
| 308 | ### Tech Stack |
|||||||
| 309 | ||||||||
| 310 | - **Backend**: Flask 2.3.3, SQLAlchemy |
|||||||
| 311 | - **Frontend**: Bootstrap 5, Chart.js, Font Awesome |
|||||||
| 312 | - **Database**: SQLite with SQLAlchemy ORM |
|||||||
| 313 | - **File Storage**: Binary storage in database |
|||||||
| 314 | - **Deployment**: Docker, Kubernetes, Gunicorn |
|||||||
| 315 | ||||||||
| 316 | ### Project Structure |
|||||||
| 317 | ||||||||
| 318 | ``` |
|||||||
| 319 | pocket-change-showdown/ |
|||||||
| 320 | ├── app.py # Main Flask application |
|||||||
| 321 | ├── requirements.txt # Python dependencies |
|||||||
| 322 | ├── Dockerfile # Multi-arch Docker build |
|||||||
| 323 | ├── docker-compose.yml # Docker Compose config |
|||||||
| 324 | ├── templates/ # HTML templates |
|||||||
| 325 | │ ├── base.html # Base template with themes |
|||||||
| 326 | │ ├── index.html # Homepage |
|||||||
| 327 | │ ├── expenses.html # Expense list |
|||||||
| 328 | │ ├── expense_form.html # Add/Edit form |
|||||||
| 329 | │ ├── dashboard.html # Analytics |
|||||||
| 330 | │ ├── settings.html # Settings page |
|||||||
| 331 | │ └── import.html # CSV import |
|||||||
| 332 | ├── k8s/ # Kubernetes manifests |
|||||||
| 333 | │ ├── namespace.yaml |
|||||||
| 334 | │ ├── secret.yaml |
|||||||
| 335 | │ ├── pvc.yaml |
|||||||
| 336 | │ ├── deployment.yaml |
|||||||
| 337 | │ ├── service.yaml |
|||||||
| 338 | │ └── ingress.yaml |
|||||||
| 339 | └── data/ # Database (created at runtime) |
|||||||
| 340 | ``` |
|||||||
| 341 | ||||||||
| 342 | ### Building from Source |
|||||||
| 343 | ||||||||
| 344 | ```bash |
|||||||
| 345 | # Build Docker image |
|||||||
| 346 | docker build -t pcs-tracker . |
|||||||
| 347 | ||||||||
| 348 | # Build multi-arch with buildx |
|||||||
| 349 | docker buildx build \ |
|||||||
| 350 | --platform linux/amd64,linux/arm64,linux/arm/v7 \ |
|||||||
| 351 | -t tebwritescode/pocket-change-showdown:latest \ |
|||||||
| 352 | --push . |
|||||||
| 353 | ``` |
|||||||
| 354 | ||||||||
| 355 | ### Database Schema |
|||||||
| 356 | ||||||||
| 357 | ```sql |
|||||||
| 358 | -- Main expense table |
|||||||
| 359 | CREATE TABLE expense ( |
|||||||
| 360 | id INTEGER PRIMARY KEY, |
|||||||
| 361 | title VARCHAR(200), |
|||||||
| 362 | description TEXT, |
|||||||
| 363 | category_id INTEGER REFERENCES category(id), |
|||||||
| 364 | cost FLOAT DEFAULT 0.0, |
|||||||
| 365 | payment_method_id INTEGER REFERENCES payment_method(id), |
|||||||
| 366 | date DATE, |
|||||||
| 367 | receipt_image BLOB, |
|||||||
| 368 | receipt_filename VARCHAR(200), |
|||||||
| 369 | location VARCHAR(200), |
|||||||
| 370 | vendor VARCHAR(200), |
|||||||
| 371 | notes TEXT, |
|||||||
| 372 | tags VARCHAR(500), |
|||||||
| 373 | created_at DATETIME, |
|||||||
| 374 | updated_at DATETIME |
|||||||
| 375 | ); |
|||||||
| 376 | ||||||||
| 377 | -- Categories table |
|||||||
| 378 | CREATE TABLE category ( |
|||||||
| 379 | id INTEGER PRIMARY KEY, |
|||||||
| 380 | name VARCHAR(100) UNIQUE NOT NULL, |
|||||||
| 381 | color VARCHAR(7) DEFAULT '#0d6efd', |
|||||||
| 382 | icon VARCHAR(50) DEFAULT 'fa-tag', |
|||||||
| 383 | is_default BOOLEAN DEFAULT FALSE |
|||||||
| 384 | ); |
|||||||
| 385 | ||||||||
| 386 | -- Payment methods table |
|||||||
| 387 | CREATE TABLE payment_method ( |
|||||||
| 388 | id INTEGER PRIMARY KEY, |
|||||||
| 389 | name VARCHAR(100) UNIQUE NOT NULL, |
|||||||
| 390 | icon VARCHAR(50) DEFAULT 'fa-credit-card', |
|||||||
| 391 | is_default BOOLEAN DEFAULT FALSE |
|||||||
| 392 | ); |
|||||||
| 393 | ||||||||
| 394 | -- Settings table |
|||||||
| 395 | CREATE TABLE settings ( |
|||||||
| 396 | id INTEGER PRIMARY KEY, |
|||||||
| 397 | color_scheme VARCHAR(50) DEFAULT 'default', |
|||||||
| 398 | default_view VARCHAR(20) DEFAULT 'list' |
|||||||
| 399 | ); |
|||||||
| 400 | ``` |
|||||||
| 401 | ||||||||
| 402 | ## 📄 License |
|||||||
| 403 | ||||||||
| 404 | This project is open source and available under the [MIT License](LICENSE). |
|||||||
| 405 | ||||||||
| 406 | ## 🙏 Acknowledgments |
|||||||
| 407 | ||||||||
| 408 | - Built with Flask and Bootstrap |
|||||||
| 409 | - Charts powered by Chart.js |
|||||||
| 410 | - Icons by Font Awesome |
|||||||
| 411 | ||||||||
| 412 | ## 📞 Support |
|||||||
| 413 | ||||||||
| 414 | For issues, questions, or suggestions: |
|||||||
| 415 | - Open an issue on [GitHub](https://github.com/tebwritescode/pocket-change-showdown/issues) |
|||||||
| 416 | - Contact via GitHub discussions |
|||||||
| 417 | ||||||||
| 418 | --- |
|||||||
| 419 | ||||||||
| 420 | <div align="center"> |
|||||||
| 421 | ||||||||
| 422 | **P**ocket **C**hange **S**howdown - Track every penny, win the move! |
|||||||
| 423 | ||||||||
| 424 | </div> |
|||||||