All Projects → df8org → Scaledger

df8org / Scaledger

A double-entry accounting database with a typed GraphQL API

Labels

Projects that are alternatives of or similar to Scaledger

Cartodb Postgresql
PostgreSQL extension for CartoDB
Stars: ✭ 90 (-21.74%)
Mutual labels:  plpgsql
Plpgunit
PostgreSQL Unit Testing Framework
Stars: ✭ 102 (-11.3%)
Mutual labels:  plpgsql
Common schema
DBA's framework for MySQL
Stars: ✭ 108 (-6.09%)
Mutual labels:  plpgsql
Pg Semver
A semantic version data type for PostgreSQL
Stars: ✭ 91 (-20.87%)
Mutual labels:  plpgsql
Periods
PERIODs and SYSTEM VERSIONING for PostgreSQL
Stars: ✭ 101 (-12.17%)
Mutual labels:  plpgsql
Serverless Postgraphql
Serverless GraphQL endpoint for PostgresSQL using AWS, serverless and PostGraphQL
Stars: ✭ 105 (-8.7%)
Mutual labels:  plpgsql
Ssis Queries
A set of queries useful to easily extract monitoring and package performance data from SSISDB database
Stars: ✭ 79 (-31.3%)
Mutual labels:  plpgsql
Node Sqlcipher
SQLCipher bindings for Node
Stars: ✭ 114 (-0.87%)
Mutual labels:  plpgsql
Civicscape
A new standard for real-time policing.
Stars: ✭ 101 (-12.17%)
Mutual labels:  plpgsql
Panda Cloud
Base on SpringCloud MicroService Framework
Stars: ✭ 108 (-6.09%)
Mutual labels:  plpgsql
Pg permission
A simple set of views to see ALL permissions in a PostgreSQL database
Stars: ✭ 92 (-20%)
Mutual labels:  plpgsql
Totp
RFC6238 TOTP implementation in pure PostgreSQL plpgsql
Stars: ✭ 98 (-14.78%)
Mutual labels:  plpgsql
Aws Database Migration Samples
A set of sample database and associated items to allow customers to among other things follow along with published database migration recipes.
Stars: ✭ 105 (-8.7%)
Mutual labels:  plpgsql
Postgresql Anyarray
PostgeSQL extension adding highly desirable, data-type independent array functionality.
Stars: ✭ 91 (-20.87%)
Mutual labels:  plpgsql
Triprecord
咔咔出行——基于高德地图API,Vue+Express实现的移动端webapp,服务器受到攻击网站暂时下掉了
Stars: ✭ 1,495 (+1200%)
Mutual labels:  plpgsql
Evergreen
Evergreen ILS
Stars: ✭ 85 (-26.09%)
Mutual labels:  plpgsql
Postgraphile Lambda Example
Simple serverless / Lambda example with caching and lightweight bundle
Stars: ✭ 104 (-9.57%)
Mutual labels:  plpgsql
Vocabulary V5.0
PALLAS: Build process for OMOP Standardized Vocabularies. Currently not available as independent release. Therefore, do not clone or try to replicate. It is work in progress and not ready for replication.
Stars: ✭ 114 (-0.87%)
Mutual labels:  plpgsql
Bible Database
Bible databases as XML, JSON, SQL & SQLITE3 Database format for various languages. Developers can download it freely for their development works. Freely received, freely give.
Stars: ✭ 111 (-3.48%)
Mutual labels:  plpgsql
Screampay
screamPay聚合支付,一个强大到让你尖叫的聚合支付系统,使用Java开发,spring-boot架构,已接入环讯、九派、杉德等主流支付渠道,可直接用于生产环境。
Stars: ✭ 107 (-6.96%)
Mutual labels:  plpgsql

Scaledger

pipeline status

A double-entry accounting database with a typed GraphQL API, supporting:

  • Immutable entries
  • An API introspected directly from a PostgreSQL schema
  • GraphQL subscriptions for real-time updates

Basics

Scaledger is designed to be used as a service for recording transactions (called postings) between accounts, and reporting their balances through an entity called ledger. This is particularly useful when you have to track the balances for thousands, or even millions, of individual user accounts such as in the case of marketplaces.

To use it, you deploy it as part of your service architecture and connect over a GraphQL interface. Documentation this interface is available at http://localhost:5000/graphiql

First, create some accounts:

mutation {
  createAccount(input: {account: {type: EQUITY, name: "Y Combinator Seed"}}) {
    account {
      id
    }
  }
}

mutation {
  createAccount(input: {account: {type: ASSET, name: "Cash"}}) {
    account {
      id
    }
  }
}

Next, create a posting between them:

mutation {
  createPosting(input: { posting: {
    creditId: "5c70baa8-f917-4220-afad-1521fdecb5a7",
    debitId: "9c42c59a-7404-47f2-9a63-fb3a8ecab111",
    currency: USD,
    amount: 15000000,
    externalId: "yc-safe-transfer"
  }})
}

You'll notice that the amount field is denominated in the minor value of the currency. This is important - don't use floats for accounting systems! Next, you'll notice currency - Scaledger is natively multi-currency and supports all of the ISO 4217 currency codes. If you're wondering what externalId is, that's required so that each posting from a downstream service is idempotent - as a defense against you sending the same request twice.

Both account and posting also support a metadata field which can be used to store abitrary key/value JSON dictionaries of extra data. Like any good ledger, posting cannot be mutated after it is created - to void a transaction you need to reverse it by creating an inverted one.

The general ledger can be queried after postings are created:

query {
  ledgers {
    nodes {
      accountName
      balance
      currency
    }
  }
}

Lastly, Scaledger also supports WebSockets for newly created postings via the GraphQL Subscription primitive:

subscription {
  postingCreated {
    posting {
      amount
      id
    }
  }
}

Stack

Scaledger uses a purpose-built PostgreSQL schema and provides a GraphQL API.

Services

  • scaledger-db: a PostgreSQL database and ledger schema
  • scaledger-server: a node-based PostGraphile GraphQL API

Development

scaledger includes a docker-compose configuration out of box.

  1. Clone the project
  2. Install Docker Compose
  3. cd docker
  4. Build images with ./scripts/images
  5. docker-compose up

By default, your first initialization of the container will automatically run the schema. Depending on how you've installed docker, you may need to prefix sudo on docker-compose up and on any of the scripts in docker/scripts.

If you'd like to create test data, run ./scripts/seed from inside of docker. You can run ./seed at any point to return the test data and schema to an initial state.

If you wish to recreate the database, or reset it, without any seed data you can run ./schema instead.

To connect to the docker container running the database with psql run ./scripts/psql.

Services In Development

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].