Blame

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