Skip to content

Full-featured invoice management system with Next.js, Stripe & crypto payments, email tracking, customer management, and analytics dashboard.

License

Notifications You must be signed in to change notification settings

OpenInvoice-Store/openinvoice

Repository files navigation

Open Invoice

A modern, full-featured invoice management system built with Next.js, TypeScript, and Shadcn UI. Manage your invoices, customers, products, and payments all in one beautiful dashboard.

Open Invoice Dashboard

GitHub Documentation

Overview

Open Invoice is a comprehensive invoice management solution designed for businesses of all sizes. Create, manage, and track invoices effortlessly with an intuitive interface backed by powerful features like customer management, product catalogs, payment tracking, and detailed analytics.

Built with modern web technologies and best practices, Open Invoice provides a production-ready foundation for managing your invoicing workflow.

Key Features

  • 📝 Invoice Management - Create, edit, and manage invoices with a beautiful, user-friendly interface
  • 🔄 Recurring Invoices & Subscriptions - Create recurring invoice templates with automated generation, subscription management, and flexible scheduling
  • 👥 Customer Management - Keep track of all your customers with detailed contact information
  • 📦 Product Catalog - Manage your products and services with pricing and tax information
  • 💰 Payment Tracking - Record and track payments against invoices
  • 📧 Email Management - Send invoices via email with tracking and engagement metrics
  • 📊 Analytics Dashboard - Visual insights into your invoicing with charts and statistics
  • 🎯 Kanban Board - Visual invoice workflow management with drag-and-drop
  • 🔗 Shareable Invoices - Generate secure, shareable links for your clients
  • 📄 PDF Generation - Export invoices as professional PDF documents
  • 🎨 Branding & Templates - Customize company branding (logo, colors, fonts) and create multiple invoice templates
  • 🏢 Multi-Tenant Workspaces - Organize invoices by workspace/team with Clerk Organizations
  • 🔐 Secure Authentication - Enterprise-grade authentication with Clerk
  • 💳 Subscription Management - Built-in billing and subscription handling
  • 🔒 Role-Based Access Control - Fine-grained permissions and access control
  • 💳 Stripe Payment Processing - Accept online payments with Stripe Connect, support for partial payments, and automatic invoice status updates
  • 🪙 Crypto Payment Integration - Accept cryptocurrency payments with XRP (via XRPL) and Solana ecosystem (SOL, USDC, USDT). Real-time payment monitoring, automatic invoice updates, and support for testnet/testing modes
  • 🧾 Custom Tax System - Flexible tax calculation with tax profiles, rules, and jurisdictions. Support for multiple tax types (sales tax, VAT/GST, service tax) with presets for common regions

Tech Stack

This application is built with the following technologies:

Project Structure

The project follows a feature-based architecture for better organization and scalability:

src/
├── app/                      # Next.js App Router
│   ├── (auth)/              # Authentication routes
│   ├── dashboard/           # Dashboard pages
│   │   ├── invoices/        # Invoice management
│   │   ├── customers/       # Customer management
│   │   ├── products/        # Product management
│   │   ├── overview/        # Analytics dashboard
│   │   └── kanban/          # Kanban board
│   ├── invoice/             # Public invoice view (shareable)
│   └── api/                 # API routes
│
├── features/                # Feature-based modules
│   ├── invoicing/          # Invoice-related components & hooks
│   ├── kanban/             # Kanban board components
│   └── overview/           # Dashboard analytics components
│
├── components/              # Shared components
│   ├── ui/                 # Shadcn UI components
│   └── layout/             # Layout components (sidebar, header)
│
├── lib/                     # Core utilities
│   ├── db.ts               # Prisma client
│   ├── format.ts           # Formatting utilities
│   └── utils.ts            # General utilities
│
└── prisma/                  # Database schema and migrations
    └── schema.prisma        # Prisma schema

Getting Started

Prerequisites

  • Node.js 18+ or Bun
  • PostgreSQL database
  • Clerk account (for authentication)

