Link the two submodules
# Build the qwik monorepo submodule and link it globally for use in our projects
cd ./qwik
pnpm install && pnpm api.update && pnpm build && pnpm link.dist
cd ../qwik-city-e2e
pnpm install && pnpm link --global @builder.io/qwik @builder.io/qwik-city
# Builds qwik project and generates wasm with js-compute and inlined static assets
pnpm build.fastly
# Runs built artifacts locally
pnpm serve.fastly
# Creates or deploys the project to fastly
pnpm deploy.fastly
The architecture follows this guide and consists of three components:
- The Vite config. Responsible for generating a server entrypoint for the Fastly platform.
- The platform middleware. Responsible for handling the Fastly platform
FetchEvent
on each request and mapping qwik-city features to the platform. This includes:- PublishServer to serve static assets from inline WASM or Compute@Edge KV Store
- SimpleCache for response caching
FetchEvent.waitUntil()
for work needed before the runtime is shutdown.- Qwik City's internal request handling to generate an SSR'd response
- The starter template. Responsible for merging template files and settings with an existing qwik-city project.
- This template includes the
@fastly/compute-js-static-publish
along with a defaultstatic-publish.rc.js
config. This is responsible for building mappings of static assets and including them inline to the WASM binary or uploading them to the KV Store. Astatics.js
gets generated during this process, which yields agetServer()
factory for creating aPublisherServer
that gets passed into the middleware at runtime. - This template also includes the
@fastly/js-compute
library which contains thejs-compute-runtime
command. This command is responsible for building thebin/main.wasm
executable and packing this up into a Fastly deployablepkg/[fastly service name].tar.gz
tarball.
- This template includes the