Skip to content

Commit 110e35a

Browse files
Reorganize Motoko docs into code-guide and deploy-guide folders.
Split monolithic guides into focused files for architecture, features, migrations, testing, mainnet deploy, upgrade, and troubleshooting so future backend work follows a clear step-by-step reference. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5ab2860 commit 110e35a

28 files changed

Lines changed: 1059 additions & 1096 deletions

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,20 @@ WinCanister/
241241
│ ├── migrations/ # Upgrade migrations
242242
│ └── main.mo # Canister entrypoint
243243
├── frontend/ # Next.js dashboard
244+
├── docs/strcuture/motok/ # Motoko code + deploy guides
244245
├── scripts/ # Build & deploy helpers
245246
├── dfx.json
246247
└── mops.toml
247248
```
248249

250+
### Backend developer docs
251+
252+
| Guide | Path |
253+
|-------|------|
254+
| Index | [docs/strcuture/motok/README.md](docs/strcuture/motok/README.md) |
255+
| Code (architecture, features, migrations, tests) | [docs/strcuture/motok/code-guide/](docs/strcuture/motok/code-guide/) |
256+
| Deploy (build, mainnet, upgrade, Vercel) | [docs/strcuture/motok/deploy-guide/](docs/strcuture/motok/deploy-guide/) |
257+
249258
## Contributing
250259

251260
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.

docs/preview/1.png

1.13 MB
Loading

docs/preview/2.jpg

76.1 KB
Loading
194 KB
Loading

docs/preview/image copy.png

166 KB
Loading

docs/preview/image.png

-11.4 KB
Loading

docs/strcuture/motok/README.md

Lines changed: 53 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,35 @@ These docs describe **how to build any canister** in this style — not a single
66

77
---
88

9-
## Documents
10-
11-
| Guide | Purpose |
12-
|-------|---------|
13-
| [code-guide.md](./code-guide.md) | Folder layout, layer rules, request flow, how to add features, migrations, tests |
14-
| [deploy-guide.md](./deploy-guide.md) | Build, local deploy, mainnet install, upgrade, verification, troubleshooting |
9+
## Documentation index
10+
11+
### Code guide — how to write backend
12+
13+
| Doc | Topic |
14+
|-----|-------|
15+
| [code-guide/README.md](./code-guide/README.md) | Index & reading order |
16+
| [architecture.md](./code-guide/architecture.md) | Folder layout, layers, request flow |
17+
| [feature-workflow.md](./code-guide/feature-workflow.md) | Add a feature step-by-step |
18+
| [main-and-migrations.md](./code-guide/main-and-migrations.md) | `main.mo`, timers, migrations |
19+
| [testing.md](./code-guide/testing.md) | Tests, harness, scenarios |
20+
| [conventions.md](./code-guide/conventions.md) | Naming, errors, security, versioning |
21+
| [external-canisters.md](./code-guide/external-canisters.md) | Ledger, index, mocks |
22+
| [checklist.md](./code-guide/checklist.md) | Review, bootstrap, mistakes |
23+
24+
### Deploy guide — how to ship
25+
26+
| Doc | Topic |
27+
|-----|-------|
28+
| [deploy-guide/README.md](./deploy-guide/README.md) | Index & quick commands |
29+
| [prerequisites.md](./deploy-guide/prerequisites.md) | Tools, identity, build rule |
30+
| [build.md](./deploy-guide/build.md) | `build-lottery.sh`, wasm output |
31+
| [local-deploy.md](./deploy-guide/local-deploy.md) | Local replica |
32+
| [mainnet-fresh.md](./deploy-guide/mainnet-fresh.md) | First IC install |
33+
| [mainnet-upgrade.md](./deploy-guide/mainnet-upgrade.md) | Upgrade + memory persistence |
34+
| [frontend-connection.md](./deploy-guide/frontend-connection.md) | Env, agent v3, Vercel |
35+
| [scripts-reference.md](./deploy-guide/scripts-reference.md) | All scripts |
36+
| [troubleshooting.md](./deploy-guide/troubleshooting.md) | Errors & fixes |
37+
| [release-checklist.md](./deploy-guide/release-checklist.md) | Pre-ship checklist |
1538

1639
---
1740

@@ -21,19 +44,19 @@ These docs describe **how to build any canister** in this style — not a single
2144
Client / Frontend
2245
2346
24-
main.mo ──────────── thin actor entrypoint (public API only)
47+
main.mo ──────────── thin actor entrypoint
2548
2649
27-
api/v1/*Controller ─ request handling, caller forwarding
50+
api/v1/*Controller ─ request handling
2851
2952
30-
services/* ─ business rules, workflows, orchestration
53+
services/* ─ business rules
3154
3255
33-
repositories/* ─ data access abstraction
56+
repositories/* ─ data access
3457
3558
36-
storage/* ─ stable memory implementation
59+
storage/* ─ stable memory
3760
```
3861

