Skip to content
Foundation
Foundation

Open. Modular. Built for creators.

A modern, modular server framework for nanos world.

Foundation runs as a regular script package and gives every other package the same platform. It ships no gameplay: economy, jobs or shops live in separate packages that you combine and replace freely.

  • Open source MIT license, code on GitHub
  • A regular package No C module, no unsafe flag
  • Documented Guides in English and French

Early development

Foundation 0.1.0

Version 0.1.0 has not been released yet. Install it from the source repository to try it on a test server; the API may change before 1.0.

Requires nanos world 1.156 or newer.

What works today

Available today

Everything listed here is in the current version and covered by the documentation.

Lifecycle and ownership
Each package gets a context that knows its state and the resources it owns, and releases them when the package stops.
Package settings
Declare settings with a schema: Foundation writes a commented TOML file for administrators, validates every value and returns the result.
Localization
Register texts per language in a catalog. Foundation picks the language, fills in values and chooses the plural form.
Keys and validation
Namespaced keys keep identifiers apart; schemas check configuration, stored data and player input before your code uses them.
Timers and futures
Delays, repeats, debounce, throttle and futures belong to the package and are cancelled when it stops.
Readable logs
One line per record, naming the package and the part of Foundation that wrote it, with stack traces for failing callbacks.

Latest builds

View builds

A package in a few lines

A package registers with Foundation from its server code and receives a context. This example is part of Foundation’s integration tests, so it runs as shown.

  1. Install

    Copy the repository’s package folder to your server as Packages/foundation.

  2. Declare the dependency

    List foundation in the packages_requirements of your package so the server loads it first.

  3. Register

    Call Foundation.Register from your server code and build on the context it returns.

Server/Index.lua Lua
local context = Foundation.Register(Package, {
	api = "0.1",
	name = "Greeter",
})

local function on_ping(player_name)
	Console.Log("pong for %s", player_name)
end

Events.Subscribe("greeter:ping", on_ping)
context:Track("event_listener", function()
	Events.Unsubscribe("greeter:ping", on_ping)
end)

context:OnReady(function()
	Console.Log("Greeter is ready")
end)

context:OnDisable(function()
	Console.Log("Greeter is shutting down")
end)

Start building with Foundation

Guides, references and a working example to write your first package.