What Is the Server Entry Point for OpenSEO?

The server entry point for OpenSEO is src/server.ts, declared as the main field in wrangler.jsonc, which bootstraps the Cloudflare Worker’s request handling, OAuth flows, and workflow orchestration.

The OpenSEO application in the every-app/open-seo repository runs as a Cloudflare Worker, requiring a single, clearly defined entry point to initialize all server-side logic. According to the source code, src/server.ts serves as this entry point, implementing the core fetch handler and exporting workflow classes that manage background processing tasks.

Configuration-Driven Entry Point Definition

In Cloudflare Workers projects, the entry point is explicitly declared in the runtime configuration file. For OpenSEO, the wrangler.jsonc file specifies the server entry point on line 4:

{
  "name": "open-seo",
  "main": "src/server.ts"
}

This main field directs the Cloudflare Worker runtime to bootstrap the application from src/server.ts, making it the definitive server entry point for the project. This configuration ensures that all incoming requests to the Worker invoke the handlers defined in this specific file.

Core Server Implementation in src/server.ts

The src/server.ts file implements the Worker's primary fetch handler and initializes the application stack. It creates the request handler that routes traffic through OAuth providers, durable-object agents, and webhook endpoints before falling back to the TanStack React-Start application.

The Fetch Handler Function

The entry point exports a fetch function that conforms to the Cloudflare Workers signature, accepting the request, environment, and execution context:

// src/server.ts – entry point
import {
  createStartHandler,
  defaultStreamHandler,
} from "@tanstack/react-start/server";

const appFetch = createStartHandler(defaultStreamHandler);
const openSeoOAuthProvider = createOpenSeoOAuthProvider(appFetch);

export function fetch(
  request: Request,
  env: Env,
  ctx: ExecutionContext,
): Promise<Response> {
  // All request handling starts here
  return withPgClient(() => Promise.resolve(handleFetch(request, env, ctx)));
}

This handler wraps all request processing in withPgClient for database connectivity and delegates to handleFetch for routing logic, ensuring every HTTP request passes through this centralized entry point.

Exported Workflow and Durable Object Classes

Beyond request handling, src/server.ts exports workflow classes and durable-object classes used throughout the project. These exports include file paths such as:

These workflow classes are instantiated by the Cloudflare Workers runtime to perform background tasks like SEO audits and rank checking, with the entry point serving as the registration and export hub for these constructs.

Integration with the Application Stack

The server entry point integrates multiple architectural layers. It sets up durable-object agents for stateful processing and configures webhook endpoints for external integrations. When requests do not match API or OAuth routes, the entry point falls back to the TanStack React-Start application initialized in src/start.ts, enabling the full-stack React application to handle client-side routing.

This architecture ensures that src/server.ts functions as the central server entry point, managing both API infrastructure and frontend hydration within the single Cloudflare Worker environment.

Summary

  • The server entry point for OpenSEO is explicitly defined as src/server.ts in wrangler.jsonc via the main configuration field.
  • The fetch function in src/server.ts handles all incoming Worker requests with the signature (request: Request, env: Env, ctx: ExecutionContext).
  • The entry point exports workflow classes including SiteAuditWorkflow and RankCheckWorkflow for background task processing.
  • It initializes OAuth providers, durable-object agents, and webhook handling before falling back to the TanStack React-Start application.

Frequently Asked Questions

Where is the server entry point defined in the OpenSEO repository?

The server entry point is defined in wrangler.jsonc at line 4, where the "main": "src/server.ts" field declares the bootstrap file for the Cloudflare Worker runtime.

What is the primary function exported from src/server.ts?

The primary export is the fetch function, which implements the Cloudflare Worker request handler signature and routes all incoming HTTP traffic through OAuth handling, durable-object agents, and the React-Start application.

Which workflow classes are exported from the server entry point?

The entry point exports workflow classes defined in files like src/server/workflows/SiteAuditWorkflow.ts and src/server/workflows/RankCheckWorkflow.ts, which the Cloudflare Workers runtime uses to execute background SEO processing tasks.

How does the entry point integrate with the frontend application?

The entry point creates a TanStack React-Start handler using createStartHandler(defaultStreamHandler) and falls back to this handler for unmatched routes, allowing the React application to hydrate and handle client-side navigation within the same Worker instance.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →