runa

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 8 Imported by: 0

README

Runa

A Go web framework for business applications.
Start with a lean micro-kernel and install capabilities on demand, from a single route to an enterprise full-stack application.

Docs · 中文文档 · Quick Start · Feedback

English | 简体中文

CI Docs Go Reference License Go


Why Runa

Common framework friction Runa's answer
Small apps want only HTTP, large apps need much more Start with runa + route, then add cache, queue, database, auth, storage, views, i18n, observability, and drivers when needed.
Full-stack frameworks often pull dependencies you never use Each capability is a separate Go module. If you do not import it, it does not enter your compile path.
Router-first design makes background workers and CLI feel secondary The kernel owns lifecycle, DI, config, commands, modules, and host units. HTTP is a pluggable transport.
Business projects need structure, not just handlers Modules, typed routes, explicit validation, resources, CRUD helpers, OpenAPI, queue, schedule, and view integration target business development directly.

Status

Runa is a pre-1.0 public preview. The current public release target is v0.1.1, so APIs may still change before v1.0.

Runa currently targets Go 1.27rc1. Use a Go 1.27 release candidate toolchain until the stable Go 1.27 toolchain is available.

Install

Install only the modules you need:

go get github.com/duxweb/runa
go get github.com/duxweb/runa/route

Quick Start

package main

import (
    "context"

    "github.com/duxweb/runa"
    "github.com/duxweb/runa/route"
)

func main() {
    app := runa.New()
    app.Install(route.Provider(route.Addr(":8080")))

    route.Default().Get("/", func(ctx *route.Context) error {
        return ctx.JSON(runa.Map{"message": "Hello Runa"})
    })

    if err := app.Run(context.Background()); err != nil {
        panic(err)
    }
}

Run it:

go run .
curl http://localhost:8080/

Architecture

Runa is split into four layers:

Kernel        github.com/duxweb/runa
Transports    route / ws / jsonrpc / future grpc
Capabilities  cache / queue / database / storage / auth / session / view / lang ...
Drivers       redis / s3 / amqp / nats / oro ...

The root module provides application startup, dependency injection, config, commands, modules, lifecycle, hosts, errors, and application time. It does not bind HTTP, cache, database, or queue by default.

Capabilities

Capability Install path Purpose
HTTP Route github.com/duxweb/runa/route HTTP host, routing, context, binding, responses, errors
OpenAPI github.com/duxweb/runa/openapi Multi-document OpenAPI integration
Cache github.com/duxweb/runa/cache Named cache pools, memory driver by default
Queue github.com/duxweb/runa/queue Jobs, workers, retry, memory driver by default
Database github.com/duxweb/runa/database Named database runtime and driver registry
Oro Driver github.com/duxweb/runa/database/oro Official Oro ORM database driver
Storage github.com/duxweb/runa/storage Named disks, local driver by default
Session github.com/duxweb/runa/session Cookie/session stores and HTTP middleware
Auth github.com/duxweb/runa/auth Authenticators and auth middleware integration
View github.com/duxweb/runa/view Renderer registry and request-scoped template functions
Lang github.com/duxweb/runa/lang i18n catalogs, translators, locale matching
Task github.com/duxweb/runa/task Named task registry
Event github.com/duxweb/runa/event Event dispatch and listeners
Schedule github.com/duxweb/runa/schedule Cron-style scheduled tasks
Observe github.com/duxweb/runa/observe Trace/metric hooks and observability integration

Driver modules keep heavier dependencies isolated, for example cache/redis, queue/redis, queue/amqp, storage/s3, message/nats, and observe/prometheus.

Beyond HTTP

Runa's kernel is transport-neutral. route is the HTTP transport, ws adds WebSocket support, jsonrpc adds JSON-RPC support, and gRPC is planned as a future transport.

Documentation

Contributing

Read CONTRIBUTING.md before opening a pull request. Keep dependencies explicit, update tests for behavior changes, and update English and Chinese docs together for public-facing changes.

License

Runa is released under the MIT License. See LICENSE.

Documentation

Overview

Package runa provides a CLI-first full-stack Go application framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppPath

func AppPath(path string) runtime.Option

AppPath sets the application source directory relative to the base path.

func BasePath

func BasePath(path string) runtime.Option

BasePath sets the application base directory.

func Config

func Config(name ...string) *config.Store

Config returns the default config store or a named config view.

func ConfigPath

func ConfigPath(path string) runtime.Option

ConfigPath sets the configuration directory relative to the base path.

func DataPath

func DataPath(path string) runtime.Option

DataPath sets the writable data directory relative to the base path.

func DefaultContext

func DefaultContext() context.Context

DefaultContext returns the framework root context.

func Env

func Env(name string) runtime.Option

Env sets the application environment name.

func Execute

func Execute(ctx context.Context, args []string) error

Execute runs a command on the default application.

func Freeze

func Freeze(ctx context.Context) error

Freeze compiles and boots the default application.

func Invoke

func Invoke[T any]() (T, error)

Invoke resolves a dependency from the default container.

func MustInvoke

func MustInvoke[T any]() T

MustInvoke resolves a dependency from the default container or panics.

func New

func New(options ...runtime.Option) *runtime.App

New creates a Runa application.

func Provide

func Provide[T any](constructor func(*App) (T, error))

Provide registers a lazy dependency constructor on the default container.

func ProvideValue

func ProvideValue[T any](value T)

ProvideValue registers an eager dependency value on the default container.

func PublicPath

func PublicPath(path string) runtime.Option

PublicPath sets the public asset directory relative to the base path.

func Run

func Run(ctx context.Context) error

Run executes the default application.

func Shutdown

func Shutdown(ctx context.Context) error

Shutdown stops the default application.

func Timezone

func Timezone(name string) runtime.Option

Timezone sets the application timezone.

func Writer

func Writer(out io.Writer, errOut ...io.Writer) runtime.Option

Writer overrides the standard and error output writers.

Types

type App

type App = runtime.App

App is the Runa application facade type.

func Command

func Command(commands ...runacommand.Command) *App

Command registers commands on the default application.

func Default

func Default() *App

Default returns the process-wide default application.

func Host

func Host(units ...host.Unit) *App

Host registers host units on the default application.

func Install

func Install(providers ...runaprovider.Provider) *App

Install installs providers on the default application.

func Module

func Module(modules ...runtime.Module) *App

Module registers modules on the default application.

func Service

func Service(services ...runtime.Service) *App

Service registers services on the default application.

func SetDefault

func SetDefault(app *App) *App

SetDefault sets the process-wide default application.

type Map

type Map = core.Map

Map is the common dynamic JSON object type.

Directories

Path Synopsis
asset module
audit module
auth module
cache
redis module
cluster module
console module
crud module
database module
oro module
redis module
devtools module
Package host provides Runa host primitives.
Package host provides Runa host primitives.
id module
jsonrpc module
kernel
embedgen module
lang module
lock module
log module
message
redis module
middleware module
observe module
openapi module
rate module
route module
security module
session module
storage module
s3 module
validate module
view module
ws module

Jump to

Keyboard shortcuts

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