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.
npm install @openledger/accounting-react
To use the Open Ledger React library, you need to wrap your application with the OpenLedgerProvider
and then use the exported components and hooks.
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.
-
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.
import {
OpenLedgerView,
TransactionTable,
DashboardBox,
} from "@openledger/accounting-react";
function MyComponent() {
return (
<div>
<OpenLedgerView />
<DashboardBox>{/* Custom widget content */}</DashboardBox>
</div>
);
}
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
}
- 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
The OpenLedgerProvider
accepts the following props:
-
entityId
: Your company's unique identifier -
enterpriseId
: Your enterprise ID for authentication -
enterpriseSecret
: Your enterprise secret for authentication -
accessToken
: (Optional) An access token if you're not using enterpriseId/secret -
environment
: The environment to use ('development' or 'production') -
theme
: A theme object to customize the appearance -
apiUrl
: The URL of your API (required)
Please read our contributing guidelines before submitting pull requests.
This project is licensed under the MIT License.
OpenLedger follows standard double-entry bookkeeping principles for all financial transactions:
- 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
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
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 |
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.