guts_node/
lib.rs

1//! # Guts Node
2//!
3//! Decentralized code collaboration node library.
4//!
5//! This crate provides the core functionality for running a Guts node,
6//! including HTTP API endpoints, P2P networking, and integration with
7//! storage, collaboration, and authentication subsystems.
8//!
9//! ## Architecture
10//!
11//! A Guts node consists of several integrated components:
12//!
13//! ```text
14//! ┌─────────────────────────────────────────────────────────────┐
15//! │                        Guts Node                            │
16//! ├─────────────────────────────────────────────────────────────┤
17//! │                                                             │
18//! │  ┌──────────────────────────────────────────────────────┐  │
19//! │  │                    HTTP API Layer                     │  │
20//! │  │  • Git Smart HTTP (clone, push, pull)                │  │
21//! │  │  • Repository Management (CRUD)                       │  │
22//! │  │  • Collaboration API (PRs, Issues, Reviews)           │  │
23//! │  │  • Auth API (Orgs, Teams, Permissions, Webhooks)      │  │
24//! │  │  • Web Gateway (HTML views)                           │  │
25//! │  └──────────────────────────────────────────────────────┘  │
26//! │                              │                              │
27//! │  ┌──────────────────────────────────────────────────────┐  │
28//! │  │                    P2P Network Layer                  │  │
29//! │  │  • Node Discovery and Connection                      │  │
30//! │  │  • Repository Replication                             │  │
31//! │  │  • Collaboration Data Sync                            │  │
32//! │  └──────────────────────────────────────────────────────┘  │
33//! │                              │                              │
34//! │  ┌──────────────────────────────────────────────────────┐  │
35//! │  │                    Storage Layer                      │  │
36//! │  │  • Git Object Store (blobs, trees, commits)           │  │
37//! │  │  • Reference Store (branches, tags)                   │  │
38//! │  │  • Collaboration Store (PRs, Issues)                  │  │
39//! │  │  • Auth Store (Orgs, Teams, Permissions)              │  │
40//! │  └──────────────────────────────────────────────────────┘  │
41//! │                                                             │
42//! └─────────────────────────────────────────────────────────────┘
43//! ```
44//!
45//! ## Quick Start
46//!
47//! To run a node:
48//!
49//! ```bash
50//! cargo run --bin guts-node -- --api-addr 127.0.0.1:8080
51//! ```
52//!
53//! ## Modules
54//!
55//! - [`api`] - Core HTTP API and Git Smart HTTP protocol
56//! - [`auth_api`] - Authorization endpoints (Organizations, Teams, Permissions)
57//! - [`collaboration_api`] - Collaboration endpoints (PRs, Issues, Comments)
58//! - [`realtime_api`] - Real-time WebSocket API for live updates
59//! - [`config`] - Node configuration management
60//! - [`p2p`] - Peer-to-peer networking and replication
61//! - [`observability`] - Structured logging, metrics, and request tracing
62//! - [`validation`] - Input validation middleware
63//! - [`health`] - Health check endpoints (liveness, readiness, startup)
64//! - [`resilience`] - Retry policies, circuit breakers, and timeouts
65//! - [`performance`] - Connection pooling, request coalescing, CDN cache headers
66//!
67//! ## Example: Creating an AppState
68//!
69//! ```rust,no_run
70//! use std::sync::Arc;
71//! use guts_storage::RepoStore;
72//! use guts_collaboration::CollaborationStore;
73//! use guts_auth::AuthStore;
74//! use guts_realtime::EventHub;
75//! use guts_ci::CiStore;
76//! use guts_compat::CompatStore;
77//! use guts_node::api::AppState;
78//!
79//! // Create stores
80//! let repos = Arc::new(RepoStore::new());
81//! let collaboration = Arc::new(CollaborationStore::new());
82//! let auth = Arc::new(AuthStore::new());
83//! let realtime = Arc::new(EventHub::new());
84//! let ci = Arc::new(CiStore::new());
85//! let compat = Arc::new(CompatStore::new());
86//!
87//! // Create application state
88//! let state = AppState {
89//!     repos,
90//!     p2p: None, // Optional P2P manager
91//!     consensus: None, // Optional consensus engine
92//!     mempool: None, // Optional transaction mempool
93//!     collaboration,
94//!     auth,
95//!     realtime,
96//!     ci,
97//!     compat,
98//! };
99//! ```
100
101pub mod api;
102pub mod auth_api;
103pub mod ci_api;
104pub mod collaboration_api;
105pub mod compat_api;
106pub mod config;
107pub mod consensus_api;
108pub mod consensus_app;
109pub mod consensus_simplex;
110pub mod health;
111pub mod observability;
112pub mod operator;
113pub mod p2p;
114pub mod performance;
115pub mod realtime_api;
116pub mod resilience;
117pub mod validation;