Anatomy of an app

A Cloudrizz app is a static frontend plus a file-based backend that runs on the edge. There's no build step and no framework requirement — plain HTML, CSS, and JavaScript on the front, one .js file per API route on the back. This is the shape an assistant generates and edits.

Project layout

A freshly scaffolded app looks like this:

index.html              # frontend entry, served at /
app.js                  # frontend JavaScript
style.css               # styles
api/
  hello.js              # an API route -> GET/POST /api/hello
cloudrizz.seo.json      # SEO + AI discoverability config
migrations/             # *.sql schema migrations (add as needed)

The frontend is served as static assets. Anything under api/ is a backend route. Add files to grow the app — there's nothing to register.

Frontend

Plain static files at the project root. index.html is served at /; reference your scripts and styles normally:

<link rel="stylesheet" href="/style.css" />
<script src="/app.js"></script>

The frontend talks to the backend with a normal fetch:

const res = await fetch("/api/hello");
const data = await res.json();

Extension-less paths fall back to HTML, so client-side routing works. Large files (over 20 MB) are served from storage rather than the asset bundle automatically.

Backend routes (api/*.js)

Each file under api/ maps to a route by its path: api/hello.js/api/hello, api/orders/list.js /api/orders/list. A route file default-exports an object with a fetch method:

// api/hello.js
export default {
  async fetch(request, env, ctx) {
    return Response.json({
      message: "Hello from your Cloudrizz API route!",
      app: env.APP_ID,
      environment: env.ENVIRONMENT,
    });
  },
};

The fetch(request, env, ctx) signature is the standard Cloudflare Worker handler shape. env carries the platform bindings — env.DB, env.STORAGE, env.EMAIL, env.AI, env.AUTH, env.PAYMENTS — plus env.APP_ID, env.ENVIRONMENT, and any environment variables you set.

Database schema (migrations/)

Your app's database schema lives in migrations/*.sql. See Database for how migrations are applied and the reserved _cr_* table namespace.

Special files

Two filenames under api/ are not HTTP routes — they're registries Cloudrizz wires up for you:

The cloudrizz.seo.json file controls meta tags, sitemap, robots, and llms.txt for your app — see SEO & AI discoverability.