Runtime

Project structure

Which files Inhaus looks for, and what it does with them.

my-app/
├── index.html              Static site entry (or in public/, dist/, static/)
├── src/
│   └── main.tsx            Bundled for the browser when index.html points at it
├── worker.ts               Server code: export default { fetch }
├── migrations/             SQL run on deploy, in name order (or db/migrations/)
│   └── 0001_init.sql
├── package.json            npm packages, installed with install scripts off
└── README.md               Not special: send it as `readme` in deploy_app

Static entry

The first index.html found in: the root, public/, dist/, static/. Every other file in that folder is served as is.

Server entry

The entry passed to deploy_app, or the first of:

_worker.js, worker.ts, worker.js, worker.mjs, server.ts, server.js, src/worker.ts, src/worker.js, src/server.ts, src/server.js, api/index.ts, api/index.js

It must export default { fetch(request, env, ctx) }.

If there is neither, the build fails with: Nothing to run: add an index.html (a static site) or a worker.js/worker.ts that does export default { fetch } (an app with a server).

Bundling

  • TypeScript, JSX and ES modules are bundled with esbuild.
  • React is detected and uses the automatic JSX runtime.
  • process.env.NODE_ENV is "production".
  • Small images and fonts imported from code are inlined.
  • Imports cannot reach outside the app's own files.

Packages

Dependencies from package.json are installed with install scripts turned off. Lockfiles are used when present. Packages are checked for known vulnerabilities by the scan.

Migrations

migrations/*.sql or db/migrations/*.sql. Not bundled into the app. Each file runs once, in name order, the first time a deploy includes it. See Database.