| Crates.io | systemprompt-api |
| lib.rs | systemprompt-api |
| version | 0.0.11 |
| created_at | 2026-01-21 21:07:44.886692+00 |
| updated_at | 2026-01-25 21:43:44.983446+00 |
| description | HTTP API server and gateway for systemprompt.io OS |
| homepage | https://systemprompt.io |
| repository | https://github.com/systempromptio/systemprompt-core |
| max_upload_size | |
| id | 2060136 |
| size | 624,411 |
HTTP API gateway for systemprompt.io OS.
This crate serves as the entry point for all HTTP requests to systemprompt.io OS. It provides:
The API crate follows the Entry layer pattern:
src/
├── lib.rs # Crate exports
├── models/
│ └── mod.rs # ServerConfig
├── routes/
│ ├── mod.rs # Route exports
│ ├── wellknown.rs # /.well-known/* endpoints
│ ├── admin/
│ │ ├── mod.rs # Admin route exports
│ │ └── cli.rs # CLI gateway endpoint
│ ├── analytics/
│ │ ├── mod.rs # Analytics route exports
│ │ ├── events.rs # Event tracking endpoints
│ │ └── stream.rs # SSE analytics stream
│ ├── engagement/
│ │ ├── mod.rs # Engagement route exports
│ │ └── handlers.rs # Engagement tracking handlers
│ ├── proxy/
│ │ ├── mod.rs # Proxy route exports
│ │ ├── agents.rs # A2A agent proxy routes
│ │ └── mcp.rs # MCP server proxy routes
│ ├── stream/
│ │ ├── mod.rs # SSE stream exports
│ │ └── contexts.rs # Context state streaming
│ └── sync/
│ ├── mod.rs # Sync route exports
│ ├── types.rs # Request/response types
│ ├── auth.rs # Sync authentication
│ └── files.rs # File sync endpoints
└── services/
├── mod.rs # Service exports
├── health/
│ ├── mod.rs # Health service exports
│ ├── checker.rs # HTTP health checker
│ └── monitor.rs # Process health monitor
├── middleware/
│ ├── mod.rs # Middleware exports
│ ├── analytics/
│ │ ├── mod.rs # Analytics middleware
│ │ ├── detection.rs # Bot/scanner detection
│ │ └── events.rs # Event emission
│ ├── auth.rs # Route-level authentication
│ ├── bot_detector.rs # Bot identification
│ ├── context/
│ │ ├── mod.rs # Context middleware exports
│ │ ├── middleware.rs # Context extraction middleware
│ │ ├── requirements.rs # Context requirement levels
│ │ ├── extractors/
│ │ │ ├── mod.rs # Extractor exports
│ │ │ ├── traits.rs # ContextExtractor trait
│ │ │ ├── a2a_extractor.rs # A2A protocol extractor
│ │ │ └── header_extractor.rs # Header-based extractor
│ │ └── sources/
│ │ ├── mod.rs # Source exports
│ │ ├── headers.rs # Header source
│ │ └── payload.rs # Payload source
│ ├── cors.rs # CORS configuration
│ ├── ip_ban.rs # IP ban middleware
│ ├── jwt/
│ │ ├── mod.rs # JWT middleware exports
│ │ ├── context.rs # JWT context extraction
│ │ └── token.rs # Token validation
│ ├── rate_limit.rs # Rate limiting
│ ├── session.rs # Session management
│ ├── throttle.rs # Request throttling
│ ├── trace.rs # Trace header injection
│ └── trailing_slash.rs # Path normalization
├── proxy/
│ ├── mod.rs # Proxy service exports
│ ├── auth.rs # Proxy authentication
│ ├── backend.rs # Request/response transform
│ ├── client.rs # HTTP client pool
│ ├── engine.rs # ProxyEngine core
│ └── resolver.rs # Service endpoint resolution
├── server/
│ ├── mod.rs # Server exports
│ ├── builder.rs # ApiServer construction
│ ├── readiness.rs # Readiness probe state
│ ├── routes.rs # Route tree configuration
│ ├── runner.rs # Server entry point
│ └── lifecycle/
│ ├── mod.rs # Lifecycle exports
│ ├── agents.rs # Agent reconciliation
│ ├── reconciliation.rs # Service startup coordination
│ └── scheduler.rs # Bootstrap job execution
└── static_content/
├── mod.rs # Static content exports
├── config.rs # StaticContentMatcher
├── fallback.rs # 404 and SPA routing
├── homepage.rs # Homepage serving
├── session.rs # Static route sessions
└── vite.rs # Vite asset serving
| Module | Description |
|---|---|
admin |
Administrative endpoints for CLI gateway and system management |
analytics |
Event tracking and real-time analytics streaming |
engagement |
User engagement metrics collection |
proxy |
Request forwarding to MCP servers and A2A agents |
stream |
Server-Sent Events for real-time context updates |
sync |
Database synchronization for offline-first clients |
wellknown |
Standard discovery endpoints (agent cards, OAuth metadata) |
| Module | Description |
|---|---|
health |
Process monitoring and HTTP health checks |
middleware |
Request processing pipeline (auth, rate limiting, analytics) |
proxy |
HTTP client pooling and request transformation |
server |
Server lifecycle, route mounting, and startup coordination |
static_content |
SPA serving, content matching, and session handling |
systemprompt-runtime - Application context and configurationsystemprompt-oauth - Authentication and session managementsystemprompt-agent - Agent registry and orchestrationsystemprompt-mcp - MCP server registry and proxysystemprompt-content - Content repository and servingsystemprompt-analytics - Session and event trackingsystemprompt-scheduler - Background job executionsystemprompt-database - Connection poolingsystemprompt-models - Shared types and configurationsystemprompt-identifiers - Type-safe ID wrapperssystemprompt-security - Token extraction and validationsystemprompt-users - User services and IP banningsystemprompt-events - Event broadcastingsystemprompt-logging - Structured loggingsystemprompt-traits - Shared traits and interfacessystemprompt-files - File system configurationsystemprompt-extension - Extension loadingaxum - HTTP frameworktokio - Async runtimetower - Middleware utilitiesreqwest - HTTP clientjsonwebtoken - JWT handlinggovernor - Rate limitinguse systemprompt_api::services::server::{run_server, setup_api_server};
use systemprompt_runtime::AppContext;
// Initialize and run
let ctx = AppContext::new().await?;
run_server(ctx, None).await?;
The API server is configured through systemprompt-runtime::Config:
api_external_url - Public URL for the APIrate_limits - Per-endpoint rate limit configurationjwt_secret - JWT signing secretcors - CORS allowed originsservices/server/routes.rsservices/server/builder.rs)WEB_DIRAdd to your Cargo.toml:
[dependencies]
systemprompt-api = "0.0.1"
FSL-1.1-ALv2 - See LICENSE for details.