Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

pk-runtime

Part of PlatformKit — the open-source Go backend for multi-tenant SaaS.

Depends on. pk-core only. Nothing else in PlatformKit.

Go Reference CI License: Apache-2.0

Small OSS runtime host contracts for the PlatformKit family. pk-core defines module contracts; pk-runtime hosts them. The host layer stays inspectable: route registration, readiness, request context, and fail-closed authorization gates are public contracts, while databases, queues, cloud SDKs, dependency-injection containers, browser automation, and product workflows stay outside the runtime core.

Install

go get github.com/septagon-oss/pk-runtime@v0.1.0

Usage

package main

import (
	"context"
	"log"
	"net/http"

	"github.com/septagon-oss/pk-core/pkg/module"
	"github.com/septagon-oss/pk-runtime/pkg/host"
	"github.com/septagon-oss/pk-runtime/pkg/httpx"
)

func main() {
	catalog := module.NewCatalog().Add(module.NewBundle("app", []module.Entry{
		{ID: "base", New: func() module.Composable {
			return module.Must(module.Metadata{ID: "base"})
		}},
	}, []string{"base"})).MustBuild()

	runtime, err := host.New(context.Background(), host.Input{
		Config:  host.Config{Name: "app"},
		Catalog: catalog,
		Routes: []httpx.Route{{
			ID:      "hello",
			Method:  http.MethodGet,
			Pattern: "/hello",
			Handler: http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
				w.WriteHeader(http.StatusOK)
			}),
		}},
	})
	if err != nil {
		log.Fatal(err)
	}

	log.Fatal(http.ListenAndServe(":8080", runtime))
}

Current Surface

  • pkg/host: compose modules into an immutable runtime, expose /live and /ready, and serve registered routes.
  • pkg/health: deterministic health check registry and aggregate readiness snapshots.
  • pkg/httpx: standard-library HTTP route registry with fail-closed authorization guards.
  • pkg/request: typed request context helpers for tenant and principal data.

Verify

make verify   # go test + go vet + staticcheck + race

License

Apache-2.0. See LICENSE.

About

Runtime host, request, health, and HTTP primitives for PlatformKit OSS.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages