How prince-codes/invoice_v2 works
This is a shop-specific invoicing application. The user signs in, chooses one of three bill-entry workflows, saves or prints invoices, and can revisit local or cloud history. Cloud Invoice Management adds review, editing, deletion, consolidated printing and exports. The browser modules handle invoice-specific entry and presentation; shared client code supports authentication and cloud synchronization, while Pages Functions protect routes and provide invoice and numbering APIs backed by D1. Workflow and management capabilities are documented in the README; unsampled implementation details are not inferred.
Main entry points: selection.js Workflow selection · management.js Cloud management · js/main.js Mod 1 monthly · js/main.js Mod 2 daily
Components 19
Access and navigation
- Sign in
login.js - Workflow selection
Selection/selection.js
Invoice workflows
- Mod 1 monthly
Mod 1/js/main.js - Mod 2 daily
Mod 2/js/main.js - Mod 3 old method
Mod 3/js/main.js - Cloud management
Management/management.js - Excel export helper
Assets/excel-export.js
Cloud records
- Cloud sync client
cloud-sync.js - Invoice API
functions/api/invoices.js - Number allocator
functions/api/invoices/next-id.js - Browser invoice history
- Shared D1 database
Authentication
- Auth client
auth-client.js - Route protection
functions/_middleware.js - Session utilities
functions/_auth.js - Login endpoint
functions/api/auth/login.js - Session endpoint
functions/api/auth/session.js - Logout endpoint
functions/api/auth/logout.js
Other components
- Shop user
Connections 29
- Shop user → Sign in: signs in
README.md - Sign in → Login endpoint: submits credentials
README.md - Shop user → Workflow selection: chooses workflow
README.md - Workflow selection → Mod 1 monthly: opens
README.md - Workflow selection → Mod 2 daily: opens
README.md - Workflow selection → Mod 3 old method: opens
README.md - Workflow selection → Cloud management: opens
README.md - Mod 1 monthly → Browser invoice history: saves invoices
README.md - Mod 2 daily → Browser invoice history: saves invoices
README.md - Mod 3 old method → Browser invoice history: saves invoices
README.md - Mod 1 monthly → Cloud sync client: syncs history
README.md - Mod 2 daily → Cloud sync client: syncs history
README.md - Mod 3 old method → Cloud sync client: syncs history
README.md - Cloud sync client → Invoice API: requests records
cloud-sync.js - Invoice API → Shared D1 database: reads and writes
functions/api/invoices.js - Number allocator → Shared D1 database: allocates numbers
README.md - Cloud management → Invoice API: manages records
Management/management.js - Cloud management → Mod 1 monthly: opens print layout
README.md - Cloud management → Mod 2 daily: opens print layout
README.md - Cloud management → Excel export helper: exports records
README.md - Mod 1 monthly → Excel export helper: exports history
- Mod 2 daily → Excel export helper: exports history
- Mod 3 old method → Excel export helper: exports history
- Auth client → Session endpoint: checks session
auth-client.js - Auth client → Logout endpoint: requests logout
auth-client.js - Route protection → Session utilities: validates session
functions/_middleware.js - Login endpoint → Session utilities: creates session
functions/api/auth/login.js - Session endpoint → Session utilities: checks user
functions/api/auth/session.js - Logout endpoint → Session utilities: clears cookie
functions/api/auth/logout.js