Docs/Language/Modules & Packages
Modules & Packages
Organizing code with module and use, capability-granted imports, and the ark package manager.
~2 min read
On this page
Modules
Every .fd file is a module, declared at the top:
module mylib;Import it with use. Transitive imports resolve automatically; you only name what you call:
use mylib;
use network_lib with { Net, IO }; // capability-granted import
use pure_lib; // no capabilitiesThe with { ... } grant is the complete list of what that module can touch; see Capabilities. The compiler resolves stdlib modules from the install layout (FID_HOME on source builds) and project modules relative to your file.
Packages: ark and pacts
ark is the package manager. Packages are called pacts: a pact is a directory of .fd modules plus a manifest. The self-hosted compiler embeds ark (fid ark works too), and the standalone ark binary ships in the installer.
ark init myproject # create ark.toml
ark add mylib --path ../mylib # path dependency (dir or file)
ark add mylib --git https://github.com/user/mylib # git dependency
ark install # install deps into ark_modules/
ark list / ark remove mylib / ark update
ark lock # regenerate ark.lockThe manifest is ark.toml:
[package]
name = "myproject"
version = "0.1.0"
edition = "2026"
[dependencies]
mylib = { path = "../mylib" }
other = { git = "https://github.com/user/other" }ark install fetches dependencies into ark_modules/ and ark.lock records where each came from (not yet a commit or version). use does not search ark_modules/ yet: point it at the dependency’s files for now.
Good to know: the
arkregistry (search,publish) is planned but not live yet; path and git dependencies work today.