Installation

  1. Clone the repository

    git clone https://github.com/usaikoo/openinvoice.git
    cd open-invoice
  2. Install dependencies

    bun install
    # or
    npm install
  3. Set up environment variables

    Copy the example environment file:

    cp env.example.txt .env.local

    Update .env.local with your configuration:

    • Database connection string (DATABASE_URL)
    • Clerk authentication keys (NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY, CLERK_SECRET_KEY)
    • Resend API key (RESEND_API_KEY) for email functionality
    • Resend webhook key (RESEND_WEBHOOK_KEY) for email event tracking
    • Stripe keys (STRIPE_SECRET_KEY, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY) for payment processing
    • Stripe webhook secret (STRIPE_WEBHOOK_SECRET) for webhook verification
    • TaxJar API key (TAXJAR_API_KEY) for automatic tax calculation (optional)
    • XRP WebSocket URLs (XRP_MAINNET_WS_URL, XRP_TESTNET_WS_URL) for crypto payments (optional, uses public endpoints by default)
    • Solana RPC URLs (SOLANA_MAINNET_RPC_URL, SOLANA_TESTNET_RPC_URL) for crypto payments (optional, uses public RPC by default)
    • AWS S3 credentials (for file uploads, if applicable)
    • Sentry DSN (for error tracking, optional)
  4. Set up the database

    # Generate Prisma Client
    bun prisma generate
    
    # Run migrations
    bun prisma migrate dev
  5. Run the development server

    bun run dev

    The application will be available at http://localhost:3000

Environment Configuration

For detailed setup instructions, see:

Features Overview

Invoice Management

  • Create and edit invoices with multiple line items
  • Track invoice status (Draft, Sent, Paid, Overdue, Cancelled)
  • Automatic invoice numbering
  • Calculate subtotals, taxes, and totals automatically
  • Add custom notes to invoices
  • Generate PDF documents
  • Share invoices via secure, shareable links
  • Modern invoice details page with left-side section navigation (Details, Payments, Emails, Notes)

Recurring Invoices & Subscriptions

  • Create recurring invoice templates with flexible scheduling (daily, weekly, monthly, quarterly, yearly, custom)
  • Automated invoice generation via cron job
  • Subscription management with pause/resume/cancel functionality
  • Template-based invoice creation with reusable items
  • Automatic email sending for generated invoices
  • Next generation date tracking
  • View all invoices generated from a template
  • Statistics dashboard showing revenue, payments, and invoice counts
  • Manual invoice generation on demand
  • End date support for time-limited subscriptions
  • Custom interval support for flexible billing cycles

Customer Management

  • Store customer contact information
  • Track all invoices per customer
  • Quick access to customer history

Product Management

  • Maintain a catalog of products/services
  • Set prices and tax rates
  • Add product images
  • Quick product selection when creating invoices

Branding & Templates

  • Company Branding - Customize your company's appearance on invoices

    • Upload and manage company logo
    • Set primary and secondary brand colors
    • Choose font family for invoices
    • Add company contact information (address, phone, email, website)
    • Customize footer text
    • Set default currency per organization
  • Invoice Templates - Create and manage multiple invoice templates

    • Create custom invoice templates with unique layouts
    • Set default template for automatic assignment
    • Activate/deactivate templates
    • Configure template layouts (standard, compact, detailed)
    • Custom header and footer templates (HTML)
    • Custom CSS styling (JSON)
    • Template selection when creating new invoices
    • Template management interface with CRUD operations

Analytics Dashboard

  • Overview of key metrics
  • Revenue charts and trends
  • Invoice status distribution
  • Sales performance analytics
  • Parallel routes for independent loading states

Kanban Board

  • Visual invoice workflow management
  • Drag and drop between status columns
  • Quick invoice updates
  • Local state persistence

Multi-Tenant Support

  • Create and switch between workspaces
  • Team management and collaboration
  • Role-based access control
  • Organization-level billing and subscriptions

Email Management

  • Send invoices directly to customers via email
  • Professional HTML email templates with invoice details
  • Automatic payment confirmation emails
  • Complete email tracking and audit trail
  • Real-time email engagement metrics (opens, clicks, delivery status)
  • Email history with detailed event logs
  • Resend webhook integration for event tracking
  • Email status badges and notifications
  • Left-side section navigation for email history (integrated with invoice details page)
  • Track email opens, clicks, bounces, and delivery events

