Modules
- Modules. Code organises in modules: mod blocks and files, use bringing paths into scope.
- Visibility. Items are private unless pub: the public surface declared name by name.
- Project layout. A package’s src tree mirrors its module tree: navigation by convention.
Scarb
- Scarb. Scarb is Cairo’s package manager and build tool: manifest, dependencies, build, one tool.
- Scarb.toml. The manifest declares name, version and dependencies: pinned for reproducible builds.
- Workspaces. Workspaces hold sibling packages: protocol, tests and scripts building together.
Package Organisation
- Library versus contract. Packages split pure libraries from Starknet contracts: logic testable off-chain.
- Dependency hygiene. Every dependency ships in your trusted base: audited on entry, pinned by version.
- Docs and examples. Packages carry examples and docs: the ecosystem is young, and your README is its textbook.
Before and after this level
- Before: Level 4: Traits & Generics: Traits, Generic Types, Reusable Cairo Abstractions.
- Next: Level 6: Starknet Contracts: Contract Structure, Storage, External Functions.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Cairo Level 5: Modules & Packages cover?
Modules, Scarb, Package Organisation: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 4: Traits & Generics, which covers Traits, Generic Types, Reusable Cairo Abstractions.