How fandyajpo/notain works
Notain is an Indonesian SME invoicing product. A user signs in, creates and manages invoices and customers, applies a reusable template, then prints a PDF through the browser; the product also provides finance dashboards, organizations, subscription payments, public sites, and administration. The architecture separates React islands, application use cases, pure domain logic, repository adapters, and Appwrite/R2-backed services. Edges are limited to relationships visible in excerpts, SOURCE INDEX references, or README statements; many unsampled feature internals are represented by their existing directories.
Main entry points: invoice Invoice editor and print · infra Appwrite repositories · _lib Function utilities · api Pages API functions
Components 26
User experience
- Invoice editor and print
src/components/react/invoice - Customer directory
src/components/react/customers - Dashboard
src/components/react/dashboard - Authentication UI
src/components/react/auth - Template editor
src/components/react/template - Other product UI
src/components/react
Application services
- Authentication use cases
src/app/auth.ts - Data API client
src/app/data-api.ts - Repository container
src/infra/container.ts
Product domain
- Invoice model and rules
src/core/invoice/model.ts - Invoice calculations
src/core/invoice/calculator.ts - Customer model
src/core/customer/model.ts - Finance metrics
src/core/stats/finance.ts - Template model
src/core/template/model.ts - Plans and payments
src/core/billing
Persistence and assets
- Appwrite repositories
src/infra - Appwrite Cloud
- R2 asset adapter
src/infra/r2-asset-repository.ts - Cloudflare R2
HTTP and integrations
- Pages API functions
functions/api - Function utilities
functions/_lib - Invoice edit shell
functions/invoice/[[id]].ts - Template edit shell
functions/templates/[[id]].ts - Site edit shell
functions/site/[[id]].ts
Other components
- SME user
- DOKU Checkout
Connections 32
- SME user → Authentication UI: signs in
README.md - Authentication UI → Authentication use cases: calls
src/components/react/auth/auth-form.tsx - Authentication use cases → Repository container: uses
src/app/auth.ts - Repository container → Appwrite repositories: registers
src/infra/container.ts - Appwrite repositories → Appwrite Cloud: persists data
README.md - SME user → Invoice editor and print: creates invoices
README.md - Invoice editor and print → Invoice model and rules: uses model
src/components/react/invoice/invoice-preview.tsx - Invoice editor and print → Invoice calculations: calculates totals
src/components/react/invoice/invoice-preview.tsx - Invoice editor and print → Appwrite repositories: saves invoices
- Appwrite repositories → Data API client: writes rows
src/infra/appwrite-invoice-repository.ts - Data API client → Appwrite Cloud: accesses tables
src/app/data-api.ts - Invoice editor and print → Customer directory: manages separately
- Customer directory → Customer model: uses model
- Appwrite repositories → Customer model: maps rows
src/infra/appwrite-customer-repository.ts - Dashboard → Finance metrics: shows metrics
- Appwrite repositories → Finance metrics: supplies entries
src/infra/appwrite-invoice-repository.ts - Finance metrics → Invoice calculations: calculates totals
src/core/stats/finance.ts - Template editor → Template model: edits templates
- Invoice editor and print → Template model: renders template
src/components/react/invoice/invoice-preview.tsx - SME user → Other product UI: uses features
README.md - Other product UI → Plans and payments: views plans
src/components/react/landing/pricing-preview.tsx - Plans and payments → DOKU Checkout: starts checkout
- Pages API functions → Function utilities: uses helpers
functions/api/orgs.ts - Pages API functions → Appwrite Cloud: verifies sessions
README.md - Pages API functions → Cloudflare R2: reads and writes logos
README.md - R2 asset adapter → Cloudflare R2: stores assets
- SME user → Invoice edit shell: opens edit route
README.md - Invoice edit shell → Function utilities: builds shell response
functions/invoice/[[id]].ts - SME user → Template edit shell: opens edit route
README.md - Template edit shell → Function utilities: builds shell response
functions/templates/[[id]].ts - SME user → Site edit shell: opens site route
- Site edit shell → Function utilities: builds shell response
functions/site/[[id]].ts