A Noir project managed by Nargo has a predictable layout. This page explains each part of the project structure and how they work together.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.
Directory layout
After runningnargo new hello_world and nargo check, the project looks like this:
nargo execute, a target/ directory is created:
Nargo.toml
Nargo.toml is the project manifest. It describes the package and its dependencies.
Package section
The[package] section defines metadata for your project:
| Field | Required | Description |
|---|---|---|
name | Yes | Name of the package |
type | Yes | Package type: "bin", "lib", or "contract" |
authors | No | List of author names |
compiler_version | No | Minimum required Nargo version (follows semver operators) |
compiler_unstable_features | No | List of unstable compiler features required |
description | No | Short description of the package |
entry | No | Custom entry point path (overrides src/lib.nr or src/main.nr) |
backend | No | Backend hint for tooling |
license | No | SPDX license identifier |
expression_width | No | Override 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:
src/ directory
Thesrc/ directory holds your Noir source code.
- Binary packages (
type = "bin") usesrc/main.nras the entry point. Themainfunction is the circuit’s interface — its parameters become the program’s inputs. - Library packages (
type = "lib") usesrc/lib.nras the entry point. Libraries expose functions and types for other packages to import; they have nomainfunction. - Contract packages (
type = "contract") are used for Aztec smart contracts.
entry field in Nargo.toml.
main.nr
For binary packages,main.nr defines the circuit’s public API:
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:
--prover-name (-p) flag:
target/ directory
Nargo writes compiled artifacts and witnesses totarget/:
| File | Description |
|---|---|
<name>.json | Compiled circuit in ACIR format. Input to the proving backend. |
<name>.gz | Witness file produced by nargo execute. Contains the full assignment of circuit variables. |
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:
members— list of relative paths to package directoriesdefault-member— the package used when no specific package is targeted by a command
Nargo.toml with a [package] section. Workspaces are useful for monorepos where multiple circuits share a codebase or depend on each other.