Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kwadwoatta/purshew
Accounting service built with Nest.js, GraphQL and Drizzle ORM
https://github.com/kwadwoatta/purshew
accounting drizzle-orm finance graphql nest nestjs nodejs
Last synced: 2 days ago
JSON representation
Accounting service built with Nest.js, GraphQL and Drizzle ORM
- Host: GitHub
- URL: https://github.com/kwadwoatta/purshew
- Owner: kwadwoatta
- Created: 2024-04-18T17:42:09.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-23T20:01:20.000Z (9 months ago)
- Last Synced: 2024-11-14T07:47:27.083Z (2 months ago)
- Topics: accounting, drizzle-orm, finance, graphql, nest, nestjs, nodejs
- Language: TypeScript
- Homepage:
- Size: 615 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Purshew: Chase Bank set up shop in +234
## Description
Built with NestJS, this service offers a robust and scalable server-side application for accounting purposes. The API leverages GraphQL for efficient data querying and manipulation, ensuring high performance and flexibility. It utilizes Drizzle ORM for seamless database operations, and PostgreSQL for reliable data storage and retrieval.
## Running the app
1. clone the repo
```bash
git clone https://github.com/kwadwoatta/purshew.git
```2. cd into the repo
```bash
cd purshew
```3. copy .env.example to .env and fill them out
4. install all dependencies
```bash
pnpm install
```5. [download docker](https://www.docker.com/products/docker-desktop/)
6. start the postgres (database) service
```bash
docker compose up -d
```7. generate SQL migrations for the drizzle schema definitions
```bash
pnpm drizzle-kit generate:pg
```8. push the generated SQL migrations to the postgres database
```bash
pnpm tsx db/migrate.ts
```9. seed the transaction templates
```bash
pnpm tsx db/seed.ts
```10. (optional) start the drizzle-kit studio to interact with your database
```bash
pnpm drizzle-kit studio
```11. start the app in development mode
```bash
pnpm start:dev
```12. visit url in Altair or Graphql client of choice
```bash
http://[::1]:3000/graphql
```13. signing up a user
```graphql
mutation {
signup(signup: { email: "[email protected]", password: "123" }) {
access_token
}
}
```14. copy access token and set as Header for subsequent requests
```graphql
Authorization: Bearer {your access token}
```15. execute template for Kwame's initial opening balance
```graphql
mutation {
executeTransactionTemplate(
executeTransactionTemplateInput: {
template: kwame_initial_capital
amount: 50000.00
}
)
}
```16. execute template for Kwame's purchase of GHS 20,000 worth of System Units
```graphql
mutation {
executeTransactionTemplate(
executeTransactionTemplateInput: {
template: kwame_system_unit_purchase
amount: 20000.00
}
)
}
```17. execute template for Kwame's sale of GHS 10,000 worth of System Units
```graphql
mutation {
executeTransactionTemplate(
executeTransactionTemplateInput: {
template: kwame_system_unit_sale
amount: 10000.00
}
)
}
```## Stored Procedure
Here is a PostgreSQL stored procedure for generating a balance sheet:
```sql
CREATE OR REPLACE PROCEDURE balance_sheet(INOUT result_set refcursor)
LANGUAGE plpgsql
AS $$
BEGIN
OPEN result_set FOR
SELECT
debit_account_name AS "Debit Account",
debit_amount AS "Amount",
credit_account_name AS "Credit Account",
credit_amount AS "Amount",
description AS "Description"
FROM
transactionsUNION ALL
SELECT
'TOTAL' AS debit_account_name,
SUM(debit_amount) AS debit_amount,
'TOTAL' AS credit_account_name,
SUM(credit_amount) AS credit_amount,
NULL AS description
FROM
transactions;
END;
$$;
```## Stay in touch
- Author - [Prince Ofori](https://princeofori.webflow.io)
- Twitter - [@KwadwoTheAtta](https://twitter.com/KwadwoTheAtta)## License
Purshew API is [MIT licensed](LICENSE).