Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.48 KB

README.md

File metadata and controls

45 lines (33 loc) · 1.48 KB

Thunder

Thunder is a collection of libraries and opinionated patterns to build cloud-native services. The project provides different modules, which can be used individually and replaced at any time.

Most of the modules use consolidated projects under the hood, the idea of this project is to provide wrappers and connect all of these pieces.

The modules are imported to the root of your app, you can then provide them to the rest of your project, below we're using Uber fx to perform the dependency injection.

// main.go
package main

import (
	transportinbound "github.com/gothunder/thunder/example/internal/transport-inbound"
	transportoutbound "github.com/gothunder/thunder/example/internal/transport-outbound"
	thunderEventRabbitmq "github.com/gothunder/thunder/pkg/events/rabbitmq"
	thunderLogs "github.com/gothunder/thunder/pkg/log"

	"github.com/rs/zerolog/diode"
	"go.uber.org/fx"
)

func main() {
	var w diode.Writer

	app := fx.New(
		// The order of these options isn't important.
		thunderLogs.Module,
		fx.Populate(&w),

		transportinbound.Module,
		transportoutbound.Module,

		thunderEventRabbitmq.PublisherModule,
		thunderEventRabbitmq.InvokeConsumer,
	)
	app.Run()

	// This is required to flush the logs to stdout.
	// We only want to do this after the app has exited.
	thunderLogs.DiodeShutdown(w)
}

You can check your docs for instructions on how to use it, also there's a basic example.