Skip to content

Go framework

NCore.

A Go toolkit for backend services: take only the modules you need, and nothing else comes along.

NCore cover: a core of modular hexagons

Every new backend needs the same groundwork: configuration, databases, logging, sign-in.

NCore turns that groundwork into separate modules, so a new service starts from parts that already work instead of code copied from the last project. My own services are built on it. It is for Go developers, open source under Apache 2.0.

Pick what you need

Core modules

Each one is its own Go module.

Data drivers

Opt in to the ones you use.

Storage and observability

Optional add-ons.

Install

go get github.com/ncobase/ncore/config
go get github.com/ncobase/ncore/data
go get github.com/ncobase/ncore/data/postgres

Start a service

import (
    "github.com/ncobase/ncore/config"
    "github.com/ncobase/ncore/data"

    // Import only the drivers you need
    _ "github.com/ncobase/ncore/data/postgres"
    _ "github.com/ncobase/ncore/data/redis"
)

func main() {
    cfg, err := config.LoadConfig("config.yaml")
    if err != nil {
        panic(err)
    }

    // Drivers register themselves on import
    d, cleanup, err := data.New(cfg.Data)
    if err != nil {
        panic(err)
    }
    defer cleanup()

    db := d.Conn.DB()
    redis := d.Conn.RC
}

Also included

  • Drivers, opt-in

    PostgreSQL, MySQL, MongoDB, Redis, Elasticsearch, Kafka and more, each one only when you add it.

  • Security helpers

    Sign-in tokens, OAuth and encryption helpers.

  • Per-customer data

    Optional per-customer data separation that costs nothing when unused.

  • Logging that grows

    Light logging by default, with tracing and error reporting when you want them.