CodeVetter · Repo Unpack · Behavior traces
QwikDev/qwik
Four concrete flows were followed across their owning files: a server-rendered page and resumed event, a route action, project scaffolding, and Insights ingestion. These traces describe source control flow rather than observed runtime executions. They expose explicit synchronization points: SSR flushes, streamed-container readiness, action submission serialization, and database writes after response creation.
- Page request, step 1: createQwikRouter.router computes the origin, combines body limits, calls fromNodeHttp, and passes the resulting event to requestHandler.
- Page request, step 2: requestHandler obtains getRouterConfig, loads routes through loadRequestHandlers/loadRoute, resolves middleware, and calls runQwikRouter.
- Page request, step 3: runQwikRouter creates RequestEvent and drives runNext; page middleware runs actions/loaders before renderQwikMiddleware supplies serverData and a stream to the application's render function.packages/qwik-router/src/middleware/request-handler/user-response.ts#L29-54packages/qwik-router/src/middleware/request-handler/user-response.ts#L85-103packages/qwik-router/src/middleware/request-handler/resolve-request-handlers-core.ts#L131-138packages/qwik-router/src/middleware/request-handler/resolve-request-handlers-core.ts#L795-809
- SSR step: renderToStream resolves manifest/base, creates StreamHandler and SSRContainer, calls setServerPlatform and container.render, awaits the render promise, then flushes.
- Resumed click step: qwikloader dispatch reads q-e:click, locates the container, waits for its ready marker when streaming, resolves/imports the handler, and invokes it with captured IDs.
- QRL invocation step: _run obtains DomContainer, waits for container data, creates invocation context, deserializes capture deltas, and calls runEventHandlerQRL; that function inflates the host element and invokes through retryOnPromise.
- Action flow: routeActionQrl.submit queues behind pendingDispatch and updates currentAction; the router task calls submitAction, actionHandler parses/validates/calls the QRL, and the client receives result plus invalidation hashes.
- Scaffold flow: create-qwik.mjs calls runCli; arguments choose runCreateCli, which builds a template manager, validates the target-directory policy, and invokes createApp.
- Scaffold write/install flow: createApp calls createFromStarter, updateApp merges integration files, commit creates directories and writes files, and installDeps delegates to runCommand using execa.
- Insights persistence flow: plugin@db initializes the libSQL client; onPost parses and validates telemetry, sends an OK response, then resolves manifest/application records and awaits updateEdge/updateRoutes counter updates or inserts.