Status page
Status page
Crouton ships a built-in status endpoint and frontend page that report version info, environment, database connectivity, and resource load health.
Backend β GET /crouton/status.json
Registered automatically by CroutonApiModule. Always returns HTTP 200; failures are communicated in the JSON body.
Response shape
interface CroutonStatus {
version: string; // APP_VERSION env var, or "unknown"
croutonVersion: string; // @ghentcdh/crouton-api package version
environment: string; // ENVIRONMENT ?? NODE_ENV ?? "unknown"
summary: {
ok: boolean; // true when no errors (warnings do not affect ok)
databaseErrors: number;
resourceErrors: number;
warningCount: number; // total warnings across all resources
};
databases: {
name: string;
connected: boolean;
error?: string; // connection strings are redacted
}[];
resources: {
name: string;
path: string;
valid: boolean;
error?: string;
version?: number; // loaded/expected schema version
expectedVersion?: number; // set when the file's version differs from what crouton expects
draft?: boolean; // present in the repo but intentionally not loaded/served
kind?: 'prisma' | 'custom'; // where the data comes from
customOperations?: string[]; // operations a custom resource's repository.ts implements
warnings?: string[]; // non-fatal issues detected at load time
}[];
}Custom resources
A custom resource is tagged kind: 'custom' and lists the operations its repository.ts implements. A resource whose repository is missing, broken, or does not cover an enabled operation is reported as invalid (valid: false) and skipped at boot, rather than failing silently on the first request.
Resource warnings
Non-fatal issues detected during load appear as warnings on the resource row. The resource is still served; warnings do not set valid: false or increment resourceErrors. Current sources:
| Warning | Cause |
|---|---|
"database" is set alongside kind: "custom" | database selects ctx.prisma; data still comes from repository.ts. Usually harmless, but the field is redundant. |
"upsert" enabled on a custom resource | Custom resources have no PUT handler for upsert β disable the operation or implement it. |
repository.ts present on a prisma resource | The file is ignored. Set kind: "custom" if you intended to use it. |
All operations disabled | The resource serves no endpoints. |
Database checks
Each registered data source is probed via its adapter's healthCheck(). The built-in PrismaDataSourceAdapter runs SELECT 1 with a 3-second timeout. Custom adapters that omit healthCheck are reported as connected without probing. Connection strings in error messages are automatically redacted.
Resource load errors
Since crouton 0.0.1-alpha.35, a malformed resource.json or data-source.json no longer crashes boot. The invalid file is skipped, the error is recorded, and the rest of the resources load normally. The status endpoint surfaces these errors in the resources array.
Each loaded resource reports its version. Two more states show up here:
- Needs migration β a
resource.jsonwhoseschemaVersiondiffers from what crouton expects. It carriesexpectedVersionand isvalid: false; the fix is to migrate it (automatic in dev). See Versioning & migrations. - Draft β a resource with
draft: trueis present but intentionally not served. It reportsdraft: trueandvalid: true, and does not count as a resource error. See Draft resources.
Frontend β /crouton/status
The StatusView is included in CroutonRouter by default, so any app using crouton gets it at the /crouton/status path (relative to wherever CroutonRouter is mounted).
The page shows:
- Backend connectivity β green "Running" / red "Down" based on whether the fetch succeeds
- Summary banner β "All systems operational", "Operational with N warning(s)", or "N issue(s) detected"
- Version badges β app version, crouton version, environment
- Databases list β green/red dot per data source, with error text on failure
- Resources list β a dot per resource (green loaded, amber when warnings exist, red failed, gray draft), a
v{version}badge, amber warning lines for non-fatal issues, an amber "needs migration" line for out-of-date files, and a "draft β not loaded" badge for drafts
Standalone route
If you prefer to mount it at a different path, import CroutonStatusRoutes instead:
import { CroutonStatusRoutes } from '@ghentcdh/crouton-vue';
const routes = [
// ...your routes
{
path: '/my-status',
children: CroutonStatusRoutes,
},
];