Skip to content

star.mod

star.mod is the project manifest at the root of every StarLang project. It declares the module identity, the StarLang version, the library dependencies, and the config file (if any). The CLI reads it before compiling: it sets up module paths for the compiler and registers the matching native libraries on the VM.

star-lang init creates a minimal one for you.

module star-lang.com/myproject
star 0.1

require ../dev-libs/math v0.1
require ../dev-libs/config v0.1

config config.json
  • Lines starting with # are comments.
  • Empty lines are ignored.

Directives

Directive Form Description
module module <path> Project module path — an identifier, not a URL
star star <version> StarLang version the project targets
require require <path> <version> Declare a library dependency
config config <file> Declare the config file loaded by the config module

require

require ../dev-libs/math v0.1
require /opt/starlang/libs/math v0.1
  • The path is relative to star.mod, or absolute if it starts with / or ~.
  • The last path segment becomes the module name used in import (../dev-libs/mathimport "math").
  • The version is recorded for tracking — not enforced yet.
  • Only modules listed here are available for native import.

When you require a library, two things happen at build time:

  1. The compiler learns the module name and path, so import "math" resolves and math.sqrt(x) compiles to an OP_NATIVE_CALL opcode.
  2. The VM registers that library's native functions at startup — no dynamic loading, no string lookup at runtime.

See Modules for import resolution and namespacing rules.

config

config config.json
config prod.json
config /etc/myapp/settings.json

Declares the file the config module loads. The path is relative to star.mod, or absolute.

  • The host loads this exact file — there is no on-disk guessing. If config is imported but no config <file> is declared, the CLI warns and every getter returns its fallback.
  • Point it anywhere to switch configurations per build, e.g. config prod.json.
  • On deploy, the declared file is provisioned to the device over the serial link (an SLD SET-CONFIG frame) before the image runs, since the device has no filesystem. It stays resident across runs.

Creating a project

star-lang init myproject
myproject/
  star.mod          # this manifest
  main.star         # entry point
  .vscode/
    launch.json     # debug config

The generated manifest has just module and star; add require and config lines as the project grows.