Payment Processing

  • Stripe Connect Integration - Multi-tenant payment processing with Express accounts
  • Online Payments - Accept credit card payments directly on invoices
  • Payment Forms - Secure, PCI-compliant payment forms using Stripe Elements
  • Multiple Payment Methods - Support for cards, ACH, bank transfers via Stripe's automatic payment methods
  • Saved Payment Methods - Stripe Customer integration with saved cards for faster checkout
  • Partial Payments - Support for partial invoice payments with balance tracking
  • Payment Plans & Installments - Split invoices into multiple installments (weekly, biweekly, monthly, quarterly) with automatic payment allocation and status tracking
  • Automatic Status Updates - Invoice status automatically updates on successful payment
  • Payment Validation - Amount validation prevents overpayment
  • Webhook Processing - Real-time payment status updates via Stripe webhooks
  • Payment History - Complete payment tracking with Stripe payment intent IDs
  • Payment Receipts - Generate PDF receipts for each payment with download action
  • Email Confirmations - Automatic payment confirmation emails to customers
  • Stripe Onboarding - Streamlined Stripe Connect account setup in settings
  • Stripe Account Management - Soft disconnect, reconnect, and reset options for better UX
  • Platform Fees - Configurable platform fee calculation and application

Tax Management

  • TaxJar Integration - Automatic tax calculation using TaxJar API

    • Real-time Tax Calculation - Automatic tax calculation based on customer and business addresses
    • Nexus Region Support - Configure nexus regions for accurate tax calculation
    • Multi-jurisdiction Support - Supports US, Canada, EU, and international tax calculations
    • Product Tax Codes - Support for product-specific tax codes (exempt items, reduced rates)
    • Sandbox Mode - Test mode support for development and testing
    • Address Validation - Automatic address parsing and validation for accurate tax calculation
    • Tax Transaction Tracking - Store TaxJar transaction IDs for audit and reporting
    • Fallback Support - Falls back to custom tax profiles if TaxJar is unavailable
  • Custom Tax System - Built-in tax calculation engine without third-party dependencies

    • Tax Profiles - Create tax profiles for different jurisdictions (country + region)
    • Multiple Tax Rules - Define multiple tax rules per profile (e.g., GST + PST, VAT + local tax)
    • Tax Presets - Pre-configured tax templates for common regions:
      • Canada: GST (5%), PST (varies by province), QST/TVQ (9.975%)
      • United States: State tax templates
      • European Union: VAT templates
      • United Kingdom: VAT templates
      • Australia: GST templates
      • India: GST templates
    • Tax Calculation - Automatic tax calculation based on selected tax profile
    • Tax Breakdown - Detailed tax breakdown displayed on invoices, PDFs, and emails with percentages
    • Manual Tax Override - Override default tax rates for specific invoices
    • Tax Exemptions - Support for tax-exempt customers with exemption reasons
    • Default Tax Profile - Set default tax profile per organization
    • Tax Authority Labels - Categorize taxes by authority type (federal, state, provincial, VAT, local)
    • User-Controlled - Simple, explicit tax system where business owners choose appropriate taxes
  • Tax Calculation Methods - Flexible tax calculation with priority system:

    1. TaxJar (if enabled) - Automatic real-time tax calculation
    2. Tax Overrides - Manual tax rates for specific invoices
    3. Tax Profiles - Custom tax rules per jurisdiction
    4. Manual - Item-level tax rates (fallback)

Roadmap

Phase 1: Payment Processing (Q1 2026) ✅ Completed

  • Stripe Integration
    • Set up Stripe account and API keys ✅
    • Stripe Connect Express accounts integration ✅
    • Create payment intent API endpoints ✅
    • Build payment form component with Stripe Elements ✅
    • Implement webhook handling for payment status updates ✅
    • Add "Pay Now" button to invoice view pages (public and dashboard) ✅
    • Update invoice status automatically on successful payment ✅
    • Support for partial payments ✅
    • Payment amount validation and balance checking ✅
    • Email notifications for payment confirmations ✅
    • Stripe Connect onboarding flow in settings ✅
    • Platform fee calculation and application ✅
    • Payment error handling and user feedback ✅
    • Payment method storage (Stripe Customer + saved cards via setup_future_usage) ✅
    • Payment receipt generation ✅

Phase 1.5: Email Functionality (Q1 2026) ✅ Completed

  • Email Service Integration
    • Resend email service integration
    • Send invoice emails to customers with PDF and shareable links
    • Payment confirmation email automation
    • Professional HTML email templates for invoices and payments
    • Email tracking and logging system with database models
    • Email history UI with scrollable drawer interface
    • Resend webhook integration for real-time event tracking
    • Track email opens, clicks, bounces, and delivery events
    • Email audit trail with timestamps and metadata
    • Email engagement metrics (open counts, click counts, delivery status)
    • Right sidebar navigation for email/payment/notes history
    • Email status badges and detailed event logs

