These are some things I somewhat believe in and have tried to follow when
working on this:
Separate data structures for the database, application logic, and endpoints.
Application objects such as the todoModel should be created in a way where
they are valid throughout their lifetime. For example, creating todoModel
with newTodo. And modifying todoModel with well defined receivers like
setName.
Application logic should not be dependent on something like http. For example,
the todo package is useful without the rest package. In theory, the todo
package could easily be consumed by a cron package or a console package if
needed.
Everything should be testable and tested. Developing a new feature doesn't
involve the developer doing lots of manual testing.
The app should not need a database, or redis, or docker, etc. to run. For
example, this is accomplished by having the memory repositories, which are
useful when writing tests for the application logic.
To ensure it is valid, SQL should be tested at least once with integration
tests.
Database details should not leak into application logic.
Try to comment data structures and public members.
Probably forgetting the rest.
🙏 Credit
Here are some things that inspired this project in some way: