joist

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 2 Imported by: 0

README

Joist

Joist is a basics-first framework for Go. It is a replacement for go-full-stack. It draws on the knowledge and experience I have gained in the first few runs of setting up a enterprise grade solution for my current project. During the bulk of my last updates to the internals, I realized that I need a common starting ground for any web application I build. Gin is a stellar solution for others, but I wanted to build a more opinionated kit that is compliant with net/http, or easily extended to be so.

The biggest difference from net/http is that Handlers now have a signature that allows them to return an error so that I can centralize error handling and display (func (w http.ResponseWriter, r *http.Request) error). This is handled via an exported adapter that sits just above the handler in the middleware chain. I am using the excellent Chi under the hood for routing and their convenient pre-built middleware collection (mainly rate-limiting and RealIP()).

Not much else is really cached at this point, but I don't see a reason why that won't change should I find I need more caching for obvious caching reasons. Routes are auto-named (until I look into a better, user-defined solution) and cached in a map for easy retrieval. A corresponding URL Builder for named routes and a separate New... method are provided.

Both route caching and sessions are handled via an embedded in-memory (persistent by default) store (BadgerDB).

Eventually, I would really like to implement a declarative routing format that will allow the user to define routes in a single structure, alongside their middleware and any sub-routers/routing groups.

SQL will likely be managed via SQLC and backed by PostgreSQL, although this will be the last piece of the puzzle I implement. I am reluctant to pin myself to one solution here, hence the lean towards SQLC, although the more I read up on Ent the more I like it. Ultimately, I want to be able to freely swap out the database layer without affecting the rest of the framework. Not quite Doctrine ORM, but implementations for a few selected databases would be nice (namely: PostgreSQL, SQLite3, and MySQL/MariaDB).

Documentation

Overview

Package joist is a package that provides a basics-first web framework. Mainly created to satisfy an set of opinionated internal dependencies

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RouteInfo

type RouteInfo struct {
	Method      string
	Name        string
	Path        string
	Description string
	Title       string
}

func NewRouteInfo

func NewRouteInfo(opts ...RouteInfoOpt) (*RouteInfo, error)

type RouteInfoOpt

type RouteInfoOpt func(r *RouteInfo)

func Description

func Description(description string) RouteInfoOpt

func Method

func Method(method string) RouteInfoOpt

func Name

func Name(name string) RouteInfoOpt

func Path

func Path(path string) RouteInfoOpt

func Title

func Title(title string) RouteInfoOpt

type Router

type Router interface {
	router.Router
}

Router consisting of the core routing methods used by chi's Mux, using only the standard net/http.

func NewRouter

func NewRouter() Router

NewRouter returns a *Mux implements the Router interface

Directories

Path Synopsis
internal
routing
Package router implements the router
Package router implements the router
storage
Package storage implements various storages, implementing the Storer interface
Package storage implements various storages, implementing the Storer interface
Package middleware implements custom middlewares
Package middleware implements custom middlewares

Jump to

Keyboard shortcuts

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