Giter VIP home page Giter VIP logo

acme-ledger's Introduction

acme-ledger

First run

docker-compose up

Run migrations:

docker-compose exec app npx prisma migrate dev

Seed with 2 accounts:

docker-compose cp ./db/seed.sql db:/seed.sql
docker-compose exec db psql postgres postgres -f /seed.sql

Next run

docker-compose up

Usage

Make transactions:

curl --request POST \
  --url http://localhost:3000/v1/transfers \
  --header 'content-type: application/json' \
  --header 'idempotency-key: abcdef123456' \
  --data '{"from_account": "cjld2cyuq0000t3rmniod1foy","to_account": "cldmt86vb0023356kz6cc10p0","amount": "0.000001"}'

Check the balance:

curl --request GET \
  --url http://localhost:3000/v1/accounts/cjld2cyuq0000t3rmniod1foy

Get transactions:

curl --request GET \
  --url 'http://localhost:3000/v1/transfers?account_id=cjld2cyuq0000t3rmniod1foy'

Tests

npm run tests

Development track

  • Develop the plan
  • Start timer 4h // 14:21
  • Task definition // 14:27
  • Tech stack: express.js, Prisma.io, docker, OpenApi spec, Vitest // 14:30
  • Project structure + github repo + docker compose // 14:34
  • Domain design // 14:49
  • OpenApi specs // 15:19
  • Data models design // 15:32
  • Development // 17:22
  • Test // 18:00
  • Dockerize // 18:20
  • Stop timer // 18:21 - 4h
  • Documentation
  • What is next?

TODO

  • cuid -> cuid2
  • errors mechanism
  • transactions list paging: cursors or offset+limit
  • Dockerfile security!
  • Make code entities' names more consistent
  • monitor & debug
  • indexes

acme-ledger's People

Contributors

pavel-voronin avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.