3.9 KiB
TODOs
Things left to be done before the project is in an okay state
Structure
Consider modularizing the project further
Service/Logic layer
A layer that handles the logic so it's decoupled from the grpc implementation
Options
The ways to achieve it that I can think of are
- a struct with methods that implement the logic and will also hold the db which gets passed to it from the grpc server struct
- a set of functions that implement parts of the logic and the grpc layer will handle db interaction
- a set of functions that take the db as an argument and will be called from the grpc layer
Logger
Currently the logger is hard-coded to be the log
package from the standard library, should probably change that
Documentation
Since this is a showcase of a template there should be good documentation
Tools
This tool seems really interesting protoc-gen-doc
Code comments
Add more comments in code to explain the rationale behind decisions as well as the not immediately-obvious parts
Architecture
By far the most complicated thing here is the internal structure
- add
ARCHITECTURE.md
to explain it - add graphviz graph to explain it
Environment variables
Create a table of environment variables used throughout the project with a description and default values
Working with the project
It's not immediately obvious how to use surrounding tooling
- document how to use pprof, fgprof
- document how to use buf
CI-type files
The more CI, the better
- add
Jenkinsfile
- add
.travis.yml
- add whatever Tekton has
Deployment files
Need a way to run the application
- add
docker-compose.yml
for easier local testing with a real db - add raw kubernetes yaml
- add kustomize yaml to demonstrate testing/prod
Tests
A lot of things don't have tests
- non-mock databases. can try dockertest and testcontainers for this
- models/interfaces (no idea how to test these)
- could use gotests to generate boilerplate for tests
Optimization
Go gotta go brrr
Struct alignment
Align struct fields using fieldalignment (main.go file is in this repo)
Errors
Wrap errors to add details at each step instead of doing return nil, err
Functionality
Functionality is not yet complete
Add default docs handler
Currently /api/docs/
results in error, it should point to current version docs
Replace Empty gRPC message
If we want to accept something other than Empty there will be problems in the future so to avoid this replace it with a HelloFilter message or something
Additional version demo
Add later API versions to demonstrate that fields can be added but breaking changes need a full API version change
Rethink REST api versioning
Might want to actually namespace this but it works somewhat okay
Repo
Adjust repos to store and retrieve all info for HelloRequest/HelloResponse
Extra repo options
The more, the merrier
Multiplexing
Add the option to run both grpc and rest on the same port but explain why it's dumb
Standalone server
Add function CreateListenerFromPortAndAddress in utils
to be able to create a listener from a user-supplied address.
Also add an env var or two (HELLO_GRPC_ADDRESS
, HELLO_REST_ADDRESS
) and maybe a CLI too to run with that user-supplied address
Frontend
Look at frontend implementation on lister for optionally split frontend Two approaches:
- embed frontend by default and have a
cmd/standalone
for running it on its own - exclude frontend by default and have a
cmd/frontend
orcmd/omnibus
for running it embedded