# 🧾 RPNAB Invoicing Portal A single-page Rust web app for Rent & Petroleum Nordic AB, designed to streamline internal invoice processing and provide secure access for customers to view their invoice documents. --- ## 🎯 Project Goal The primary goal is to increase operational efficiency by: - Enabling admin users to upload structured CSV transaction data - Storing and linking those transactions to invoice records - Allowing customers to log in and view/download invoice documents (HTML or PDF) - Providing a command-line interface for admin-only tasks --- ## 🧰 Tech Stack ### Core Technologies | Layer | Tool | Description | |---------------|------------------|-------------| | Frontend | [Leptos](https://github.com/leptos-rs/leptos) | Rust-based SPA framework with SSR support | | Backend | [Axum](https://github.com/tokio-rs/axum) | Async Rust web framework | | Database | MariaDB + [`sqlx`](https://github.com/launchbadge/sqlx) | Compile-time verified SQL queries | | Migrations | [Goose](https://github.com/sifrr/goose) | SQL migration runner | | CSV Parsing | [`csv`](https://docs.rs/csv/latest/csv/) | High-performance CSV parser | | CLI Tools | Rust + [`clap`](https://github.com/clap-rs/clap) | Command-line admin tasks | | PDF Generation| HTML + `wkhtmltopdf` or `weasyprint` | Generate styled invoice documents | | Styling | Tailwind CSS (optional) | Utility-first styling framework | --- ## πŸ—ΊοΈ Development Roadmap ### Phase 1: Project Setup - [x] Create Git repository - [ ] Initialize Rust workspace (`Cargo.toml`) - [ ] Set up frontend, backend, CLI structure - [x] Write project README ### Phase 2: Infrastructure - [ ] Add `.env` and config boilerplate - [ ] Set up Goose migration framework - [ ] Connect to MariaDB using `sqlx` - [ ] Define initial DB schema (users, invoices, transactions) ### Phase 3: Admin Functions - [ ] Implement admin login (cookie-based) - [ ] Create CLI tool for CSV uploads - [ ] Parse CSV β†’ normalize β†’ store in DB - [ ] Web UI to verify and review uploads ### Phase 4: Customer Portal - [ ] Implement customer login - [ ] Build UI to view invoice list - [ ] Render invoice details - [ ] Add option to download as PDF ### Phase 5: Polish & Deploy - [ ] Input validation + error handling - [ ] Session persistence + CSRF protection - [ ] Serve behind reverse proxy (Caddy) - [ ] Deploy to FreeBSD jail --- ## πŸ“ Planned Project Structure ```text rpnab-invoicing/ β”œβ”€β”€ frontend/ # Leptos SPA (Rust + WASM) β”œβ”€β”€ backend/ # Axum HTTP API β”œβ”€β”€ cli/ # Rust CLI binary for admin use β”œβ”€β”€ shared/ # Common logic, models, parsing helpers β”œβ”€β”€ migrations/ # Goose SQL migration scripts β”œβ”€β”€ static/ # Public assets (PDF templates, CSS) β”œβ”€β”€ .env # Local config (not checked in) └── Cargo.toml # Workspace definition 🚧 Project Status This project is in the planning and bootstrapping phase. Initial development will begin in Q4 2025.