@openledger/accounting-react v1.1.50
Open Ledger React Library
Open Ledger React is a comprehensive library for building financial dashboards and managing accounting data. It provides a set of React components and hooks for easy integration into your application.
Installation
npm install @openledger/accounting-react
Usage
To use the Open Ledger React library, you need to wrap your application with the OpenLedgerProvider
and then use the exported components and hooks.
Setting up the Provider
import { OpenLedgerProvider } from "@openledger/accounting-react";
function App() {
return (
<OpenLedgerProvider
entityId="your-entity-id"
accessToken={{
access_token: "",
token_type: 'Bearer',
expires_in: 3600,
expires_at: new Date(2026, 1, 1)
}}
environment="development"
theme={yourThemeObject}
apiUrl={"your-api-url"}
>
{/* Your app components */}
</OpenLedgerProvider>
);
}
Warning: Without valid keys (entityId, enterpriseId, and enterpriseSecret), the package will throw errors. If you need to obtain these keys or have any issues, please reach out to the Open Ledger team at info@openledger.com for assistance.
Main Exports
OpenLedgerProvider
: The main provider component that wraps your application.useOpenLedgerContext
: A hook to access the OpenLedger context within your components.useTransactionContext
: A hook to access transaction-related data and functions.useAccountContext
: A hook to access account-related data and functions.TransactionTable
: A component to display transaction data in a table format.Dashboard
: A pre-built dashboard view component.OpenLedgerView
: A comprehensive view component that includes various financial views.TransactionsView
: A component for displaying and managing transactions.SettingsView
: A component for managing application settings.ReportView
: A component for generating and displaying financial reports.
Using Components
import {
OpenLedgerView,
TransactionTable,
DashboardBox,
} from "@openledger/accounting-react";
function MyComponent() {
return (
<div>
<OpenLedgerView />
<DashboardBox>{/* Custom widget content */}</DashboardBox>
</div>
);
}
Using Hooks
import {
useOpenLedgerContext,
useTransactionContext,
useAccountContext,
} from "@openledger/accounting-react";
function MyCustomComponent() {
const { auth, entityId, theme } = useOpenLedgerContext();
const { transactions } = useTransactionContext();
const { accounts } = useAccountContext();
// Use the data in your component
}
Features
- Comprehensive financial dashboard
- Transaction management
- Account management
- Profit and Loss reporting
- Balance Sheet reporting
- Cash Flow Statement
- AI-powered financial reports
- Plaid integration for bank account connections
- Customizable theming
Configuration
The OpenLedgerProvider
accepts the following props:
entityId
: Your company's unique identifierenterpriseId
: Your enterprise ID for authenticationenterpriseSecret
: Your enterprise secret for authenticationaccessToken
: (Optional) An access token if you're not using enterpriseId/secretenvironment
: The environment to use ('development' or 'production')theme
: A theme object to customize the appearanceapiUrl
: The URL of your API (required)
Contributing
Please read our contributing guidelines before submitting pull requests.
License
This project is licensed under the MIT License.
OpenLedger Accounting System
Accounting Principles
OpenLedger follows standard double-entry bookkeeping principles for all financial transactions:
Core Accounting Rules
- Double-Entry System: Every transaction affects at least two accounts.
- Balancing Principle: For every transaction, total debits must equal total credits.
- Account Behaviors:
- Assets and Expenses INCREASE with DEBITS and DECREASE with CREDITS
- Liabilities, Equity, and Revenue INCREASE with CREDITS and DECREASE with DEBITS
Handling of Negative Amounts
The system handles negative amounts by treating them as reversals of the normal accounting effect:
- Negative DEBIT: Effectively treated as a CREDIT
- Negative CREDIT: Effectively treated as a DEBIT
This ensures proper accounting treatment for scenarios like:
- Revenue reversals (refunds)
- Asset returns
- Expense refunds
- Liability reductions
Example Scenarios
Transaction | Amount | Direction | Effective Direction | Effect on Account |
---|---|---|---|---|
Sale | +$100 | CREDIT | CREDIT | INCREASE Revenue |
Refund | -$100 | CREDIT | DEBIT | DECREASE Revenue |
Purchase | +$500 | DEBIT | DEBIT | INCREASE Asset/Expense |
Return | -$500 | DEBIT | CREDIT | DECREASE Asset/Expense |
Financial Statements
All financial statements follow standard accounting conventions:
- Profit & Loss: Shows revenue increase (credits) and expense increase (debits) over a period
- Balance Sheet: Shows assets = liabilities + equity at a point in time
- Cash Flow: Shows operating, investing, and financing activities affecting cash
Negative values in financial statements are displayed in parentheses following accounting convention.
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago