Skip to main content
Version: v0.2.2

Add to an existing project

You can adopt the SDK one module at a time. Start with initialization and the module that solves your immediate need.

1. Install the version

go get github.com/colibriproject-dev/colibri-sdk-go@v0.2.2

2. Configure the required variables

ENVIRONMENT=development
APP_NAME=my-existing-service
APP_TYPE=service
CLOUD=none

InitializeApp() automatically looks for a .env file in the working directory. In production, prefer variables injected by the platform.

3. Initialize the application

import colibri "github.com/colibriproject-dev/colibri-sdk-go"

func main() {
colibri.InitializeApp()
// Existing application initialization.
}

The alias is optional: the root package is already named colibri.

4. Adopt a module

To migrate an existing HTTP server:

import "github.com/colibriproject-dev/colibri-sdk-go/pkg/web/restserver"

func main() {
colibri.InitializeApp()
restserver.AddRoutes(routes)
restserver.ListenAndServe()
}

Database, cache, messaging, and storage have their own Initialize() function. See the application lifecycle.

Migration notes

  • ListenAndServe() blocks; call it after registering routes and middleware.
  • Do not initialize modules the service does not use.
  • Propagate context.Context through handlers, use cases, and infrastructure.
  • Run existing tests after migrating each module.
  • Check compatibility before upgrading.