A Simple Accounting Ledger
- Simple application which writes and reads accounting ledger entries
- buf
-
brew install bufbuild/buf/buf go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
-
- gofumpt for formatting.
- golangci-lint for linting.
- colima for container runtimes.
- jaeger for local trace collector and ui.
- nats for eventing.
TODO
- o11y
- Add tracing
- Add tracing to response.go files
- Add metrics
- OpenTelemetry metrics ready?
- Log Collector?
- move off Jaeger, and all in on Grafana stack
- Add tracing
- make a frontend with some dashboard functionality, (vue3 plz) OOOOH!!!
- replace hampgoodwin/errors with go std lib multi-errors <3!!!
- health checks
- add a health reporter
- add health checks
- improve pagination by displaying page number of result.
- Testing
- Add more unit tests, solitary and sociable
- Add Integration testing
- Add fail case account controller testing
- Use httptest for tests instead of setting up an http server for each test
- Fix bug where connection is rejected (I sus due to db+http connection limitations in unix)
- Improve test coverage by testing more grpc methods
- Add cursor testing for listing accounts
- Add fuzzing
- Create a seeder for a basic dev environment of data
- Do some stress testing; how much data and we throw at & get out of this thing?
- Optimize the get transactions call to use a single query; full join, order and then iterate to make transactions object
- Add a stress testing system
- set up dev appvault and set secrets
- add default limit size as a configurable somewhere
- set up configuration loader or a new secrets loader to load values from appvault
- redis datastore? Maybe later.
- retry startup dependecies
- wont do; i would prefer to rely on some container/pod scheduler like k8s
- Events
- NATS
- Run NATS locally in a cluster
- Instrument account.created, transaction.created events
- NATS
- improve startup configurations
- update env config to include configurations for nats
- [s] add configuration for starting nats wire tap in main-app
- add gRPC methods, matching http spec
- add gRPC server start to main?
- add gRPC method tests..? idk
- better startup logging
- info and such about what's starting.
- make basis an enum
- re-evaluate type validation logic in the service
- implement db types and transformers
- add tests
- implement safer enums
- migrate to guid from uuid
- probably requires db migration/update
- migrate to ksuid from uuid
- version the api's
- use httpapi models for request/response of all resources
- decouple application runtime, environment, controller, and test!
- implement golang-migrate or similar db migration strategy
- include the sql files as bin data in binary so migrator can run them ez pz
- Complete the basic CRUD for book-keeping
- make DB methods for CRUD
- set up linting
- Add metadata fields for all tables (created_at, updated_at)
- Better error handling
- Better error logging
- Pagination
- swap pq for pgx
- Add code-coverage report via github actions?
- Add service layer
- Decouple app setup and routing
- implement a separate errors package like unto nate finches error flags solution
- split api encode and write code
- swap to uuid over auto incr values for id's
- swap go-chi router logger to use zap logger stored in environment; log more.
-
add delete request response with message that this ledger is append only and records cannot be deleted404 is fine - fix timestamp for created_at to be utc time zone
- change limit and cursor to optional values
- use stable pagination for uuid
- swap to nubanks balanced by design transaction model
- replace transaction with single value and debit/credit accounts; balanced by design
- change the amount in oas to string, and change amount values to int64 in controller/service
- because postgres (and most dbs) don't OOB implement unsigned ints, use an int 64, which should be more than enough for any needs we'll have. In the case where a string request comes in (upper unbounded), split into multiple entries which will fit into int63's. Probably implement some overflow checks as well.
- generate zero-dep html file for api docs and create serve w/ makefile commands
- implement standard api response and error response to simplify controll handler functions
- more elegant error response handling
- better logging
-
Use https://mermade.github.io/openapi-gui/ to generate OAS and serve itI went with hand-rolled .yml and redocly serving - Give config.Database a method to create a connection string
- Replace NewDatabase with a single conn string vs broken out vars?
- Improve convention for environment variable key constants?
- set environment types as consts