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