No description https://gosalusa.com
  • Go 99.5%
  • HTML 0.4%
Find a file
Adam Bibby 6fa63cbb89
make sql.Null private and add action (#29)
Co-authored-by: Adam Bibby <adam@bibby.io>
2026-09-29 06:20:37 -04:00
.github/workflows make sql.Null private and add action (#29) 2026-09-29 06:20:37 -04:00
auth Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
cache Add match package (#25) 2026-09-25 18:23:46 -04:00
clog Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
database move nulls to optional (#26) 2026-09-27 20:57:35 -04:00
di Add match package (#24) 2026-09-18 07:51:10 -04:00
docs Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
email Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
env Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
errors Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
event move nulls to optional (#26) 2026-09-27 20:57:35 -04:00
extra Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
fileserver Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
filesystem Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
internal Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
jsonio Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
kernel Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
openapidoc Add match package (#25) 2026-09-25 18:23:46 -04:00
optional make sql.Null private and add action (#29) 2026-09-29 06:20:37 -04:00
pubsub Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
request move nulls to optional (#26) 2026-09-27 20:57:35 -04:00
router Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
salusaconfig Add db queue (#20) 2026-08-25 18:13:33 -04:00
spice Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
static Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
stream Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
testing Add match package (#24) 2026-09-18 07:51:10 -04:00
validate Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
view Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
.gitignore Add auth routes (#9) 2024-03-23 13:22:20 -04:00
.golangci.yml Increase test coverage (#18) 2026-08-02 21:28:53 -04:00
.testcoverage.yml Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00
AGENTS.md Ci cleanup (#27) 2026-09-28 08:34:56 -04:00
docker-compose.yml Ci cleanup (#27) 2026-09-28 08:34:56 -04:00
go.mod move nulls to optional (#26) 2026-09-27 20:57:35 -04:00
go.sum move nulls to optional (#26) 2026-09-27 20:57:35 -04:00
LICENCE.txt rename models to model 2023-09-08 07:37:44 -04:00
Makefile Add db queue (#20) 2026-08-25 18:13:33 -04:00
README.md Move to gosalusa.com (#23) 2026-09-13 06:16:14 -04:00

Salusa

Coverage Go Reference

What is Salusa?

Salusa is a group of utilities to speed up web development in go. They can be used individually in existing projects or all together with the project template.

Packages

Dependancy Injection

The core of the Salusa framework is DI. It is used to get data into the http handlers and services you will create in a clean and consistent way.

Resources can be injected directly into Salusa http handlers.

type Request struct {
    DB *sqlx.DB `inject:""`
}
request.Handler(func(r *Request) (*Model, error) {
    return builder.From[*Model]().Find(r.DB, 1)
})

And services


type Service struct {
	Logger *slog.Logger `inject:""`
}

func (s *Service) Name() string {
	return "service-name"
}

func (s *Service) Run(ctx context.Context) error {
    s.Logger.Info("log message")
    return nil
}

Database - Builder

The database builder is used to create database queries. It uses a simple builder to make it easy to create dynamic queries.

model, err := builder.From[*your.Model]().Where("column", "=", "value").First(db)

Creating a Salusa Project

Before creating a salusa project you must have the go toolchain installed, instructions can be found here. You may also need node and npm to create frontends, they can be installed with the instructions found here.

After you have your environment set up you can install the spice utility with go:

go install gosalusa.com/spice@latest

Once you have installed spice you can create a new project with the init command:

spice init github.com/abibby/example-app

Once you have the created the app you can run the server with the dev command:

spice dev

After starting the development server you can access the application through you browser at http://localhost:2303.

Project Structure

root
├ app
│ ├ events
│ ├ handlers
│ ├ jobs
│ └ models
├ config
├ database
├ migrations
├ resources
└ routes

App

The app direcoty contains all of the buisness logic of your application. In a new project the only file in this directory is kernel.go which is the core of the application. The kernel manages all of the long running services in you application. You can find more information in the kernel docs

Events

The events directory contains all of the events that you application can emit.

Handlers

handlers contains all of the http handlers in your application. In a standard application they all implement the http.Handler interface. Salusa provides the request.Handler helper for creating APIs that speeds up handling user input and returning json. Documentation can be found here.

Jobs

Models