Relpin preview needs to know when a FastAPI app imported successfully and is serving the current preview revision.
Add the middleware
from fastapi import FastAPI
from relpin_sdk import RelpinReadinessMiddleware
app = FastAPI()
app.add_middleware(RelpinReadinessMiddleware)
The middleware owns the internal /__relpin/* namespace. It responds to /__relpin/ready and returns 404 for other internal paths.
Signal shape
The readiness response includes:
{
"ready": true,
"phase": "ready",
"diagnostics": []
}
The sidecar is still the final preview authority. The middleware supplies the app-level signal it polls.
Fail closed
If the app did not import or the served preview revision is missing, readiness should stay false. Do not make readiness return true just to hide an import or build problem.