Phase 2: Enhanced Payment Features (Q2 2026) ✅ Completed

  • Payment Methods Expansion
    • Support for multiple payment methods (cards, ACH, bank transfers via automatic_payment_methods) ✅
    • Saved payment methods for recurring customers (via Stripe Customer + setup_future_usage) ✅
    • Payment plans and installments ✅
      • Payment plan creation with configurable frequency (weekly, biweekly, monthly, quarterly) ✅
      • Automatic installment generation with proper rounding handling ✅
      • Installment status tracking (pending, paid, overdue, cancelled) ✅
      • Automatic payment allocation to installments in order ✅
      • Payment plan UI components and management interface ✅
      • Installment-specific payment amounts on shared invoices ✅
      • Payment plan display with installment list and status badges ✅
      • Support for 2-60 installments per payment plan ✅
    • Automatic payment retry for failed transactions ✅
      • Automatic retry cron job with exponential backoff (1h, 6h, 24h) ✅
      • Retry tracking (count, last retry, next retry, status) ✅
      • Retry using saved payment methods ✅
      • Retry status display in payment UI ✅
      • Configurable max retries (default: 3) ✅
      • GitHub Actions workflow integration ✅
    • Payment method preferences by customer ✅
      • Store Stripe customer ID on Customer model ✅
      • Store preferred payment method ID ✅
      • API endpoint to get/set payment method preferences ✅
      • Payment intent uses preferred payment method automatically ✅
      • UI to manage payment method preferences in customer edit page ✅
      • Display saved payment methods with card details ✅
      • Set/remove default payment method ✅

Phase 3: Multi-Provider Support (Q3 2026) - Optional

  • Hyperswitch Integration (if multi-provider support needed)
    • Evaluate Hyperswitch deployment options (self-hosted vs cloud)
    • Integrate Hyperswitch API for payment processing
    • Configure multiple payment providers (Stripe, PayPal, Adyen, etc.)
    • Implement intelligent routing based on success rates
    • Add payment provider switching for failed transactions
    • Cost optimization and observability dashboards
    • Advanced retry strategies and revenue recovery

Phase 4: Advanced Features (Q4 2026)

  • Recurring Invoices & Subscriptions
    • Recurring invoice templates ✅
    • Automated invoice generation ✅
    • Subscription management ✅
    • Usage-based billing ✅
      • Enable usage-based billing on templates ✅
      • Record usage data with period tracking ✅
      • Automatic invoice calculation from usage ✅
      • Usage history and management UI ✅
      • Link usage records to generated invoices ✅
    • Recurring invoice detail page with left sidebar navigation ✅
      • Overview section with statistics and template details ✅
      • Items section with add/edit functionality ✅
      • Usage section for usage-based templates ✅
      • Invoices section with generated invoices list and manual generation ✅
      • Notes section with add/edit functionality ✅
  • Automation & Notifications
    • Payment reminders and automated follow-ups ✅
      • Automated cron job for payment reminders (GitHub Actions) ✅
      • Reminder emails for upcoming invoices (3 days before due) ✅
      • Reminder emails for due today invoices ✅
      • Overdue invoice notifications (7, 14, 30+ days) ✅
      • Manual "Send Reminder" button in invoice view ✅
      • Reminders sidebar section with reminder history ✅
      • Reminder tracking (count, last sent date) ✅
      • Flexible testing mode with query parameters ✅
      • Debug mode for troubleshooting ✅
    • Overdue invoice notifications ✅
    • Custom email templates ✅
    • SMS notifications (optional)
  • International & Compliance
    • Multi-currency support ✅
      • Currency field on invoices with organization default fallback ✅
      • Currency selection in invoice forms ✅
      • Currency display in invoice views and PDFs ✅
      • Currency support for recurring invoices and templates ✅
      • Currency display in recurring invoice tables and detail pages ✅
      • Support for 20+ currencies (USD, EUR, GBP, JPY, CAD, etc.) ✅
    • Tax Calculation System
      • TaxJar Integration
        • TaxJar API integration for automatic tax calculation ✅
        • Real-time tax calculation based on addresses ✅
        • Nexus region configuration ✅
        • Product tax code support ✅
        • Sandbox mode for testing ✅
        • Tax transaction tracking and storage ✅
        • Address parsing and validation ✅
        • Multi-jurisdiction support (US, Canada, EU, international) ✅
      • Custom Tax System
        • Tax profile management with country and region support ✅
        • Multiple tax rules per profile (GST, PST, VAT, etc.) ✅
        • Tax presets for common regions (Canada, US, EU, UK, Australia, India) ✅
        • Tax calculation engine with percentage-based rates ✅
        • Tax breakdown display in invoices, PDFs, and emails ✅
        • Manual tax override support ✅
        • Tax exemption support for customers ✅
        • Default tax profile per organization ✅
      • Flexible tax calculation priority (TaxJar → Overrides → Profiles → Manual) ✅
    • Payment dispute management
    • Compliance reporting (GDPR, PCI-DSS)
  • Branding & Templates
    • Custom branding (logo, colors, fonts) ✅
      • Logo upload and management with image preview ✅
      • Primary and secondary color customization (hex colors) ✅
      • Font family selection for invoices ✅
      • Company information settings (address, phone, email, website) ✅
      • Footer text customization ✅
      • Default currency setting per organization ✅
    • Invoice template customization ✅
      • Multiple invoice templates per organization ✅
      • Template creation, editing, and deletion ✅
      • Default template selection and management ✅
      • Template activation/deactivation ✅
      • Template layout configuration (standard, compact, detailed) ✅
      • Custom header and footer templates (HTML) ✅
      • Custom CSS styles (JSON) ✅
      • Template selection when creating invoices ✅
      • Automatic default template assignment ✅
    • Branded email templates (using branding settings)
    • Custom invoice layouts ✅
    • Company branding settings page ✅
  • Advanced Analytics
    • Custom report builder ✅
    • Export capabilities (CSV, Excel, PDF) ✅
    • Financial forecasting ✅
    • Customer lifetime value analysis ✅