3962
**Golden rule:** Data flows down. Dependencies never flow up.
@@ -47,26 +70,32 @@ Client / Frontend
4770
| Motoko (`moc`) | 1.7.0 via mops |
4871
| `mo:core` | 2.5.0 |
4972
| `mo:test` | 2.1.1 |
50-
| Persistence | Enhanced orthogonal persistence + migration chain |
51-
| Build | `bash scripts/build-lottery.sh` (moc directly — not `dfx build` for production wasm) |
52-
| Tests | `bash scripts/run-tests.sh``backend/testing/**/*.test.mo` |
73+
| Build | `DFX_NETWORK=ic bash scripts/build-lottery.sh` |
74+
| Tests | `bash scripts/run-tests.sh` (local `backend/testing/`) |
75+
| Mainnet canister | `ulahq-iyaaa-aaaao-bbcoq-cai` |
76+
| Live dashboard | https://win-canister.vercel.app |
5377

5478
---
5579

5680
## When to read which guide
5781

58-
- **Starting a new canister or feature**[code-guide.md](./code-guide.md)
59-
- **First deploy or upgrade to IC mainnet**[deploy-guide.md](./deploy-guide.md)
60-
- **Folder naming only**[../readme](../readme) (short structure reference)
82+
| Goal | Start here |
83+
|------|------------|
84+
| New feature | [code-guide/feature-workflow.md](./code-guide/feature-workflow.md) |
85+
| Migration / upgrade issue | [code-guide/main-and-migrations.md](./code-guide/main-and-migrations.md) |
86+
| First mainnet deploy | [deploy-guide/mainnet-fresh.md](./deploy-guide/mainnet-fresh.md) |
87+
| Upgrade existing canister | [deploy-guide/mainnet-upgrade.md](./deploy-guide/mainnet-upgrade.md) |
88+
| Vercel / frontend 404 | [deploy-guide/troubleshooting.md](./deploy-guide/troubleshooting.md) |
89+
| Short folder tree | [../readme](../readme) |
6190

6291
---
6392

64-
## Checklist before every release
93+
## Pre-release checklist
6594

66-
- [ ] All services have tests under `backend/testing/<name>/`
67-
- [ ] `bash scripts/run-tests.sh` passes
68-
- [ ] `bash scripts/build-lottery.sh` produces wasm
69-
- [ ] New persistent fields have a migration file in `src/migrations/`
95+
- [ ] `bash scripts/run-tests.sh` passes (local)
96+
- [ ] `DFX_NETWORK=ic bash scripts/build-lottery.sh` succeeds
97+
- [ ] Migration added for new persistent fields
7098
- [ ] No business logic in `main.mo` or controllers
71-
- [ ] No direct stable memory access outside `storage/`
72-
- [ ] Public API changes are versioned under `api/v1/` (or new `v2/`)
99+
- [ ] No direct stable memory outside `storage/`
100+
- [ ] API changes versioned under `api/v1/`
101+
- [ ] Frontend IDL synced if API changed

0 commit comments

Comments
 (0)