How artreeus/invoicer_pro works
1. Overall shape
- This is a monorepo for an invoicing product with three major parts:
- a React/Vite frontend in src/
- a Node/Express-style backend in server/ plus api/ entrypoint for deployment
- a Supabase database layer defined by SQL migrations in supabase/migrations/
2. Two distinct user-facing surfaces
- The app is split between:
- a public marketing/content site: landing page, blog, contact, privacy/terms, templates gallery, and a public invoice generator
- a protected authenticated app: dashboard, invoices, clients, companies, reports, settings, and item library
- This boundary is enforced in the frontend with auth wrappers like RequireAuth and separate public/private layouts.
3. Frontend shell and routing
- src/main.tsx, src/App.tsx, and the page components in src/pages/ define the app composition.
- Layout components in src/components/layout/ and src/components/public/ provide the chrome for the authenticated area versus public pages.
- The structure suggests the frontend is the primary application shell, with most business interactions happening client-side.
4. State management by domain
- src/store/ contains dedicated stores for the core business entities:
- authStore
- clientStore
- companyStore
- invoiceStore
- itemLibraryStore
- themeStore
- These stores likely coordinate API calls, local UI state, and cross-page data persistence for each domain.
5. Core business domains
- The app revolves around four main data entities:
- companies
- clients
- invoices
- invoice items / item library
- Pages like CompaniesPage, ClientsPage, InvoicesPage, InvoiceFormPage, and ItemLibraryPage map directly to these domains.
- InvoicePreviewPage and exportUtils indicate a render/export workflow for invoice output.
6. Invoice template engine
- src/templates/ contains a large set of invoice themes such as Classic, Modern, Corporate, Minimal, Terminal, and others.
- src/templates/index.ts and shared.tsx imply a template registry and common rendering contract.
- This is a key architectural boundary: invoice data is separated from presentation, and different templates can render the same invoice model.
7. Backend responsibilities
- server/app.js, server/index.js, server/auth.js, server/db.js, and server/cloudinary.js suggest a lightweight backend focused on:
- authentication/session handling
- database access
- file/image upload integration
- serving API routes
- api/index.js likely provides the deployment entrypoint for serverless hosting on Vercel, matching the presence of vercel.json.
8. Database and access control
- The schema lives in Supabase migrations for companies, clients, invoices, invoice_items, and item_library.
- Later migrations explicitly mention RLS policy tightening and insert-policy adjustments, so row-level security is a meaningful part of the architecture.
- This means the backend/frontend likely rely on Supabase for persistence, with database access constrained by per-user policies.
9. External services
- src/lib/cloudinary.ts and server/cloudinary.js show Cloudinary is used for image storage or uploads.
- src/lib/adsense.ts plus src/components/ads/ indicate Google AdSense is integrated into the public content side.
- src/lib/useSeo.ts and public article/content components suggest SEO is handled carefully for the marketing/blog surface.
10. Public content and SEO
- src/content/articles.ts and src/pages/public/Blog* suggest the blog is content-driven and likely static or semi-static.
- Public pages such as About, Contact, Privacy, Terms, and Templates are separated from the logged-in app to support discovery, trust, and SEO.
11. UI and reusable building blocks
- src/components/ui/ provides shared primitives such as Modal, Badge, EmptyState, ThemeToggle, and image upload components.
- AuthShell and PublicLayout are higher-level composition layers that keep auth flows and public pages visually distinct.
- This indicates a componentized frontend with reusable design-system-like building blocks.
12. Platform and deployment signals
- The app is built with Vite, React, TypeScript, and Tailwind/PostCSS.
- vercel.json, api/, and api/index.js suggest deployment on Vercel, with the frontend and backend co-located but separated by runtime boundary.
- Supabase migrations imply the database is managed outside the app runtime and versioned alongside the code.
13. Likely end-to-end data flow
- User interacts with the React UI.
- Frontend stores coordinate domain state and call the API layer.
- Backend authenticates requests and communicates with Supabase and Cloudinary.
- Supabase persists the invoicing entities under RLS.
- The UI renders invoice previews/templates and may export or download final invoice artifacts.
14. What to show in an architecture diagram
- Draw three main zones:
- Public frontend
- Authenticated app frontend
- Backend/API + Supabase/Cloudinary services
- Emphasize the domain data path around clients/companies/invoices/items, and the separate content/SEO/ads path for public pages.
Main entry points: Layout.tsx App layout · index.ts Template engine · InvoicesPage.tsx Invoices · app.js Server API
Components 23
Public frontend
Marketing, blog, SEO, and public invoice tools.
- Public layout · Layout for marketing and content pages.
src/components/public/PublicLayout.tsx - Landing · Public home and product introduction.
src/pages/LandingPage.tsx - Content site · Blog, about, contact, legal, and templates pages.
src/pages/public/BlogIndexPage.tsx - Generator · Public invoice generation surface.
src/pages/public/InvoiceGeneratorPage.tsx - Template engine · Invoice template registry and shared rendering contract.
src/templates/index.ts
Authenticated app
Protected invoicing workspace and shared frontend shell.
- App shell · Bootstraps the React application.
src/main.tsx - Routing · Top-level routing and page composition.
src/App.tsx - Auth guard · Protects private app routes.
src/components/auth/RequireAuth.tsx - Auth shell · Layout wrapper for signed-in views.
src/components/auth/AuthShell.tsx - App layout · Shared navigation chrome for the dashboard area.
src/components/layout/Layout.tsx - Dashboard · Signed-in landing page.
src/pages/Dashboard.tsx - Invoices · Invoice list, edit, and preview flow.
src/pages/InvoicesPage.tsx - Invoice form · Create and edit invoice records.
src/pages/InvoiceFormPage.tsx - Preview · Renders invoice output for review and export.
src/pages/InvoicePreviewPage.tsx - Clients · Client management screen.
src/pages/ClientsPage.tsx - Companies · Company profile and billing identity management.
src/pages/CompaniesPage.tsx - Item library · Reusable invoice line items and catalog data.
src/pages/ItemLibraryPage.tsx - Reports · Business reporting and summaries.
src/pages/ReportsPage.tsx - Settings · User and app settings.
src/pages/SettingsPage.tsx - Domain stores · Client, company, invoice, item, auth, and theme state.
src/store/invoiceStore.ts
Backend and data
API runtime, persistence, uploads, and deployment boundary.
- API client · Frontend calls into backend and external services.
src/lib/api.ts - Server API · Express-style application and deployment entrypoint.
server/app.js - Auth + DB · Authentication helpers and database access.
server/auth.js
Connections 23
- App shell → Routing: boots · Entry point mounts the application routes.
- Routing → Auth guard: protects · Private routes pass through auth enforcement.
- Auth guard → Auth shell: wraps · Signed-in experience is rendered inside the auth shell.
- Auth shell → App layout: uses · Auth shell composes the app layout.
- App layout → Dashboard: navigates · Main shell routes into the dashboard.
- App layout → Invoices: navigates · Shell links into invoice management.
- App layout → Clients: navigates · Shell links into client management.
- App layout → Companies: navigates · Shell links into company management.
- App layout → Item library: navigates · Shell links into the item library.
- App layout → Reports: navigates · Shell links into reporting.
- App layout → Settings: navigates · Shell links into settings.
- Invoices → Invoice form: edits · Invoice list flows into the editor.
- Invoices → Preview: renders · Invoices can be previewed before output.
- Domain stores → API client: fetches · Domain stores coordinate API calls and local state.
- API client → Server API: calls · Frontend communicates with the backend runtime.
- Server API → Auth + DB: uses · Server handles auth and persistence access.
- Server API → Template engine: serves data · Backend supports invoice rendering workflows.
- Preview → Template engine: uses · Preview page renders through the template system.
- Landing → Public layout: uses · Public pages share the marketing layout.
- Content site → Public layout: uses · Blog and legal content use the public shell.
- Generator → Public layout: uses · Public tool is presented in the public layout.
- Content site → Template engine: showcases · Template gallery and content surface reference invoice themes.
- Generator → Template engine: renders · Public generator produces invoices via templates.