OpenInvoice follows a feature-based architecture for better organization and scalability. The codebase is organized into logical modules and features.
src/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ ├── invoices/ # Invoice API endpoints
│ │ ├── payments/ # Payment API endpoints
│ │ ├── webhooks/ # Webhook handlers
│ │ └── ...
│ ├── dashboard/ # Dashboard pages
│ │ ├── invoices/ # Invoice pages
│ │ ├── customers/ # Customer pages
│ │ ├── products/ # Product pages
│ │ └── ...
│ ├── (auth)/ # Auth pages
│ └── layout.tsx # Root layout
│
├── components/ # Shared components
│ ├── ui/ # Shadcn UI components
│ ├── layout/ # Layout components
│ └── forms/ # Form components
│
├── features/ # Feature modules
│ ├── invoicing/ # Invoice features
│ │ ├── components/ # Invoice components
│ │ ├── hooks/ # Invoice hooks
│ │ └── utils/ # Invoice utilities
│ ├── kanban/ # Kanban features
│ └── overview/ # Dashboard features
│
├── lib/ # Core utilities
│ ├── db.ts # Prisma client
│ ├── format.ts # Formatting utilities
│ └── utils.ts # General utilities
│
├── config/ # Configuration files
│ ├── nav-config.ts # Navigation configuration
│ └── ...
│
└── types/ # TypeScript types
└── index.ts # Type definitions
/app - Next.js App RouterContains all routes and API endpoints:
/components - Shared ComponentsReusable UI components:
/features - Feature ModulesFeature-based organization:
/lib - UtilitiesCore utilities and helpers:
InvoiceForm.tsx)use prefix (e.g., useInvoices.ts)formatCurrency.ts)Invoice.ts)route.ts (Next.js convention)