Skip to content

Commit b8ef343

Browse files
authored
Merge pull request #239 from AztecProtocol/josh/ecodr-736-make-a-clear-onboarding-document-for-aztec-starter
Add CLAUDE.md and ONBOARDING.md for developer onboarding
2 parents d9383ca + 7139b7a commit b8ef343

File tree

18 files changed

+3261
-29
lines changed

18 files changed

+3261
-29
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ RUN apt update && apt install -y \
2020
jq \
2121
python3 \
2222
build-essential \
23-
ca-certificates
23+
ca-certificates \
24+
netcat-openbsd
2425

2526
# Install nvm, node and npm
2627
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \

.devcontainer/devcontainer.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
"context": ".",
44
"dockerfile": "Dockerfile"
55
},
6-
"postCreateCommand": "yarn ",
6+
"postCreateCommand": "yarn ",
77
"customizations": {
88
// Configure properties specific to VS Code.
9-
"vscode": {
10-
// Set *default* container specific settings.json values on container create.
11-
"settings": {},
12-
"extensions": ["noir-lang.vscode-noir"]
13-
}
9+
"vscode": {
10+
// Set *default* container specific settings.json values on container create.
11+
"settings": {
12+
// Noir syntax highlighting may not work in Codespaces; use Rust as fallback
13+
"files.associations": {
14+
"*.nr": "rust"
15+
}
16+
},
17+
"extensions": ["noir-lang.vscode-noir"]
18+
}
1419
},
1520
"workspaceMount": "source=${localWorkspaceFolder},target=/root/workspace,type=bind",
1621
"workspaceFolder": "/root/workspace"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ log/
77
codegenCache.json
88
store/
99
.tsbuildinfo
10-
.env
10+
.env
11+
.include-code-cache/

.remarkrc.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { remarkIncludeCode } from 'include_code';
2+
3+
export default {
4+
plugins: [
5+
[remarkIncludeCode, {
6+
codeDir: './src',
7+
repository: { owner: 'AztecProtocol', name: 'aztec-starter' },
8+
commitTag: 'main',
9+
validation: 'error',
10+
}]
11+
]
12+
};

CLAUDE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,30 @@ When updating the Aztec version, update all of these locations:
145145
2. `package.json` — all `@aztec/*` dependency versions
146146
3. `config/local-network.json` and `config/devnet.json``settings.version`
147147
4. `README.md` — install command version
148+
149+
## ONBOARDING.md Maintenance
150+
151+
`ONBOARDING.md` is **generated** — do not edit it directly. Edit `docs/ONBOARDING.src.md` instead, then rebuild:
152+
153+
```bash
154+
yarn docs:build # remark docs/ONBOARDING.src.md -o ONBOARDING.md
155+
```
156+
157+
The source file uses `#include_code` directives (via the `include_code` remark plugin) to extract code snippets from source files at build time. Source files have `// docs:start:<name>` / `// docs:end:<name>` marker pairs that define snippet boundaries.
158+
159+
**When making code changes:**
160+
161+
1. Source code snippets update automatically on rebuild — no manual copy needed
162+
2. If you add/remove/rename a marker, update the corresponding `#include_code` directive in `docs/ONBOARDING.src.md`
163+
3. Run `yarn docs:build` to regenerate `ONBOARDING.md`
164+
4. Phase 5 exercises and non-source prose still need manual updates in `docs/ONBOARDING.src.md`
165+
166+
**Files with `docs:start`/`docs:end` markers:**
167+
168+
- `src/main.nr``storage`, `constructor`, `create-game`, `join-game`, `play-round`, `validate-and-play-round`, `finish-game`, `validate-finish-game`, `finalize-game`
169+
- `src/race.nr``race-struct`, `calculate-winner`
170+
- `src/game_round_note.nr``game-round-note`, `game-round-note-new`
171+
- `src/test/utils.nr``test-setup`
172+
- `src/test/helpers.nr``allocation-strategies`, `setup-helpers`
173+
- `src/test/pod_racing.nr``test-initializer`, `test-fail-too-many-points`
174+
- `src/utils/sponsored_fpc.ts``get-sponsored-fpc`

ONBOARDING.md

Lines changed: 1245 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
This repo is meant to be a starting point for learning to write Aztec contracts and tests on the Aztec local network (local development environment). It includes an example contract, useful commands in `package.json` and helpful scripts in `./scripts`.
1212

13+
**New to Aztec? Start with the [Onboarding Guide](./ONBOARDING.md)** — a progressive walkthrough that takes Ethereum developers from reading code to deploying on devnet.
14+
1315
You can find the **Pod Racing Game contract** in `./src/main.nr`. A simple integration test is in `./src/test/e2e/index.test.ts`.
1416

1517
The Pod Racing contract is a two-player competitive game where players allocate points across 5 tracks over multiple rounds. The game demonstrates Aztec's private state capabilities - round choices remain private until players reveal their final scores.
@@ -45,6 +47,8 @@ export VERSION=4.0.0-devnet.2-patch.1
4547
curl -fsSL "https://install.aztec.network/${VERSION}" | VERSION="${VERSION}" bash -s
4648
```
4749

50+
Then install project dependencies:
51+
4852
### Environment Configuration
4953

5054
This project uses JSON configuration files to manage environment-specific settings:

docs/ONBOARDING.src.md

Lines changed: 857 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"scripts": {
1111
"fees": "NODE_NO_WARNINGS=1 node --loader ts-node/esm scripts/fees.ts",
1212
"fees::devnet": "NODE_NO_WARNINGS=1 AZTEC_ENV=devnet node --loader ts-node/esm scripts/fees.ts",
13-
"clean": "rm -rf ./src/artifacts ./target",
13+
"clean": "rm -rf ./src/artifacts ./target ./codegenCache.json",
1414
"clear-store": "rm -rf ./store",
1515
"codegen": "aztec codegen target --outdir src/artifacts",
1616
"compile": "aztec compile",
@@ -32,6 +32,7 @@
3232
"test::devnet": "AZTEC_ENV=devnet yarn test:js",
3333
"test:js": "rm -rf store/pxe && NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --config jest.integration.config.json",
3434
"test:nr": "aztec test",
35+
"docs:build": "remark docs/ONBOARDING.src.md -o ONBOARDING.md",
3536
"update-readme-version": "node ./.github/scripts/update-readme-version.js"
3637
},
3738
"dependencies": {
@@ -51,7 +52,10 @@
5152
"@types/jest": "^29.5.11",
5253
"@types/mocha": "^10.0.6",
5354
"@types/node": "^22.15.1",
55+
"include_code": "^0.1.0",
5456
"jest": "^29.7.0",
57+
"remark": "^15.0.1",
58+
"remark-cli": "^12.0.1",
5559
"ts-jest": "^29.1.1",
5660
"ts-node": "^10.9.2",
5761
"typescript": "^5.4.4"

scripts/get_block.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import { getAztecNodeUrl } from "../config/config.js";
44

55
async function main() {
66

7-
const nodeUrl = getAztecNodeUrl();
8-
const node = createAztecNodeClient(nodeUrl);
9-
let block = await node.getBlock(BlockNumber(1));
10-
console.log(block)
11-
console.log(await block?.hash())
7+
const nodeUrl = getAztecNodeUrl();
8+
const node = createAztecNodeClient(nodeUrl);
9+
let block = await node.getBlock(BlockNumber(1));
10+
console.log(block?.header)
1211
}
1312

1413
main()

0 commit comments

Comments
 (0)