sandbox

module
v0.0.117 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2025 License: MIT

README

sandbox

A toy Go microservice intended for use as reference material.

Features

  • Uses a directory structure (mostly) adherent to clean architecture.
  • API provided by ConnectRPC, validation using protovalidate, Buf generated, reflection enabled.
  • Database provided by PostgreSQL, UUIDv7 for primary keys, Jet for SQL query building.
  • OpenTelemetry Metrics and Tracing, standardised metrics and attributes whenever possible.
  • Logging using log/slog.
  • Runtime configuration via Koanf.
  • Grafana (with version-controlled dashboards), VictoriaMetrics and Jaeger for observability.
  • CI using GitHub actions, with Zizmor for linting.
  • Vulnerability and License scanning using Trivy.
  • Secret scanning using Gitleaks.
  • Dependency updates from Dependabot.
  • Packaged using Docker containers, developed with Docker Compose.

Sanity tests

# ready: success
echo '{}' | grpc-client-cli -a localhost:5000 -s Health -m Check

# create: success
echo '{"resource":{"name":"example"}}' | \
	grpc-client-cli -a localhost:5000 -s ExampleService -m CreateResource

# create: success (bulk)
for i in {1..100}; do
	echo "{\"resource\":{\"name\":\"example-$i\"}}" | \
		grpc-client-cli -a localhost:5000 -s ExampleService -m CreateResource
done

# list: success
echo '{}' | grpc-client-cli -a localhost:5000 -s ExampleService -m ListResources

Directories

Path Synopsis
cmd
example-health command
example-rpc command
example-tui command
gen
internal
adapters
Package adapters provides application-specific logic.
Package adapters provides application-specific logic.
domain
Package domain contains the domain layer for the application.
Package domain contains the domain layer for the application.
domain/entities
Package entities contains the models for the application.
Package entities contains the models for the application.
domain/repositories
Package repositories package describes the implementation-agnostic interaction points with other parts of the business.
Package repositories package describes the implementation-agnostic interaction points with other parts of the business.
drivers
Package drivers provides code that is neither application or business specific.
Package drivers provides code that is neither application or business specific.
drivers/exit
Package exit provides constants for process exit codes.
Package exit provides constants for process exit codes.
drivers/pgsql
Package pgsql provides a PostgreSQL implementation of sql.DB.
Package pgsql provides a PostgreSQL implementation of sql.DB.
...
usecases
Package usecases contains the usecases layer for the application.
Package usecases contains the usecases layer for the application.
mocks
pkg
tests
tools
filter-coverage command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL