How digiator42/gritshield works
GritShield is an async-first Rust web framework. Its main workflow is an application defining routes and handlers, the router dispatching incoming HTTP requests through middleware to handlers, and handlers returning HTTP responses. The framework also provides persistence, security, dependency injection, admin and OpenAPI tooling, and an MCP server. The graph includes documented capabilities whose implementation was not sampled; their internal wiring is left out where evidence is unavailable.
Main entry points: router.rs Router and dispatch · auth.rs Request middleware · engine.rs MCP protocol engine · handler.rs Route handlers
Components 21
HTTP Runtime
- HTTP server
src/http/server.rs - Router and dispatch
src/routing/engine/router.rs - Request parsing
src/http/request.rs - Route handlers
src/routing/engine/handler.rs - HTTP responses
src/http/response.rs
Security
- Request middleware
src/middleware/auth.rs - Sessions and JWT
src/security/session.rs - XSS sanitizer
src/security/xss.rs - RBAC and rate limits
src/security
Data and Admin
- Database connection
src/database/db.rs - Repositories and JQL
src/database/repository - Admin panel
src/gritadmin/dashboard - Admin authentication
src/gritadmin/auth/handlers.rs
Framework Services
- DI, events, jobs
src/core - Templates and WebSockets
src/routing/templates.rs
Developer Integrations
- Compile-time macros
src/gritshield_macros/src - OpenAPI and Swagger
src/core/swagger/spec.rs - MCP protocol engine
src/mcp/engine.rs - MCP transports
src/mcp/transport.rs
Other components
- Application developer
- Browser client
Connections 21
- Browser client → HTTP server: sends HTTP
- HTTP server → Router and dispatch: serves routes
- Router and dispatch → Request middleware: runs middleware
src/routing/engine/router.rs - Router and dispatch → DI, events, jobs: initializes services
src/routing/engine/router.rs - Request parsing → XSS sanitizer: uses sanitizer
src/http/request.rs - Route handlers → HTTP responses: converts results
src/routing/engine/handler.rs - Route handlers → XSS sanitizer: trusts safe output
src/routing/engine/handler.rs - Request middleware → Sessions and JWT: checks sessions and JWT
src/middleware/auth.rs - Request middleware → Request parsing: parses CSRF form
src/middleware/auth.rs - Admin authentication → Sessions and JWT: uses sessions
src/gritadmin/auth/handlers.rs - Admin panel → Repositories and JQL: searches records
src/gritadmin/dashboard/handlers/search.rs - Repositories and JQL → Database connection: queries database
- Application developer → Compile-time macros: declares routes
- Router and dispatch → OpenAPI and Swagger: registers documentation routes
- Router and dispatch → MCP protocol engine: registers MCP routes
- MCP protocol engine → MCP transports: serves via transports
- Application developer → Admin panel: annotates repositories
- Application developer → OpenAPI and Swagger: documents schemas
- Application developer → MCP protocol engine: declares tools and resources
- Router and dispatch → Templates and WebSockets: serves templates and WebSockets
- Router and dispatch → RBAC and rate limits: enforces access controls
src/routing/engine/router.rs