Skip to content

Accounting Service API

πŸ’³

A comprehensive financial accounting and bookkeeping REST API built with Java, Spring Boot, and PostgreSQL. Manages ledger entries, account hierarchies, financial statements, reconciliation, and multi-currency transaction tracking.


Features

Feature Description Icon
Multi-Currency Support Handle transactions in multiple currencies with conversion rates πŸ’±
Double-Entry Bookkeeping Implements standard accounting principles πŸ“Š
Account Hierarchies Organize accounts in hierarchical structures (COA) πŸ—οΈ
Financial Statements Generate P&L, Balance Sheet, and Cash Flow reports πŸ“ˆ
Reconciliation Match transactions and identify discrepancies βœ“
Audit Trail Track all changes with timestamps and user information πŸ•’
Multi-Tenant Support Isolate financial data per tenant 🏒

Architecture Overview

flowchart TD
    A[Client] -->|REST API| B(AccountingController)
    B --> C[AccountingService]
    C --> D[LedgerService]
    C --> E[ReportService]
    D --> F[LedgerRepository]
    E --> G[ReportRepository]
    F --> H[(PostgreSQL)]
    G --> H
Hold "Alt" / "Option" to enable pan & zoom

API Endpoints

Note: Real API endpoints to be provided and included here.

Method Endpoint Description Notes/Parameters
POST /api/v1/accounting/journals Create journal entry tenantId header, transaction data
GET /api/v1/accounting/journals/{id} Get journal entry by ID
POST /api/v1/accounting/accounts Create chart of accounts entry Account details
GET /api/v1/accounting/accounts List all accounts tenantId param, filterable

Sequence: Create Journal Entry

sequenceDiagram
    participant U as User
    participant API as AccountingController
    participant S as AccountingService
    participant L as LedgerService
    participant R as LedgerRepository
    U->>API: POST /journals (debit/credit accounts)
    API->>S: validate transaction
    S->>L: verify double-entry balance
    L->>R: save journal entry
    R-->>L: confirm
    L-->>S: entry created
    S-->>API: JournalEntryResponse
    API-->>U: 201 Created + entry details
Hold "Alt" / "Option" to enable pan & zoom

Database Schema

erDiagram
    accounts {
        UUID id PK
        UUID tenant_id
        VARCHAR account_code
        VARCHAR account_name
        VARCHAR account_type
        DECIMAL balance
        TIMESTAMP created
        TIMESTAMP updated
    }

    journal_entries {
        UUID id PK
        UUID tenant_id
        UUID debit_account_id FK
        UUID credit_account_id FK
        DECIMAL amount
        VARCHAR description
        TIMESTAMP entry_date
        VARCHAR status
        TIMESTAMP created
        TIMESTAMP updated
    }

    accounts ||--o{ journal_entries : "debit"
    accounts ||--o{ journal_entries : "credit"
Hold "Alt" / "Option" to enable pan & zoom

Getting Started

Prerequisites

  • Java 17+
  • PostgreSQL
  • Gradle

Setup

git clone https://github.com/Olanna-tech/accounting-service-java.git
cd accounting-service-java
./gradlew build

Database

  • Configure your PostgreSQL credentials in src/main/resources/application.yml.
  • Run Flyway migrations (auto on startup).

Run

./gradlew bootRun

Configuration

Set the following environment variables in application.yml:

accounting:
  default-currency: USD
  fiscal-year-start: 01-01
  enable-multi-currency: true


Contributing

Pull requests are welcome! For major changes, please open an issue first.


License

MIT


Contact