Phase 5: Crypto Payment Integration (Final Phase)

  • Crypto Payment Integration ✅ (XRP and Solana implemented)
    • XRP payment integration via XRPL ✅
    • Solana payment integration via Solana blockchain ✅
      • Native SOL (Solana) support ✅
      • USDC on Solana support ✅
      • USDT on Solana support ✅
      • Solana WebSocket real-time monitoring ✅
      • Associated Token Account (ATA) derivation ✅
      • Native SOL and SPL token transaction detection ✅
    • Set up crypto payment API integration ✅
    • Implement crypto payment form component ✅
    • Add crypto payment option to invoice payment page ✅
    • XRP cryptocurrency support ✅
    • Solana ecosystem support (SOL, USDC, USDT) ✅
    • Support for additional cryptocurrencies (Bitcoin, Ethereum, etc.) - Planned
    • Real-time exchange rate conversion (CoinGecko API) ✅
    • Real-time payment monitoring (WebSocket + polling) ✅
    • Automatic invoice status updates on crypto payment confirmation ✅
    • Crypto payment history and tracking ✅
    • Payment confirmation emails for crypto transactions ✅
    • Crypto wallet address generation and management ✅
    • Transaction verification and blockchain confirmation tracking ✅
    • Address rotation and reuse cooldown system ✅
    • Minimum confirmations configuration ✅

Scripts

  • bun run dev - Start development server
  • bun run build - Build for production
  • bun run start - Start production server
  • bun run lint - Run ESLint
  • bun run lint:fix - Fix linting issues
  • bun run format - Format code with Prettier

Database Schema

The application uses PostgreSQL with Prisma ORM. Key models include:

  • Customer - Customer information and contact details
  • Product - Product/service catalog with pricing
  • Invoice - Invoice headers with status and dates
  • InvoiceItem - Line items for each invoice
  • Payment - Payment records linked to invoices and installments
  • PaymentPlan - Payment plan configuration (frequency, installment count)
  • Installment - Individual payment installments with due dates and amounts
  • RecurringInvoiceTemplate - Recurring invoice templates with scheduling and automation
  • TaxProfile - Tax profiles for different jurisdictions (country, region)
  • TaxRule - Individual tax rules within a tax profile (name, rate, authority)
  • InvoiceTax - Tax breakdown records for each invoice
  • EmailLog - Email tracking and audit trail
  • EmailEvent - Individual email events (opens, clicks, bounces, etc.)

See prisma/schema.prisma for the complete schema definition.

Support

If you find Open Invoice useful and would like to support its development, you can:

Your support helps maintain and improve this project! 🙏

Contributing

This is a personal project, but suggestions and improvements are welcome!

License

See LICENSE for details.


Built with ❤️ using Next.js and Shadcn UI

About

Full-featured invoice management system with Next.js, Stripe & crypto payments, email tracking, customer management, and analytics dashboard.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 2

  •  
  •  

Languages