diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-04 10:25:53 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-04 10:25:53 +0000 |
| commit | 52bad9954cdddf55ab749fd0c6387edbc766632f (patch) | |
| tree | d9dd2078b70a627a71d1adb9555cee83faec5cd0 /docs/tutorials/getting-started.md | |
| parent | db460efdd4cf34d3b6ac8c19b1b8f89f22bc279f (diff) | |
docs: use Diátaxis structure
Diffstat (limited to 'docs/tutorials/getting-started.md')
| -rw-r--r-- | docs/tutorials/getting-started.md | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/docs/tutorials/getting-started.md b/docs/tutorials/getting-started.md new file mode 100644 index 0000000..1a56985 --- /dev/null +++ b/docs/tutorials/getting-started.md | |||
| @@ -0,0 +1,209 @@ | |||
| 1 | # Tutorial: Getting Started with ngit-grasp | ||
| 2 | |||
| 3 | **Purpose:** Learn the basics of ngit-grasp through hands-on setup | ||
| 4 | **Time:** 15-20 minutes | ||
| 5 | **Prerequisites:** Basic Git and command-line knowledge | ||
| 6 | |||
| 7 | --- | ||
| 8 | |||
| 9 | ## What You'll Learn | ||
| 10 | |||
| 11 | By the end of this tutorial, you will: | ||
| 12 | - ✅ Have a working ngit-grasp development environment | ||
| 13 | - ✅ Understand the basic project structure | ||
| 14 | - ✅ Run the test suite successfully | ||
| 15 | - ✅ Know where to go next | ||
| 16 | |||
| 17 | --- | ||
| 18 | |||
| 19 | ## Step 1: Clone the Repository | ||
| 20 | |||
| 21 | First, get the source code: | ||
| 22 | |||
| 23 | ```bash | ||
| 24 | git clone https://gitworkshop.dev/ngit-grasp | ||
| 25 | cd ngit-grasp | ||
| 26 | ``` | ||
| 27 | |||
| 28 | **What just happened?** You cloned the ngit-grasp repository from the GRASP-enabled Git server. | ||
| 29 | |||
| 30 | --- | ||
| 31 | |||
| 32 | ## Step 2: Set Up Nix Development Environment | ||
| 33 | |||
| 34 | ngit-grasp uses Nix flakes for reproducible development environments. | ||
| 35 | |||
| 36 | ```bash | ||
| 37 | # Enter the development environment | ||
| 38 | nix develop | ||
| 39 | |||
| 40 | # You should see a new shell with all dependencies available | ||
| 41 | ``` | ||
| 42 | |||
| 43 | **What just happened?** Nix read `flake.nix` and created a shell with: | ||
| 44 | - Rust toolchain (cargo, rustc) | ||
| 45 | - Git | ||
| 46 | - All required system libraries | ||
| 47 | |||
| 48 | **Tip:** If `nix develop` doesn't work, you might be using an old Nix version. See the [Nix Flakes How-To](../how-to/nix-flakes.md) for help. | ||
| 49 | |||
| 50 | --- | ||
| 51 | |||
| 52 | ## Step 3: Explore the Project Structure | ||
| 53 | |||
| 54 | Take a look around: | ||
| 55 | |||
| 56 | ```bash | ||
| 57 | # View the project structure | ||
| 58 | ls -la | ||
| 59 | |||
| 60 | # Key directories: | ||
| 61 | # - src/ - Main ngit-grasp source code (coming soon) | ||
| 62 | # - grasp-audit/ - Compliance testing tool (working) | ||
| 63 | # - docs/ - Documentation (you are here!) | ||
| 64 | ``` | ||
| 65 | |||
| 66 | **What you're seeing:** | ||
| 67 | - `grasp-audit/` is a **subproject** with its own Cargo workspace | ||
| 68 | - Main ngit-grasp server implementation is planned but not yet started | ||
| 69 | - Documentation uses Diátaxis framework (tutorials, how-to, reference, explanation) | ||
| 70 | |||
| 71 | --- | ||
| 72 | |||
| 73 | ## Step 4: Work with grasp-audit | ||
| 74 | |||
| 75 | The compliance testing tool is the first working component. Let's try it: | ||
| 76 | |||
| 77 | ```bash | ||
| 78 | # Navigate to grasp-audit | ||
| 79 | cd grasp-audit | ||
| 80 | |||
| 81 | # Enter its development environment | ||
| 82 | nix develop | ||
| 83 | |||
| 84 | # Build the project | ||
| 85 | cargo build | ||
| 86 | |||
| 87 | # Run unit tests | ||
| 88 | cargo test | ||
| 89 | ``` | ||
| 90 | |||
| 91 | **What just happened?** | ||
| 92 | - `grasp-audit` has its own `flake.nix` for isolated dependencies | ||
| 93 | - Unit tests run without external dependencies | ||
| 94 | - Integration tests (marked `#[ignore]`) require a Nostr relay | ||
| 95 | |||
| 96 | --- | ||
| 97 | |||
| 98 | ## Step 5: Run Your First Audit (Optional) | ||
| 99 | |||
| 100 | If you want to try the audit tool against a real relay: | ||
| 101 | |||
| 102 | ```bash | ||
| 103 | # In a separate terminal, start a test relay: | ||
| 104 | docker run --rm -p 7000:7000 scsibug/nostr-rs-relay | ||
| 105 | |||
| 106 | # Back in grasp-audit directory: | ||
| 107 | cargo test --ignored -- --test-threads=1 | ||
| 108 | ``` | ||
| 109 | |||
| 110 | **What just happened?** Integration tests connected to the relay on port 7000 and verified GRASP compliance. | ||
| 111 | |||
| 112 | **Note:** This step is optional. The relay must be running for these tests to pass. | ||
| 113 | |||
| 114 | --- | ||
| 115 | |||
| 116 | ## Step 6: Explore the Code | ||
| 117 | |||
| 118 | Let's look at a simple example: | ||
| 119 | |||
| 120 | ```bash | ||
| 121 | # From grasp-audit directory | ||
| 122 | cat examples/simple_audit.rs | ||
| 123 | ``` | ||
| 124 | |||
| 125 | This shows how to use the `grasp-audit` library to check GRASP compliance. | ||
| 126 | |||
| 127 | --- | ||
| 128 | |||
| 129 | ## Step 7: Read the Documentation | ||
| 130 | |||
| 131 | Now that you have a working setup, explore the documentation: | ||
| 132 | |||
| 133 | ```bash | ||
| 134 | # From project root | ||
| 135 | cd .. | ||
| 136 | ls docs/ | ||
| 137 | ``` | ||
| 138 | |||
| 139 | **Recommended reading order:** | ||
| 140 | 1. [Architecture Overview](../explanation/architecture.md) - Understand the design | ||
| 141 | 2. [Inline Authorization](../explanation/inline-authorization.md) - Key decision | ||
| 142 | 3. [Git Protocol Reference](../reference/git-protocol.md) - Technical details | ||
| 143 | |||
| 144 | --- | ||
| 145 | |||
| 146 | ## What You've Accomplished | ||
| 147 | |||
| 148 | Congratulations! You now have: | ||
| 149 | |||
| 150 | ✅ A working Nix development environment | ||
| 151 | ✅ Built and tested the grasp-audit tool | ||
| 152 | ✅ Understanding of the project structure | ||
| 153 | ✅ Knowledge of where to find more information | ||
| 154 | |||
| 155 | --- | ||
| 156 | |||
| 157 | ## Next Steps | ||
| 158 | |||
| 159 | ### If you want to contribute: | ||
| 160 | 1. Read [Architecture Overview](../explanation/architecture.md) | ||
| 161 | 2. Check open issues on the repository | ||
| 162 | 3. Review [Design Decisions](../explanation/decisions.md) | ||
| 163 | |||
| 164 | ### If you want to deploy: | ||
| 165 | 1. Follow [Deployment How-To](../how-to/deploy.md) | ||
| 166 | 2. Review [Configuration Reference](../reference/configuration.md) | ||
| 167 | |||
| 168 | ### If you want to understand GRASP: | ||
| 169 | 1. Read [GRASP Protocol Reference](../reference/grasp-protocol.md) | ||
| 170 | 2. Review [Comparison with ngit-relay](../explanation/comparison.md) | ||
| 171 | |||
| 172 | ### If you want to run compliance tests: | ||
| 173 | 1. Follow [Running Your First Audit Tutorial](first-audit.md) | ||
| 174 | 2. Review [Compliance Testing How-To](../how-to/test-compliance.md) | ||
| 175 | |||
| 176 | --- | ||
| 177 | |||
| 178 | ## Troubleshooting | ||
| 179 | |||
| 180 | ### "nix develop" doesn't work | ||
| 181 | - You might need Nix with flakes enabled | ||
| 182 | - See [Nix Flakes How-To](../how-to/nix-flakes.md) | ||
| 183 | |||
| 184 | ### Build errors in grasp-audit | ||
| 185 | - Make sure you're in the `grasp-audit` directory | ||
| 186 | - Run `nix develop` first | ||
| 187 | - Check that you have network access (Cargo needs to download crates) | ||
| 188 | |||
| 189 | ### Tests fail | ||
| 190 | - Unit tests should always pass | ||
| 191 | - Integration tests (`--ignored`) require a relay on port 7000 | ||
| 192 | - Use `--test-threads=1` for integration tests | ||
| 193 | |||
| 194 | --- | ||
| 195 | |||
| 196 | ## Summary | ||
| 197 | |||
| 198 | You've successfully set up ngit-grasp and learned: | ||
| 199 | - How to use Nix flakes for development | ||
| 200 | - The project structure (main server + grasp-audit tool) | ||
| 201 | - How to build and test the code | ||
| 202 | - Where to find documentation | ||
| 203 | |||
| 204 | **Ready for more?** Try the [First Audit Tutorial](first-audit.md) next! | ||
| 205 | |||
| 206 | --- | ||
| 207 | |||
| 208 | *Part of the [ngit-grasp tutorials](./)* | ||
| 209 | *Next: [Running Your First Audit](first-audit.md)* | ||