Blame

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