Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/noir-lang/noir/llms.txt

Use this file to discover all available pages before exploring further.

A Noir project managed by Nargo has a predictable layout. This page explains each part of the project structure and how they work together.

Directory layout

After running nargo new hello_world and nargo check, the project looks like this:
hello_world/
├── Nargo.toml        # Project manifest
├── Prover.toml       # Prover inputs
└── src/
    └── main.nr       # Program entry point
After executing with nargo execute, a target/ directory is created:
hello_world/
├── Nargo.toml
├── Prover.toml
├── src/
│   └── main.nr
└── target/
    ├── hello_world.json   # Compiled circuit artifact (ACIR)
    └── hello_world.gz     # Witness file

Nargo.toml

Nargo.toml is the project manifest. It describes the package and its dependencies.
[package]
name = "noir_starter"
type = "bin"
authors = ["Alice"]
compiler_version = "0.9.0"
description = "Getting started with Noir"
entry = "circuit/main.nr"
license = "MIT"

[dependencies]
ecrecover = {tag = "v0.9.0", git = "https://github.com/colinnielsen/ecrecover-noir.git"}

Package section

The [package] section defines metadata for your project:
FieldRequiredDescription
nameYesName of the package
typeYesPackage type: "bin", "lib", or "contract"
authorsNoList of author names
compiler_versionNoMinimum required Nargo version (follows semver operators)
compiler_unstable_featuresNoList of unstable compiler features required
descriptionNoShort description of the package
entryNoCustom entry point path (overrides src/lib.nr or src/main.nr)
backendNoBackend hint for tooling
licenseNoSPDX license identifier
expression_widthNoOverride the default backend expression width
compiler_version follows Rust’s semver convention. For example, compiler_version = "^0.18.0" accepts any version >= 0.18.0 and < 0.19.0.

Dependencies section

The [dependencies] section lists external Noir packages. Each dependency can be fetched from a git repository with a specific tag:
[dependencies]
ecrecover = {tag = "v0.9.0", git = "https://github.com/colinnielsen/ecrecover-noir.git"}
See the modules and packages guide for more on dependency resolution and importing.

src/ directory

The src/ directory holds your Noir source code.
  • Binary packages (type = "bin") use src/main.nr as the entry point. The main function is the circuit’s interface — its parameters become the program’s inputs.
  • Library packages (type = "lib") use src/lib.nr as the entry point. Libraries expose functions and types for other packages to import; they have no main function.
  • Contract packages (type = "contract") are used for Aztec smart contracts.
You can override the default entry point using the entry field in Nargo.toml.

main.nr

For binary packages, main.nr defines the circuit’s public API:
fn main(x: u64, y: pub u64) {
    assert(x != y);
}
Parameters without pub are private inputs, known only to the prover. Parameters marked pub are public inputs, visible to the verifier. The body of main defines the constraints that a valid proof must satisfy.

Prover.toml

Prover.toml supplies input values to the program during execution. Keys correspond to main function parameters:
x = "1"
y = "2"
For structured types, TOML arrays and tables are used. For example, an array of structs:
[[foos]]  # foos[0]
bar = 0
baz = 0

[[foos]]  # foos[1]
bar = 0
baz = 0

[[foos]]  # foos[2]
bar = 1
baz = 2
You can use a custom-named TOML file with the --prover-name (-p) flag:
nargo execute foo

target/ directory

Nargo writes compiled artifacts and witnesses to target/:
FileDescription
<name>.jsonCompiled circuit in ACIR format. Input to the proving backend.
<name>.gzWitness file produced by nargo execute. Contains the full assignment of circuit variables.
The target/ directory is auto-generated and should typically be excluded from version control (add it to .gitignore).

Workspaces

A workspace groups multiple Nargo packages in a single repository. Instead of a [package] section, the top-level Nargo.toml uses a [workspace] section:
[workspace]
members = ["crates/a", "crates/b"]
default-member = "crates/a"
  • members — list of relative paths to package directories
  • default-member — the package used when no specific package is targeted by a command
Each member directory contains its own Nargo.toml with a [package] section. Workspaces are useful for monorepos where multiple circuits share a codebase or depend on each other.
Use workspaces when building a project that includes both a main circuit and reusable library packages.

Build docs developers (and LLMs) love