Blame
|
1 | # Pocket Change Showdown: The Penny-Pincher's Paradise |
||||||
|
2 | |||||||
|
3 | > Feck yeah! It's time to tackle your moving expenses with a dash of style and a whole lot of sass! π° |
||||||
|
4 | |||||||
| 5 | <div align="center"> |
|||||||
|
6 | |||||||
|
7 | Hey look, there's more Flair than a corporate drone with a Monday morning hangover! |
||||||
|
8 | |||||||
|
9 |  |
||||||
|
10 |  |
||||||
| 11 |  |
|||||||
|
12 |  |
||||||
|
13 | |||||||
|
14 | <img src="https://teb.codes/2-Code/Flask/Pocket-Change-Showdown/logo.png" alt="logo" width="150"/> |
||||||
|
15 | |||||||
|
16 | Think you're bad at managing expenses? Ah, quit your whining. We've got everything: [sassy Features](#features) β’ super-speed [Quick Start](#quick-start) β’ hassle-free [Installation](#installation) β’ wordy [Documentation](#documentation) β’ places to rant... I mean, [Contributing](#contributing)! |
||||||
|
17 | </div> |
||||||
| 18 | ||||||||
| 19 | --- |
|||||||
| 20 | ||||||||
| 21 | ## π Table of Contents |
|||||||
|
22 | - [What Features?](#features) |
||||||
| 23 | - [Screenshots β Because Who Reads?](#screenshots) |
|||||||
| 24 | - [Quick Start β No, Really, Itβs Quick](#quick-start) |
|||||||
| 25 | - [Slog through Installation](#installation) |
|||||||
| 26 | - [Docker - Walk the Weird Whale](#docker) |
|||||||
| 27 | - [Kubernetes - Because You're Fancy](#kubernetes) |
|||||||
| 28 | - [Local Mayhem - Developer Stuff](#local-development) |
|||||||
| 29 | - [Mess About with Configuration](#configuration) |
|||||||
| 30 | - [Usage - Whatβs the Point?](#usage) |
|||||||
| 31 | - [Guff About API Documentation](#api-documentation) |
|||||||
| 32 | - [What Matters in Development?](#development) |
|||||||
| 33 | - [Contributing - Your Turn to Bitch](#contributing) |
|||||||
| 34 | - [License - Free Stuff's Always Good](#license) |
|||||||
|
35 | |||||||
| 36 | ## β¨ Features |
|||||||
| 37 | ### Core Functionality |
|||||||
|
38 | - πΈ **Receipt Management** - Store craploads of receipts. We dare you. |
||||||
| 39 | - π³ **Multiple Payment Methods** - We track whether you spent cash, credit, IOUs, or favors. |
|||||||
| 40 | - π·οΈ **Smart Categorization** - Keep your spending habits smart and snarky. |
|||||||
| 41 | - π **Analytics Dashboard** - Like looking at a magic crystal ball of shame. |
|||||||
| 42 | - π¨ **8 Color Themes** - Because your expenses can't be as drab as your personality. |
|||||||
| 43 | - π± **Mobile Responsive** - Track on the go, from your phone or hell, a potato. |
|||||||
| 44 | - π **No Login Required** - No strings attached, like that one-night stand. |
|||||||
|
45 | |||||||
| 46 | ### Data Management |
|||||||
|
47 | - π₯ **CSV Import** - Bring the madness of an Excel sheet to a whole new level. |
||||||
| 48 | - π€ **CSV Export** - Send your data on a field trip! |
|||||||
| 49 | - π **Template Download** - Look, Ma! Iβm organized. |
|||||||
| 50 | - πΎ **Persistent Storage** - Data that laughs in the face of restarts. |
|||||||
|
51 | |||||||
| 52 | ### PCS-Specific Categories |
|||||||
| 53 | - π Moving |
|||||||
| 54 | - βοΈ Travel |
|||||||
| 55 | - π Housing |
|||||||
| 56 | - π¦ Storage |
|||||||
| 57 | - π Transportation |
|||||||
| 58 | - π¨ Lodging |
|||||||
| 59 | - π Food |
|||||||
| 60 | - π¦ Supplies |
|||||||
| 61 | - ποΈ Services |
|||||||
|
62 | - β Make up your own crap! |
||||||
|
63 | |||||||
| 64 | ## πΈ Screenshots |
|||||||
| 65 | ||||||||
|
66 | <details> |
||||||
| 67 | <summary><i>Click to show screenshots</i></summary> |
|||||||
| 68 | # Dashboard |
|||||||
| 69 | Interactive analytics with spending trends and category breakdowns. |
|||||||
| 70 | ||||||||
| 71 | ||||||||
| 72 | # Expense Entry |
|||||||
| 73 | Simple form with receipt upload and auto-complete fields. |
|||||||
| 74 |  |
|||||||
| 75 | ||||||||
| 76 | # Homepage |
|||||||
| 77 | A general overview of expenses |
|||||||
| 78 |  |
|||||||
| 79 | ||||||||
| 80 | # Import/Export |
|||||||
| 81 | Efficient data importing and exporting with template |
|||||||
| 82 |  |
|||||||
| 83 | ||||||||
| 84 | # PDF Export |
|||||||
| 85 | Printer friendly PDF with customizable content |
|||||||
| 86 |  |
|||||||
| 87 | ||||||||
| 88 | # Settings |
|||||||
| 89 | Manage categories, payment methods, and themes. |
|||||||
| 90 |  |
|||||||
|
91 | |||||||
|
92 | </details> |
||||||
|
93 | |||||||
|
94 | ### Sample PDF |
||||||
|
95 | Donβt just stand there, gawk! [pdf_sample.pdf](./pdf_sample.pdf) |
||||||
|
96 | |||||||
|
97 | ## π Quick Start |
||||||
| 98 | ### Docker (Recommended) |
|||||||
| 99 | ```bash |
|||||||
|
100 | # Unleash the Kraken with the latest image |
||||||
|
101 | docker run -d \ |
||||||
| 102 | --name pcs-tracker \ |
|||||||
| 103 | -p 5001:5001 \ |
|||||||
| 104 | -v pcs-data:/app/data \ |
|||||||
| 105 | -v pcs-uploads:/app/uploads \ |
|||||||
| 106 | tebwritescode/pocket-change-showdown:latest |
|||||||
|
107 | # Chuckle maniacally at http://localhost:5001 |
||||||
|
108 | ``` |
||||||
| 109 | ||||||||
| 110 | ### Docker Compose |
|||||||
| 111 | ```bash |
|||||||
|
112 | # Phone-up Chuck Norris: "We're cloning a repo" |
||||||
|
113 | git clone https://github.com/tebwritescode/pocket-change-showdown.git |
||||||
| 114 | cd pocket-change-showdown |
|||||||
|
115 | # Compose your mess with Docker Compose |
||||||
|
116 | docker-compose up -d |
||||||
|
117 | # Dance your way to http://localhost:5001 |
||||||
|
118 | ``` |
||||||
| 119 | ||||||||
| 120 | ## π¦ Installation |
|||||||
| 121 | ### Docker |
|||||||
|
122 | #### Recognizing All Sorts |
||||||
| 123 | Because compatibility is key, unless it isn't! |
|||||||
|
124 | ```bash |
||||||
|
125 | # Pull for your peculiar machine |
||||||
|
126 | docker pull --platform linux/arm64 tebwritescode/pocket-change-showdown:latest |
||||||
|
127 | # Or let Docker rub its chin and decide |
||||||
|
128 | docker pull tebwritescode/pocket-change-showdown:latest |
||||||
| 129 | ``` |
|||||||
| 130 | ||||||||
|
131 | #### Docker Run Degeneracy |
||||||
|
132 | ```bash |
||||||
|
133 | # Deploy it, Captain |
||||||
|
134 | docker run -d \ |
||||||
| 135 | --name pcs-tracker \ |
|||||||
| 136 | -p 5001:5001 \ |
|||||||
| 137 | tebwritescode/pocket-change-showdown:latest |
|||||||
|
138 | # Make it last longer than a baking lesson |
||||||
|
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 | # Secret sauce for the discerning chef |
||||||
|
146 | docker run -d \ |
||||||
| 147 | --name pcs-tracker \ |
|||||||
| 148 | -p 5001:5001 \ |
|||||||
| 149 | -e SECRET_KEY="your-secret-key-here" \ |
|||||||
| 150 | -e FLASK_ENV="production" \ |
|||||||
| 151 | -v pcs-data:/app/data \ |
|||||||
| 152 | -v pcs-uploads:/app/uploads \ |
|||||||
| 153 | tebwritescode/pocket-change-showdown:latest |
|||||||
| 154 | ``` |
|||||||
| 155 | ||||||||
| 156 | ### Kubernetes |
|||||||
| 157 | ```bash |
|||||||
|
158 | # Manifest your destiny, or just the code |
||||||
|
159 | kubectl apply -f k8s/ |
||||||
|
160 | # Or one by bloody one |
||||||
|
161 | kubectl apply -f k8s/namespace.yaml |
||||||
| 162 | kubectl apply -f k8s/secret.yaml |
|||||||
| 163 | kubectl apply -f k8s/pvc.yaml |
|||||||
| 164 | kubectl apply -f k8s/deployment.yaml |
|||||||
| 165 | kubectl apply -f k8s/service.yaml |
|||||||
|
166 | kubectl apply -f k8s/ingress.yaml # Optional, like an appendix |
||||||
|
167 | |||||||
|
168 | # Check if your stuff's intact |
||||||
|
169 | kubectl get all -n pcs-tracker |
||||||
|
170 | # If it worked, buy yourself a drink at http://<node-ip>:30001 |
||||||
|
171 | ``` |
||||||
| 172 | ||||||||
|
173 | #### Kubernetes Thingamabobs |
||||||
| 174 | - **Persistent Volumes** - Turns out you donβt need to webscrape for dataβit sticks around. |
|||||||
| 175 | - **Health Checks** - It only mostly dies. |
|||||||
| 176 | - **Resource Limits** - So demanding! |
|||||||
| 177 | - **Multi-Service** - Load balance like a tightrope walker. |
|||||||
| 178 | - **Ingress Ready** - Fancy domain? Me too. |
|||||||
|
179 | |||||||
| 180 | ### Local Development |
|||||||
| 181 | ```bash |
|||||||
|
182 | # Kiss the clouds goodbye |
||||||
|
183 | git clone https://github.com/tebwritescode/pocket-change-showdown.git |
||||||
| 184 | cd pocket-change-showdown |
|||||||
|
185 | # Create a virtual haven |
||||||
|
186 | python3 -m venv venv |
||||||
|
187 | source venv/bin/activate |
||||||
| 188 | # Unload a bag of dependencies |
|||||||
|
189 | pip install -r requirements.txt |
||||||
|
190 | # Go-Go-Gadget application |
||||||
|
191 | python app.py |
||||||
|
192 | # Channel your inner regulator at http://localhost:5001 |
||||||
|
193 | ``` |
||||||
| 194 | ||||||||
| 195 | ## βοΈ Configuration |
|||||||
| 196 | ### Environment Variables |
|||||||
| 197 | | Variable | Description | Default | |
|||||||
| 198 | |----------|-------------|---------| |
|||||||
|
199 | | `SECRET_KEY` | SMERSH-level deception sessions key | `pcs-secret-key-2024` | |
||||||
| 200 | | `FLASK_ENV` | Sneaky environment mood | `production` | |
|||||||
| 201 | | `DATABASE_URL` | Alchemize this: your database | `sqlite:///data/pcs_tracker.db` | |
|||||||
| 202 | | `MAX_CONTENT_LENGTH` | Maximum cr-p (content) upload size | `16777216` (16MB) | |
|||||||
|
203 | |||||||
| 204 | ### Data Persistence |
|||||||
|
205 | To make data hang around like a bad smell: |
||||||
| 206 | - `/app/data` - SQLite domicile |
|||||||
| 207 | - `/app/uploads` - Receipts chill as BLOBs |
|||||||
|
208 | |||||||
| 209 | ## π± Usage |
|||||||
|
210 | ### Tossin' Pennies - Adding Expenses |
||||||
| 211 | 1. Sing "Add Expense!" from any rooftop or just click it |
|||||||
| 212 | 2. Wake up from title-only dream |
|||||||
| 213 | 3. Attach facepalming receipts (optional) |
|||||||
| 214 | 4. Ceremoniously hit "Save" |
|||||||
| 215 | ||||||||
| 216 | ### Inflicting Data - Importing |
|||||||
| 217 | 1. Explore **Import/Export** β **Import CSV** |
|||||||
| 218 | 2. Don shiny template armor |
|||||||
| 219 | 3. Be daVinci, fill your masterpiece |
|||||||
| 220 | 4. Blast off with CSV sere-naah-de |
|||||||
| 221 | ||||||||
| 222 | ### Cheese-Cutting Format |
|||||||
|
223 | ```csv |
||||||
| 224 | Date,Title,Description,Category,Cost,Payment Method,Location,Vendor,Notes,Tags |
|||||||
| 225 | 2024-01-15,Moving Truck,U-Haul rental,Moving,299.99,Credit Card,Downtown,U-Haul,26ft truck,moving |
|||||||
| 226 | 2024-01-16,Hotel Stay,Overnight stay,Lodging,125.00,Company Card,Holiday Inn,Holiday Inn,1 night,travel |
|||||||
| 227 | ``` |
|||||||
| 228 | ||||||||
|
229 | ### Manipulating Categories & Payment Methods |
||||||
| 230 | 1. Go where no wo/man has deemed necessary: **Settings** |
|||||||
| 231 | 2. Cust-omize your little heart out |
|||||||
| 232 | 3. Create methods even mad scientists couldnβt |
|||||||
| 233 | 4. Marry whimsy: color themes purr with indulgence |
|||||||
|
234 | |||||||
|
235 | ### Accidental Analytics Dashboard |
||||||
| 236 | - Scorn last week, guilt-trip for next: from nanosecond to year |
|||||||
| 237 | - See-spend scenario via doughnut dive |
|||||||
| 238 | - Payment method squabbles (Bar chart showdown) |
|||||||
| 239 | - Dailies take you on the trend train (Line chart) |
|||||||
| 240 | - Top dog categories, percentages & flaunting aplenty |
|||||||
|
241 | |||||||
|
242 | ## π API Guff |
||||||
|
243 | ### Endpoints |
||||||
|
244 | | Method | Endpoint | Quirky Description | |
||||||
| 245 | |--------|----------|--------------------| |
|||||||
| 246 | | GET | `/` | Home sweet home(wrecker) | |
|||||||
| 247 | | GET | `/expenses` | Expense expedition | |
|||||||
| 248 | | GET/POST | `/expense/new` | New expense enlightenment | |
|||||||
| 249 | | GET/POST | `/expense/<id>/edit` | Edit the unavoidable | |
|||||||
| 250 | | POST | `/expense/<id>/delete` | PURGE! | |
|||||||
| 251 | | GET | `/expense/<id>/receipt` | Picture-perception | |
|||||||
| 252 | | GET | `/dashboard` | Analytical nincompoopery | |
|||||||
| 253 | | GET | `/api/expense_data` | JSON chateria | |
|||||||
| 254 | | GET/POST | `/settings` | Mischief management | |
|||||||
| 255 | | POST | `/settings/category/add` | Go rogue - add category | |
|||||||
| 256 | | POST | `/settings/payment/add` | Payment etiquette upgrade | |
|||||||
| 257 | | GET | `/export` | CSV in Wonderland | |
|||||||
| 258 | | GET/POST | `/import` | CSV Carousel | |
|||||||
| 259 | | GET | `/template` | CSV preface nobility | |
|||||||
| 260 | ||||||||
| 261 | ### API Response Satire |
|||||||
|
262 | ```json |
||||||
| 263 | GET /api/expense_data?period=month |
|||||||
| 264 | { |
|||||||
| 265 | "categories": { |
|||||||
| 266 | "labels": ["Moving", "Travel", "Housing"], |
|||||||
| 267 | "data": [1250.50, 890.25, 2100.00] |
|||||||
| 268 | }, |
|||||||
| 269 | "payment_methods": { |
|||||||
| 270 | "labels": ["Credit Card", "Cash", "Company Card"], |
|||||||
| 271 | "data": [3500.75, 450.00, 290.00] |
|||||||
| 272 | }, |
|||||||
| 273 | "daily_trend": { |
|||||||
| 274 | "labels": ["2024-01-01", "2024-01-02"], |
|||||||
| 275 | "data": [125.50, 340.25] |
|||||||
| 276 | } |
|||||||
| 277 | } |
|||||||
| 278 | ``` |
|||||||
| 279 | ||||||||
|
280 | ## π οΈ Development - Why Bother? |
||||||
|
281 | ### Tech Stack |
||||||
|
282 | - **Backend**: Flask, spicy SQLAlchemy |
||||||
| 283 | - **Frontend**: Bootstrap, Chart.js, Font Awesome (a peacock) |
|||||||
| 284 | - **Database**: SQLite: SQLAlchemy Sings |
|||||||
| 285 | - **File Storage**: Database belly storage |
|||||||
| 286 | - **Deployment**: Orchestrations with Docker, Kubernetes & Gunicorn bravado |
|||||||
|
287 | |||||||
|
288 | ### Structure of Madness |
||||||
|
289 | ``` |
||||||
| 290 | pocket-change-showdown/ |
|||||||
|
291 | βββ app.py # App-worthy babel |
||||||
| 292 | βββ requirements.txt # Dependency lug |
|||||||
| 293 | βββ Dockerfile # Docker concoction |
|||||||
| 294 | βββ docker-compose.yml # Docker squad |
|||||||
| 295 | βββ templates/ # HTML insidiousness |
|||||||
| 296 | β βββ base.html # The totally base |
|||||||
| 297 | β βββ index.html # Page of presents |
|||||||
| 298 | β βββ expenses.html # Expense paradox |
|||||||
| 299 | β βββ expense_form.html # Input vs Reality |
|||||||
| 300 | β βββ dashboard.html # Chase your shame |
|||||||
| 301 | β βββ settings.html # Hangover fixes |
|||||||
| 302 | β βββ import.html # CSV courtship |
|||||||
| 303 | βββ k8s/ # Kubernetes enigma |
|||||||
|
304 | β βββ namespace.yaml |
||||||
| 305 | β βββ secret.yaml |
|||||||
| 306 | β βββ pvc.yaml |
|||||||
| 307 | β βββ deployment.yaml |
|||||||
| 308 | β βββ service.yaml |
|||||||
| 309 | β βββ ingress.yaml |
|||||||
|
310 | βββ data/ # Runtime ingenuity |
||||||
|
311 | ``` |
||||||
| 312 | ||||||||
|
313 | ### Born from Code |
||||||
|
314 | ```bash |
||||||
|
315 | # Glayvin! Build me this Docker monstrosity |
||||||
|
316 | docker build -t pcs-tracker . |
||||||
|
317 | # Partake in fetching multi-arch wonders |
||||||
|
318 | docker buildx build \ |
||||||
| 319 | --platform linux/amd64,linux/arm64,linux/arm/v7 \ |
|||||||
| 320 | -t tebwritescode/pocket-change-showdown:latest \ |
|||||||
| 321 | --push . |
|||||||
| 322 | ``` |
|||||||
| 323 | ||||||||
|
324 | ### The Flat Schema (Non-Skiable) |
||||||
|
325 | ```sql |
||||||
|
326 | -- Ground Zero table for expense |
||||||
|
327 | CREATE TABLE expense ( |
||||||
|
328 | id INTEGER, |
||||||
|
329 | title VARCHAR(200), |
||||||
| 330 | description TEXT, |
|||||||
|
331 | category_id INTEGER, |
||||||
| 332 | cost FLOAT, |
|||||||
| 333 | payment_method_id INTEGER, |
|||||||
|
334 | date DATE, |
||||||
| 335 | receipt_image BLOB, |
|||||||
| 336 | receipt_filename VARCHAR(200), |
|||||||
| 337 | location VARCHAR(200), |
|||||||
| 338 | vendor VARCHAR(200), |
|||||||
| 339 | notes TEXT, |
|||||||
| 340 | tags VARCHAR(500), |
|||||||
| 341 | created_at DATETIME, |
|||||||
|
342 | updated_at DATETIME, |
||||||
| 343 | PRIMARY KEY (id) |
|||||||
|
344 | ); |
||||||
|
345 | -- Column of categorization |
||||||
|
346 | CREATE TABLE category ( |
||||||
|
347 | id INTEGER, |
||||||
| 348 | name VARCHAR(100), |
|||||||
| 349 | color VARCHAR(7), |
|||||||
| 350 | icon VARCHAR(50), |
|||||||
| 351 | is_default BOOLEAN, |
|||||||
| 352 | PRIMARY KEY (id) |
|||||||
|
353 | ); |
||||||
|
354 | -- Noteworthy payment table |
||||||
|
355 | CREATE TABLE payment_method ( |
||||||
|
356 | id INTEGER, |
||||||
| 357 | name VARCHAR(100), |
|||||||
| 358 | icon VARCHAR(50), |
|||||||
| 359 | is_default BOOLEAN, |
|||||||
| 360 | PRIMARY KEY (id) |
|||||||
|
361 | ); |
||||||
|
362 | -- Settings booth |
||||||
|
363 | CREATE TABLE settings ( |
||||||
|
364 | id INTEGER, |
||||||
| 365 | color_scheme VARCHAR(50), |
|||||||
| 366 | default_view VARCHAR(20), |
|||||||
| 367 | PRIMARY KEY (id) |
|||||||
|
368 | ); |
||||||
| 369 | ``` |
|||||||
| 370 | ||||||||
|
371 | ## π License - Go Forth and Conquer! |
||||||
| 372 | This project is merrily open source and blissfully up for grabs under the [MIT License](LICENSE). |
|||||||
|
373 | |||||||
|
374 | ## π Cheers & Acknowledgments |
||||||
| 375 | - Built under the spell of Flask and Bootstrap |
|||||||
| 376 | - Charts magicked by Chart.js |
|||||||
| 377 | - Icons with Font Awesome - Awe as your own |
|||||||
|
378 | |||||||
|
379 | ## π Screech for Help |
||||||
| 380 | For tirades, discontent, or amusing suggestions: |
|||||||
| 381 | - Holler on [GitHub Issues](https://github.com/tebwritescode/pocket-change-showdown/issues) |
|||||||
| 382 | - Vent thoroughly in GitHub Discussions |
|||||||
|
383 | |||||||
| 384 | --- |
|||||||
| 385 | <div align="center"> |
|||||||
|
386 | **P**ocket **C**hange **S**howdown - Because tracking every penny is nothing short of glorious insanity! |
||||||
|
387 | </div> |
||||||