Skip to content

Open source invoice generator API with customizable patterns and automatic numbering. No database required, just JSON files and clean code.

License

Notifications You must be signed in to change notification settings

JSAcodev/InvoiceGenerator-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧾 Invoice Generator API

.NET License

πŸ“š API Documentation

Documentation

RESTful API for automatic invoice generation with sequential numbering and customizable templates. Built with .NET 10 and designed to be simple, flexible, and easy to implement.


🌟 Features

  • ✨ Customizable templates with flexible format patterns
  • πŸ”’ Automatic sequential numbering with leading zeros
  • πŸ’Ύ JSON storage with no database dependencies
  • πŸ—οΈ Clean layered architecture that's maintainable
  • πŸ“ Structured logging with Serilog
  • πŸ”„ Reset system to restart number sequences
  • πŸš€ Interactive documentation with Scalar
  • πŸ†“ 100% Open Source and free to use

πŸš€ Quick Start

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/JSAcodev/InvoiceGenerator-API.git
    cd invoice-generator-api
  2. Run the application

    cd InvoiceGenerator
    dotnet run
  3. Access the API

    https://localhost:PORT
    http://localhost:PORT
    
  4. Interactive documentation

    https://localhost:PORT/scalar/v1
    

πŸ“Έ Screenshots

API Documentation (Scalar)

API Documentation

Interactive API documentation with all available endpoints

Creating a Template

Creating Template

Example of creating a custom invoice template

Generated Invoice

Generated Invoice

Example response when generating a new invoice


πŸ“š Basic Usage

Create a Template

POST /invoice/newtemplate
Content-Type: application/json

{
  "name": "Invoice USA",
  "pattern": "USA-{year}{month}-{number:5}",
  "description": "Template for US market"
}

Generate an Invoice

POST /invoice/nextinvoice
Content-Type: application/json

{
  "id": "11571eff-5e2c-4a62-ba9a-098384d408d6"
}

Result:

USA-202512-00001
USA-202512-00002
USA-202512-00003
...

🎨 Available Patterns

Create your own invoice formats using these tokens:

Token Description Example
{year} or {yyyy} Year (4 digits) 2025
{month} or {mm} Month (2 digits) 12
{day} or {dd} Day (2 digits) 25
{number:x} Sequential number with x digits {number:5} β†’ 00001

Pattern Examples

"USA-{year}{month}-{number:3}"     β†’  USA-202512-001
"INV-{dd}-{number:15}"             β†’  INV-25-000000000000001
"FAC-{yyyy}-{mm}-{dd}-{number:4}"  β†’  FAC-2025-12-25-0001
"INVC-{yyyy}-USA-{number:6}"       β†’  INVC-2025-USA-000001

πŸ“‘ API Endpoints

Method Endpoint Description
POST /invoice/newtemplate Create a new template
GET /invoice/templates Get all templates
GET /invoice/template Get a template by ID
POST /invoice/nextinvoice Generate next invoice
GET /invoice/invoices Get all invoices
GET /invoice/invoice/{name} Get last invoice by name
POST /invoice/resettemplate Reset template counter

πŸ—οΈ Architecture

The project follows a clean layered architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   InvoiceGenerator  β”‚  ← API Layer (Controllers, Middleware)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Business       β”‚  ← Business Logic
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       Domain        β”‚  ← Entities
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        Data         β”‚  ← Repositories (JSON)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Technologies


πŸ“‚ Project Structure

InvoiceGenerator/
β”œβ”€β”€ Business/          # Business logic, DTOs, Services
β”œβ”€β”€ Data/              # Repositories, Interfaces
β”œβ”€β”€ Domain/            # Domain entities
└── InvoiceGenerator/  # API, Controllers, Middleware
    └── Storage/       # JSON files

πŸ’‘ Use Cases

  • πŸ“Š Small businesses that need to generate simple invoices
  • πŸ‘¨β€πŸ’Ό Freelancers for billing management
  • πŸͺ POS systems requiring automatic numbering
  • πŸ“¦ E-commerce to generate unique order numbers
  • πŸ§ͺ Educational projects to learn layered architecture

🌐 Resources


⭐ Support

If you find this project useful, consider giving it a star ⭐ on GitHub. Help other developers discover it!

About

Open source invoice generator API with customizable patterns and automatic numbering. No database required, just JSON files and clean code.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published