bootstrap

package
v0.0.0-...-2757dea Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package bootstrap contains functionality to quickly launch bootstrapped versions of Apollo applications

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Full

func Full[state BootstrappedState[state]](
	stt state,
	cfg *config.Config,
	staticFS embed.FS,
	middlewares ...server.Middleware[state],
) *server.Server[state]

Full creates a new server and initializes all default systems. The Full bootstrapper is perfect for (complex) web applications.

This will initialise the server itself as well as most middleware, Sentry and PostHog (if enabled in config), and a postgres database.

You can supply additional middleware if you want to.

Note that this function will add routes before returning, which means it is not possible to add additional global middleware after calling this function.

func Minimal

func Minimal[state server.State](
	stt state,
	cfg *config.Config,
	staticFS embed.FS,
	middlewares ...func(http.Handler) http.Handler,
) *server.Server[state]

Minimal creates a new server and initializes all default systems. The Minimal bootstrapper is perfect for very lightweight applications or (almost) static sites.

This will only initialise the server itself with some middleware but no other services.

You can supply additional middleware if you want to.

Note that this function will add routes before returning, which means it is not possible to add additional middleware after calling this function.

Types

type BootstrappedState

type BootstrappedState[state server.State] interface {
	server.State
	Init(server *server.Server[state], cfg *config.Config, db *postgres.DB, posthog posthog.Client)
}

BootstrappedState is a state that is initialised through bootstrapping.

The state is responsible for closing the database and the posthog client in its own Close function after it's done using it. The posthog client will be nil if posthog was disabled in config.

Jump to

Keyboard shortcuts

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