chore: initial foundation — server skeleton, autodocs, CI

- minimal Axum server exposing GET /health
- OpenAPI contract generated from handlers (gen_openapi -> openapi.json),
  drift-gated in CI so the spec can never silently diverge from the code
- CI: secret-scan + gitleaks, openapi drift gate, fmt/clippy/build/test/doc-test, cargo-deny
- Cargo.lock tracked for reproducible builds; publish=false; pinned toolchain
- README, SECURITY.md, deny.toml, .env.example
This commit is contained in:
jwinterm
2026-06-22 06:18:57 -04:00
commit 143f00701b
17 changed files with 4958 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
//! Health / liveness endpoint.
use axum::Json;
use serde::Serialize;
/// Liveness response.
#[derive(Serialize, utoipa::ToSchema)]
pub struct HealthResponse {
/// Always `"ok"` when the service is reachable.
pub status: String,
}
/// Liveness probe.
///
/// Returns `200` with `{ "status": "ok" }` whenever the server is up. Used by
/// load balancers and uptime checks; requires no authentication.
#[utoipa::path(
get,
path = "/health",
responses((status = 200, description = "Service is up", body = HealthResponse)),
tag = "system"
)]
pub async fn health() -> Json<HealthResponse> {
Json(HealthResponse {
status: "ok".to_string(),
})
}
+4
View File
@@ -0,0 +1,4 @@
//! HTTP API layer: handlers and the OpenAPI assembly.
pub mod health;
pub mod openapi;
+21
View File
@@ -0,0 +1,21 @@
//! OpenAPI specification assembly.
//!
//! `ApiDoc` aggregates the annotated handlers into the spec that is the single
//! source of truth for the API contract and the wallet's generated TypeScript
//! client. Add a path here once its handler carries `#[utoipa::path(...)]` and
//! its request/response types derive `utoipa::ToSchema`.
use utoipa::OpenApi;
#[derive(OpenApi)]
#[openapi(
info(
title = "smirk-backend-core",
version = "0.3.0",
description = "Open, self-hostable backend for the Smirk non-custodial multi-chain wallet."
),
paths(crate::api::health::health),
components(schemas(crate::api::health::HealthResponse)),
tags((name = "system", description = "Service health and metadata."))
)]
pub struct ApiDoc;