Expand description
REST API server for centralized baseline management.
This crate provides a REST API server for storing and managing performance baselines. It supports multiple storage backends (in-memory, SQLite, PostgreSQL) and includes authentication via API keys.
Part of the perfgate workspace.
§Features
- Multi-tenancy: Projects/namespaces for isolation
- Version history: Track baseline versions over time
- Rich metadata: Git refs, tags, custom metadata
- Access control: Role-based permissions (Viewer, Contributor, Promoter, Admin)
- Multiple backends: In-memory, SQLite, PostgreSQL (planned)
§Quick Start
use perfgate_server::{ServerConfig, StorageBackend, run_server};
#[tokio::main]
async fn main() {
let config = ServerConfig::new()
.bind("0.0.0.0:8080").unwrap()
.storage_backend(StorageBackend::Sqlite)
.sqlite_path("perfgate.db");
run_server(config).await.unwrap();
}§API Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /projects/{project}/baselines | Upload a baseline |
| GET | /projects/{project}/baselines/{benchmark}/latest | Get latest baseline |
| GET | /projects/{project}/baselines/{benchmark}/versions/{version} | Get specific version |
| GET | /projects/{project}/baselines | List baselines |
| DELETE | /projects/{project}/baselines/{benchmark}/versions/{version} | Delete baseline |
| POST | /projects/{project}/baselines/{benchmark}/promote | Promote version |
| GET | /audit | List audit events (admin only) |
| GET | /health | Health check |
| GET | /metrics | Prometheus metrics |
Re-exports§
pub use auth::ApiKeyStore;pub use auth::AuthContext;pub use auth::AuthState;pub use auth::JwtConfig;pub use error::ConfigError;pub use error::StoreError;pub use oidc::OidcConfig;pub use oidc::OidcProvider;pub use oidc::OidcProviderType;pub use oidc::OidcRegistry;pub use server::AppState;pub use server::PostgresPoolConfig;pub use server::ServerConfig;pub use server::StorageBackend;pub use server::run_server;pub use storage::AuditStore;pub use storage::BaselineStore;pub use storage::FleetStore;pub use storage::InMemoryFleetStore;pub use storage::InMemoryKeyStore;pub use storage::InMemoryStore;pub use storage::KeyRecord;pub use storage::KeyStore;pub use storage::SqliteKeyStore;pub use storage::SqliteStore;pub use storage::StorageHealth;pub use models::*;
Modules§
- auth
- Authentication and authorization middleware.
- cleanup
- Background artifact cleanup for retention policy enforcement.
- error
- Error types for the perfgate server.
- handlers
- Re-export all handlers for use in the server.
- metrics
- Prometheus metrics middleware and endpoint.
- models
- Data models for the perfgate baseline service.
- oidc
- OIDC authentication support for perfgate-server.
- server
- Server configuration and bootstrap.
- storage
- Storage trait and implementations for baseline persistence.
Structs§
Enums§
Constants§
- VERSION
- Server version string.