This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Read ./CONVENTIONS.md file.
Read SECURITY.md before changing security-sensitive HTTP routes,
session authorization, private messages, credential-bearing responses, or
user-controlled media. Before driving Rostra through a browser, also use the
preview-rostra skill.
This project uses the Linked Specs convention; consult the linked-specs
skill before working with specs or governed code.
For web UI functionality/security tradeoffs, also read
REQ-ui-functionality-security.
Rostra is a p2p (friend-to-friend) social network built in Rust. It uses a lightweight event DAG system where all data is propagated as signed Events, enabling decentralized social networking with sovereign identities and multi-device support.
- Core principle: All data propagates as cryptographically signed
Events forming a DAG structure - Network layer: Uses Pkarr for distributed identity/naming and iroh-net for p2p transport
- UI: Web-based interface using Axum, Maud, Alpine, and alpine-ajax
- Storage: Local database for tracking events and content
crates/rostra-core- Core domain types used across the projectcrates/rostra-client-db- Database for tracking all eventscrates/rostra-web-ui- Default web-based UI (Axum + Maud + Alpine/alpine-ajax)crates/rostra-client- Client implementation (includes shared RPC utilities inutil::rpc)crates/rostra-p2p- P2P networking layercrates/rostra-p2p-api- P2P API definitionscrates/rostra-util-*- Various utility cratescrates/bots/- Bot implementations
# Build the project
cargo build
# or: just build
# Run tests
cargo nextest run
# or: just test
# Check code (faster than build)
cargo check
# or: just check# Run all pre-PR checks (lint + clippy + test)
just final-check
# Format code
just format # runs cargo fmt + nixfmt
# Run lints (pre-commit hook)
just lint
# Run clippy
just clippy
# Fix clippy issues
just clippy-fix# Run web UI in production mode
cargo run --release web-ui
# Development mode with hot reload on port 2345
just dev
# Development on custom port
just dev 3000# Test specific crate
cargo test -p rostra-core
# Test with logging
RUST_LOG=debug cargo test
# Run specific test
cargo test test_nameThe web UI (crates/rostra-web-ui) uses:
- Axum for the web server framework
- Maud for HTML templating
- Alpine + alpine-ajax for progressive enhancement
- Tower middleware for sessions, cookies, compression
- Server-rendered HTML as the primary interaction architecture
Key web UI files:
src/routes/- Route handlers for different pagessrc/lib.rs- Main application setup- Routes include: timeline, post, profile, avatar, etc.
- Uses Rust 2024 edition
- Workspace-based multi-crate structure
- Structured logging with
tracing - No inline
mods - use standalone modules - Supports multi-device sync through event DAG merging
- Follow
DESIGN-server-rendered-hypermedia: changed workflows must work through ordinary HTTP without JavaScript. Alpine is progressive enhancement;/unlockCreate Account is the documented browser-local exception that fills the login form without submitting. - Apply
REQ-ui-functionality-security: the no-JavaScript baseline is not a ban on required first-party browser conveniences, and implementation mechanisms do not become stakeholder mandates. - For keyboard shortcuts that trigger
requestSubmit(), always usekeyup(notkeydown).keydownfires repeatedly with key auto-repeat, which can cause duplicate form submissions and race conditions in alpine-ajax. - Keep authenticated Settings recovery export server-rendered, session-scoped,
unavailable to read-only sessions, and protected by the sensitive response
headers in
routes/recovery.rs. Its recovery phrase uses a masked read-only field and a conventional copy control; do not add reveal dialogs or confirmation steps. /unlockCreate Account may expose a generated credential only in a secure response with those sensitive headers. It fills editable login fields without submitting or navigating.