Skip to content

feat(cli): update scaffold template with server entry #91

@qantrepreneur

Description

@qantrepreneur

What to build

Update the templates/default/ scaffolding template (used by npm create @sundayceo) to include a server entry file and Cloudflare Workers configuration as the default deployment target.

New files to add to templates/default/

src/server.ts — server entry composing the request handler with the Cloudflare adapter:

import { cloudflare } from "@sundayceo/framework/cloudflare";

import { app } from "./app";
import { routes, templates } from "./routes.gen";

export default cloudflare({
  app,
  getRoutes: () => routes,
  loadRouteModule: (route) => route.load(),
  loadTemplate: (id) => templates[id]().then((m) => m.default),
});

wrangler.jsonc — basic Wrangler configuration pointing at the built server entry.

Files to update

  • templates/default/package.json: Update the build script to vite build --ssr src/server.ts. Add wrangler as a devDependency. Add deploy script.
  • templates/default/src/app.ts: Add the Register declaration alongside createApp.
  • packages/cli/src/scaffold.ts: Add .jsonc to text extensions for placeholder replacement.

Acceptance criteria

  • Scaffolded project includes src/server.ts with Cloudflare adapter
  • Scaffolded project includes wrangler.jsonc with basic config
  • package.json has correct build script for SSR
  • src/app.ts includes the Register module augmentation
  • Scaffolded project runs with pnpm dev (Vite dev server)
  • Scaffolded project deploys with wrangler deploy after build

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentTriaged and ready for implementation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions