upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/tutorials/getting-started.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorials/getting-started.md')
-rw-r--r--docs/tutorials/getting-started.md209
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
11By 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
21First, get the source code:
22
23```bash
24git clone https://gitworkshop.dev/ngit-grasp
25cd 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
34ngit-grasp uses Nix flakes for reproducible development environments.
35
36```bash
37# Enter the development environment
38nix 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
54Take a look around:
55
56```bash
57# View the project structure
58ls -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
75The compliance testing tool is the first working component. Let's try it:
76
77```bash
78# Navigate to grasp-audit
79cd grasp-audit
80
81# Enter its development environment
82nix develop
83
84# Build the project
85cargo build
86
87# Run unit tests
88cargo 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
100If you want to try the audit tool against a real relay:
101
102```bash
103# In a separate terminal, start a test relay:
104docker run --rm -p 7000:7000 scsibug/nostr-rs-relay
105
106# Back in grasp-audit directory:
107cargo 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
118Let's look at a simple example:
119
120```bash
121# From grasp-audit directory
122cat examples/simple_audit.rs
123```
124
125This shows how to use the `grasp-audit` library to check GRASP compliance.
126
127---
128
129## Step 7: Read the Documentation
130
131Now that you have a working setup, explore the documentation:
132
133```bash
134# From project root
135cd ..
136ls docs/
137```
138
139**Recommended reading order:**
1401. [Architecture Overview](../explanation/architecture.md) - Understand the design
1412. [Inline Authorization](../explanation/inline-authorization.md) - Key decision
1423. [Git Protocol Reference](../reference/git-protocol.md) - Technical details
143
144---
145
146## What You've Accomplished
147
148Congratulations! 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:
1601. Read [Architecture Overview](../explanation/architecture.md)
1612. Check open issues on the repository
1623. Review [Design Decisions](../explanation/decisions.md)
163
164### If you want to deploy:
1651. Follow [Deployment How-To](../how-to/deploy.md)
1662. Review [Configuration Reference](../reference/configuration.md)
167
168### If you want to understand GRASP:
1691. Read [GRASP Protocol Reference](../reference/grasp-protocol.md)
1702. Review [Comparison with ngit-relay](../explanation/comparison.md)
171
172### If you want to run compliance tests:
1731. Follow [Running Your First Audit Tutorial](first-audit.md)
1742. 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
198You'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)*