Skip to content

extreme-business/lingo

Repository files navigation

Lingo

Lingo is a web app. I don't know what it will do, but for now the goals are:

  • single binary, many commands with different functionality, like: serving grpc, http and jobs.
  • use proto as the main way to design api's.
  • use proto to generate https gateways for the grpc servers.
  • add all https services to swagger ui so they can be easily discovered and tested.

todo:

  • make sure 3 tokens are set:
    • registration
    • authentication
    • registration

Setup

The goal with the setup is that minimal tools are needed to run the project.

prerequisites

  • install docker.
  • install openssl, version 3 (for generating certificates and keys).
    • install with brew.
  • install atlas.

local environment

  • run setup.sh. you should be able to run the setup as many times as you want.
    • Specified deps in the buf.yaml need to be covered in your buf.lock file. If you get an error, run scripts/proto-buf-mod-update.sh to generate the buf.lock file.
    • resulting generated files are in the protogen folder.
    • check changes with the buf linter: scripts/proto-lint.sh.

Run locally

  • setup should have completed.
  • run docker-compose up.
  • To view the open-api specs for various services, open localhost:8090 in the browser.
  • List the services: docker compose config | yq '.services[]|key + " | " + .image'

Develop

The goal is to have a good developer experience. That means that the developer should have to read minimal setup guides en be up and running as fast as possible.

Debug

Linting

  • to lint, run ./scripts/lint.sh.

Testing

Test that require a database can use testcontainers.

  • to run all tests, run go run test ./....

Database migrations

Migrations are managed by atlas.

  • to create a new migration, run ./scripts/new-migration.sh <app> <name of migration>.
  • after you have written your migration, run ./scripts/hash-migration.sh <app>.

Proto

Proto files are generated to go server and client code with buf. Buf also generates Openapiv2 files in yaml and json for every service.

  • build the proto files with ./scripts/proto.sh.
  • resulting go files are in proto/gen/go/**/*.go.
  • resulting Openapiv2 files are in proto/gen/openapiv2/**/*{json,yaml}
  • lint the proto files with ./scipts/proto-lint.sh.

Guidelines.

API's