runway

package module
v0.0.0-...-92cbc5b Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

README

Runway

Runway is a simple, lightweight, auto-generated backend framework written in Go. It enables rapid development by automatically generating and Admin Console using Gorm Designed for flexibility and ease of use, Runway allows developers to quickly scaffold robust backends with minimal configuration, while still supporting custom logic and extensions. Its efficient, modular architecture makes it ideal for building modern web applications, prototypes, and internal tools with minimal overhead.

Gopher above runway

Usage

Install the tool and run your new admin project:

# Create a new directory for your project
mkdir myrunwayapp
cd myrunwayapp

# Initialize the project
go mod init myrunwayapp

# Get Runway
go get github.com/panzerit/runway

cat >main.go <<EOF
package main

import (
        "log"

        "github.com/panzerit/runway"
        "gorm.io/driver/sqlite"
        "gorm.io/gorm"
)

func main() {
        db, err := gorm.Open(sqlite.Open("db.sqlite3"), &gorm.Config{})
        if err != nil {
                log.Fatalf("failed connecting to sqlite3: %v", err)
        }

        app := runway.New("Runway Tester", "1234567890123456", db)

        // this would override the default homepage
        // app.GET("/", func(c runway.Context) error {
        //      return c.String(200, "Hello from Runway!")
        // })

        app.Start()
}
EOF

# Clean up
go mod tidy

# Run the app
go run main.go

Now just open your browser.

Naming Conventions

Route Handlers

The first word of the handler is the method, followed by the purpose or a specific resource name.

Contribution

I welcome contributions! Whether you want to fix bugs, improve documentation, or suggest new features, your input is valuable. If you have an idea for a new generator template, or want to help make the admin experience even more awesome, open an issue or submit a pull request.

I believe that great admin tools are built by the community, for the community. Let's make something awesome together!

How to Contribute
  • Open Issues: If you find a bug or have a feature request, please open an issue with clear details.
  • Pull Requests: Fork the repo, create a branch, and submit a pull request. Please describe your changes and reference any related issues.
  • Code Style: Follow idiomatic Go conventions. Keep changes focused and well-documented.
  • Respectful Communication: Be kind and constructive in discussions and code reviews.
  • Tests: Add or update tests where appropriate to ensure reliability.

All skill levels are welcome—whether you're new to open source or a seasoned maintainer. Your ideas and feedback help shape the future of this project!

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSecretToShort       = AppError{1, errors.New("secret must be at least 16 characters long"), nil}
	ErrCannotRegisterModel = AppError{2, errors.New("cannot register model"), nil}
)

Functions

func DisableDatabaseLogs

func DisableDatabaseLogs()

func Exit

func Exit(code ExitCode, err error)

func JWTExtractor

func JWTExtractor(next echo.HandlerFunc) echo.HandlerFunc

func MustMeetSecretCriteria

func MustMeetSecretCriteria(secret string)

func Render

func Render(ctx echo.Context, statusCode int, t templ.Component) error

func Terminate

func Terminate(err AppError)

Types

type AppError

type AppError struct {
	ExitCode  int
	Err       error
	DetailErr error
}

func NewAppError

func NewAppError(base AppError, err error) AppError

func (AppError) Error

func (e AppError) Error() string

type AppOption

type AppOption func(*Runway) *Runway

type Context

type Context = echo.Context

type ExitCode

type ExitCode int
const (
	Ok ExitCode = iota
	ConfigurationError
	DatabaseConnectionError
	DatabaseMigrationError
	ServerError
)

type Runway

type Runway struct {
	// contains filtered or unexported fields
}

func New

func New(name, jwtSecret string, db *gorm.DB) *Runway

func (*Runway) CreateUser

func (a *Runway) CreateUser(firstName, lastName, email string) uuid.UUID

func (*Runway) DeleteUser

func (a *Runway) DeleteUser(id uuid.UUID)

func (*Runway) GET

func (r *Runway) GET(path string, fn func(c Context) error)

func (*Runway) Group

func (r *Runway) Group(path string) *echo.Group

func (*Runway) SetPort

func (a *Runway) SetPort(port int) *Runway

func (*Runway) Start

func (a *Runway) Start()

func (*Runway) StaticFS

func (r *Runway) StaticFS(path string, fs fs.FS)

type RunwayLogger

type RunwayLogger struct {
	*slog.Logger
	// contains filtered or unexported fields
}

RunwayLogger is a composite logger that embeds a slog.Logger for structured logging and includes a gormLogger for database logging integration. This allows unified logging across application and database layers.

func NewRunwayLogger

func NewRunwayLogger() *RunwayLogger

Directories

Path Synopsis
template
html
templ: version: v0.3.906
templ: version: v0.3.906
layout
templ: version: v0.3.906
templ: version: v0.3.906
page
templ: version: v0.3.906
templ: version: v0.3.906
partial
templ: version: v0.3.906
templ: version: v0.3.906

Jump to

Keyboard shortcuts

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