This project uses mise to manage development tools and tasks.
- Install mise: If you don't have it yet, follow the Official Getting Started Guide.
- Setup Tools: Run the following command at the project root to install all required dependencies:
mise trust && mise install
Add following to your /etc/hosts before executing mise run up
(workaround to issue #493)
127.0.0.1 registry.local
*.local.trapti.tech, local.trapti.tech which points to 127.0.0.1 are used during development.
Accessing wildcard domains when running under WSL environment may require configuring Windows C:\Windows\System32\drivers\etc\hosts file like following.
127.0.0.1 ns.local.trapti.tech
::1 ns.local.trapti.tech localhost
Recommended dev environment is docker compose. k3d environment is mainly for testing k8s features.
You will need /compose.yaml and /mise.toml at the project root.
mise run up: Spin up development environmentmise run down: Tear down development environment
Everything should automatically start after running mise run up.
- Dashboard: http://ns.local.trapti.tech/
- For more, run
mise tasksto display all available commands
If you use Docker Desktop for Windows and WSL2...
- (recommended) install and use Docker on WSL2 instead of Docker Desktop
- (workaround) run
chmod o+rw /var/run/docker.sock
You will need manifest files in /.local-manifest directory.
mise trust && mise run up(at/.local-manifest): Spin up development environmentmise run down(at/.local-manifest): Tear down development environment- The use of k3d (k3s in docker) allows ease cleanup.
Everything should automatically start after running mise run up.
For more, see .local-manifest/README.md.
Run tests with mise run test.
See mise.toml for more available tasks.
To change the database schema, do the following:
- Change schema in
./migrations/schema.sql. This definition file is the source of truth for all generated tables / codes. - Run
mise run migrateto apply schema changes to local db container in an idempotent manner. - Run
mise run gen(or individually,mise run gen:go && mise run gen:db-docs) to update generated codes and docs via SQLBoiler and tbls. - Write your code.
- Don't forget to modify fields in
./pkg/domainstructs,./pkg/infrastructure/repository/repoconvertfunctions, etc.
- Don't forget to modify fields in
To change the API schema, do the following:
- Change schema in
./api/proto/neoshowcase/protobuf/*.protofiles. These files are the source of truth for all generated codes. - Run
mise run gen(or individually,mise run gen:proto) to generate both server (Go) and client (TypeScript) codes. - Write your code.
- Don't forget to modify fields in
./pkg/infrastructure/grpc/pbconvertetc.
- Don't forget to modify fields in
To add a new internal component, we are using github.com/google/wire.
Example: A new repository in ./pkg/infrastructure/repository, a new use-case service in ./pkg/usecase etc.
- Write a new component.
- Add its constructor method (
New...()) to./cmd/providers.go.- Reference the component from needed component. Example: add the component as a member in
Serverstruct in./cmd/controller/server.go. See./cmd/wire.goto see how each component references multiple internal components.
- Reference the component from needed component. Example: add the component as a member in
- Add config and its default to
./cmd/config.go, if necessary. - Run
mise run gen(or individually,mise run gen:go) to generate DI (dependency injection) codes.