Skip to content

03 / The Local Upgrade

Turn website findings into a useful plan.

Business intake, website analysis, structured recommendations and report review in a full stack application.

Live website

My role

Founder, application architecture, engineering and user experience

Technology

TypeScriptNext.jsReactSupabaseOpenAI Responses APIZodPlaywright

The problem

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.

How I approached it

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.

Decisions that matter.

01

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.

02

Separate observations from interpretation

Website checks identify concrete signals such as headings, metadata and contact paths. Model analysis works from the supplied findings and business context.

03

Make external reads deliberate

URL validation and DNS checks restrict the scanner to public destinations. Requests have a timeout, and redirects are handled explicitly.

The implementation

lib/ai-readiness-report/openai-contract.ts

Accept a report only after parsing and validationTypeScript
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.

What I check

  • Report output must satisfy the schema.
  • Website reads validate the destination and use a timeout.
  • Report workflows distinguish admin and client access.
  • Browser checks exercise public routes and form validation.

The result

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.