# Pocket Change Showdown: The Penny-Pincher's Paradise > Fuck yeah! It's time to tackle your moving expenses with a dash of style and a whole lot of sass! π° <div align="center"> Hey look, there's more Flair than a corporate drone with a Monday morning hangover!     <img src="https://teb.codes/2-Code/Flask/Pocket-Change-Showdown/logo.png" alt="logo" width="150"/> 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)! </div> --- ## π Table of Contents - [What Features?](#features) - [Screenshots β Because Who Reads?](#screenshots) - [Quick Start β No, Really, Itβs Quick](#quick-start) - [Slog through Installation](#installation) - [Docker - Walk the Weird Whale](#docker) - [Kubernetes - Because You're Fancy](#kubernetes) - [Local Mayhem - Developer Stuff](#local-development) - [Mess About with Configuration](#configuration) - [Usage - Whatβs the Point?](#usage) - [Guff About API Documentation](#api-documentation) - [What Matters in Development?](#development) - [License - Free Stuff's Always Good](#license) ## β¨ Features ### Core Functionality - πΈ **Receipt Management** - Store craploads of receipts. We dare you. - π³ **Multiple Payment Methods** - We track whether you spent cash, credit, IOUs, or favors. - π·οΈ **Smart Categorization** - Keep your spending habits smart and snarky. - π **Analytics Dashboard** - Like looking at a magic crystal ball of shame. - π¨ **8 Color Themes** - Because your expenses can't be as drab as your personality. - π± **Mobile Responsive** - Track on the go, from your phone or hell, a potato. - π **No Login Required** - No strings attached, like that one-night stand. ### Data Management - π₯ **CSV Import** - Bring the madness of an Excel sheet to a whole new level. - π€ **CSV Export** - Send your data on a field trip! - π **Template Download** - Look, Ma! Iβm organized. - πΎ **Persistent Storage** - Data that laughs in the face of restarts. ### PCS-Specific Categories - π Moving - βοΈ Travel - π Housing - π¦ Storage - π Transportation - π¨ Lodging - π Food - π¦ Supplies - ποΈ Services - β Make up your own crap! ## πΈ Screenshots <details> <summary><i>Click to show screenshots</i></summary> # Dashboard Interactive analytics with spending trends and category breakdowns. # Expense Entry Simple form with receipt upload and auto-complete fields.  # Homepage A general overview of expenses  # Import/Export Efficient data importing and exporting with template  # PDF Export Printer friendly PDF with customizable content  # Settings Manage categories, payment methods, and themes.  </details> ### Sample PDF Donβt just stand there, gawk! [pdf_sample.pdf](./pdf_sample.pdf) ## π Quick Start ### Docker (Recommended) ```bash # Unleash the Kraken with the latest image docker run -d \ --name pcs-tracker \ -p 5001:5001 \ -v pcs-data:/app/data \ -v pcs-uploads:/app/uploads \ tebwritescode/pocket-change-showdown:latest # Chuckle maniacally at http://localhost:5001 ``` ### Docker Compose ```bash # Phone-up Chuck Norris: "We're cloning a repo" git clone https://github.com/tebwritescode/pocket-change-showdown.git cd pocket-change-showdown # Compose your mess with Docker Compose docker-compose up -d # Dance your way to http://localhost:5001 ``` ## π¦ Installation ### Docker #### Recognizing All Sorts Because compatibility is key, unless it isn't! ```bash # Pull for your peculiar machine docker pull --platform linux/arm64 tebwritescode/pocket-change-showdown:latest # Or let Docker rub its chin and decide docker pull tebwritescode/pocket-change-showdown:latest ``` #### Docker Run Degeneracy ```bash # Deploy it, Captain docker run -d \ --name pcs-tracker \ -p 5001:5001 \ tebwritescode/pocket-change-showdown:latest # Make it last longer than a baking lesson docker run -d \ --name pcs-tracker \ -p 5001:5001 \ -v $(pwd)/data:/app/data \ -v $(pwd)/uploads:/app/uploads \ tebwritescode/pocket-change-showdown:latest # Secret sauce for the discerning chef docker run -d \ --name pcs-tracker \ -p 5001:5001 \ -e SECRET_KEY="your-secret-key-here" \ -e FLASK_ENV="production" \ -v pcs-data:/app/data \ -v pcs-uploads:/app/uploads \ tebwritescode/pocket-change-showdown:latest ``` ### Kubernetes ```bash # Manifest your destiny, or just the code kubectl apply -f k8s/ # Or one by bloody one kubectl apply -f k8s/namespace.yaml kubectl apply -f k8s/secret.yaml kubectl apply -f k8s/pvc.yaml kubectl apply -f k8s/deployment.yaml kubectl apply -f k8s/service.yaml kubectl apply -f k8s/ingress.yaml # Optional, like an appendix # Check if your stuff's intact kubectl get all -n pcs-tracker # If it worked, buy yourself a drink at http://<node-ip>:30001 ``` #### Kubernetes Thingamabobs - **Persistent Volumes** - Turns out you donβt need to webscrape for dataβit sticks around. - **Health Checks** - It only mostly dies. - **Resource Limits** - So demanding! - **Multi-Service** - Load balance like a tightrope walker. - **Ingress Ready** - Fancy domain? Me too. ### Local Development ```bash # Kiss the clouds goodbye git clone https://github.com/tebwritescode/pocket-change-showdown.git cd pocket-change-showdown # Create a virtual haven python3 -m venv venv source venv/bin/activate # Unload a bag of dependencies pip install -r requirements.txt # Go-Go-Gadget application python app.py # Channel your inner regulator at http://localhost:5001 ``` ## βοΈ Configuration ### Environment Variables | Variable | Description | Default | |----------|-------------|---------| | `SECRET_KEY` | SMERSH-level deception sessions key | `pcs-secret-key-2024` | | `FLASK_ENV` | Sneaky environment mood | `production` | | `DATABASE_URL` | Alchemize this: your database | `sqlite:///data/pcs_tracker.db` | | `MAX_CONTENT_LENGTH` | Maximum cr-p (content) upload size | `16777216` (16MB) | ### Data Persistence To make data hang around like a bad smell: - `/app/data` - SQLite domicile - `/app/uploads` - Receipts chill as BLOBs ## π± Usage ### Tossin' Pennies - Adding Expenses 1. Sing "Add Expense!" from any rooftop or just click it 2. Wake up from title-only dream 3. Attach facepalming receipts (optional) 4. Ceremoniously hit "Save" ### Inflicting Data - Importing 1. Explore **Import/Export** β **Import CSV** 2. Don shiny template armor 3. Be daVinci, fill your masterpiece 4. Blast off with CSV sere-naah-de ### Cheese-Cutting Format ```csv Date,Title,Description,Category,Cost,Payment Method,Location,Vendor,Notes,Tags 2024-01-15,Moving Truck,U-Haul rental,Moving,299.99,Credit Card,Downtown,U-Haul,26ft truck,moving 2024-01-16,Hotel Stay,Overnight stay,Lodging,125.00,Company Card,Holiday Inn,Holiday Inn,1 night,travel ``` ### Manipulating Categories & Payment Methods 1. Go where no wo/man has deemed necessary: **Settings** 2. Cust-omize your little heart out 3. Create methods even mad scientists couldnβt 4. Marry whimsy: color themes purr with indulgence ### Accidental Analytics Dashboard - Scorn last week, guilt-trip for next: from nanosecond to year - See-spend scenario via doughnut dive - Payment method squabbles (Bar chart showdown) - Dailies take you on the trend train (Line chart) - Top dog categories, percentages & flaunting aplenty ## π API Guff ### Endpoints | Method | Endpoint | Quirky Description | |--------|----------|--------------------| | GET | `/` | Home sweet home(wrecker) | | GET | `/expenses` | Expense expedition | | GET/POST | `/expense/new` | New expense enlightenment | | GET/POST | `/expense/<id>/edit` | Edit the unavoidable | | POST | `/expense/<id>/delete` | PURGE! | | GET | `/expense/<id>/receipt` | Picture-perception | | GET | `/dashboard` | Analytical nincompoopery | | GET | `/api/expense_data` | JSON chateria | | GET/POST | `/settings` | Mischief management | | POST | `/settings/category/add` | Go rogue - add category | | POST | `/settings/payment/add` | Payment etiquette upgrade | | GET | `/export` | CSV in Wonderland | | GET/POST | `/import` | CSV Carousel | | GET | `/template` | CSV preface nobility | ### API Response Satire ```json GET /api/expense_data?period=month { "categories": { "labels": ["Moving", "Travel", "Housing"], "data": [1250.50, 890.25, 2100.00] }, "payment_methods": { "labels": ["Credit Card", "Cash", "Company Card"], "data": [3500.75, 450.00, 290.00] }, "daily_trend": { "labels": ["2024-01-01", "2024-01-02"], "data": [125.50, 340.25] } } ``` ## π οΈ Development - Why Bother? ### Tech Stack - **Backend**: Flask, spicy SQLAlchemy - **Frontend**: Bootstrap, Chart.js, Font Awesome (a peacock) - **Database**: SQLite: SQLAlchemy Sings - **File Storage**: Database belly storage - **Deployment**: Orchestrations with Docker, Kubernetes & Gunicorn bravado ### Structure of Madness ``` pocket-change-showdown/ βββ app.py # App-worthy babel βββ requirements.txt # Dependency lug βββ Dockerfile # Docker concoction βββ docker-compose.yml # Docker squad βββ templates/ # HTML insidiousness β βββ base.html # The totally base β βββ index.html # Page of presents β βββ expenses.html # Expense paradox β βββ expense_form.html # Input vs Reality β βββ dashboard.html # Chase your shame β βββ settings.html # Hangover fixes β βββ import.html # CSV courtship βββ k8s/ # Kubernetes enigma β βββ namespace.yaml β βββ secret.yaml β βββ pvc.yaml β βββ deployment.yaml β βββ service.yaml β βββ ingress.yaml βββ data/ # Runtime ingenuity ``` ### Born from Code ```bash # Glayvin! Build me this Docker monstrosity docker build -t pcs-tracker . # Partake in fetching multi-arch wonders docker buildx build \ --platform linux/amd64,linux/arm64,linux/arm/v7 \ -t tebwritescode/pocket-change-showdown:latest \ --push . ``` ### The Flat Schema (Non-Skiable) ```sql -- Ground Zero table for expense CREATE TABLE expense ( id INTEGER, title VARCHAR(200), description TEXT, category_id INTEGER, cost FLOAT, payment_method_id INTEGER, date DATE, receipt_image BLOB, receipt_filename VARCHAR(200), location VARCHAR(200), vendor VARCHAR(200), notes TEXT, tags VARCHAR(500), created_at DATETIME, updated_at DATETIME, PRIMARY KEY (id) ); -- Column of categorization CREATE TABLE category ( id INTEGER, name VARCHAR(100), color VARCHAR(7), icon VARCHAR(50), is_default BOOLEAN, PRIMARY KEY (id) ); -- Noteworthy payment table CREATE TABLE payment_method ( id INTEGER, name VARCHAR(100), icon VARCHAR(50), is_default BOOLEAN, PRIMARY KEY (id) ); -- Settings booth CREATE TABLE settings ( id INTEGER, color_scheme VARCHAR(50), default_view VARCHAR(20), PRIMARY KEY (id) ); ``` ## π License - Go Forth and Conquer! This project is merrily open source and blissfully up for grabs under the [MIT License](LICENSE). ## π Cheers & Acknowledgments - Built under the spell of Flask and Bootstrap - Charts magicked by Chart.js - Icons with Font Awesome - Awe as your own ## π Screech for Help For tirades, discontent, or amusing suggestions: - Holler on [GitHub Issues](https://github.com/tebwritescode/pocket-change-showdown/issues) - Vent thoroughly in GitHub Discussions --- <div align="center"> **P**ocket **C**hange **S**howdown - Because tracking every penny is nothing short of glorious insanity! </div>