Give the model a contract
The response must fit a defined schema, including findings, priorities and supporting evidence. Zod validates the parsed output before the application accepts it.
03 / The Local Upgrade
Business intake, website analysis, structured recommendations and report review in a full stack application.
Live websiteFounder, application architecture, engineering and user experience
A business owner can see that a website needs work without knowing which change matters first. I wanted an assessment that connects visible website evidence to a practical next step.
The application combines business intake, deterministic website checks and structured model analysis. A defined report contract organizes the result, while review and client access give the report a place in a complete delivery workflow.
Follow the workflow. Select a stage to see its purpose.
Intake. Collect the website, business context and the owner’s priorities.
The response must fit a defined schema, including findings, priorities and supporting evidence. Zod validates the parsed output before the application accepts it.
Website checks identify concrete signals such as headings, metadata and contact paths. Model analysis works from the supplied findings and business context.
URL validation and DNS checks restrict the scanner to public destinations. Requests have a timeout, and redirects are handled explicitly.
lib/ai-readiness-report/openai-contract.ts
const outputText = extractOutputText(await response.json());
let outputJson: unknown;
try {
outputJson = JSON.parse(outputText);
} catch {
return {
data: null,
status: 'ai_analysis_failed',
model,
failureKind: 'schema_validation',
error: 'OpenAI returned non-JSON output. Continue with human review.',
};
}
const parsed = ReportAnalysisSchema.safeParse(outputJson);
if (!parsed.success) {
return {
data: null,
status: 'ai_analysis_failed',
model,
failureKind: 'schema_validation',
error: 'OpenAI output did not match the report analysis schema. Continue with human review.',
};
}
return { data: parsed.data, status: 'ready', model };From the report generation path. Non-JSON output and a schema mismatch return a failed analysis with no report data; only the validated result becomes ready.
The platform connects public intake and assessment experiences with report creation, persistence and review. The work spans the interface, API routes, validation, data access and the final document.