Skip to content

04. Deploy Frontend Pages

With the backend in place, the next step is getting the frontend online.

Create the frontend Pages projects before the first real frontend deployment.

Keep the names aligned with the repository defaults.

This avoids confusion in environment variables, docs, and deployment scripts.

The public site is usually the first frontend app you want online.

Deploy it from the apps/web directory and keep the first deployment simple.

Why this command is usually written this way

Section titled “Why this command is usually written this way”

The frontend deployment command is normally scoped to the app directory so that:

  • build output is correct
  • project-specific config is used
  • the Pages deployment matches the intended app

Do not try to collapse everything into one custom command before the default deployment works.

Section titled “Environment variables recommended for apps/web”

On the first pass, make sure apps/web at least points to:

  • the correct backend service URLs
  • the expected app_key
  • any required public environment values used by login or site configuration

Start with the repository defaults if needed, verify the whole system works, then customize.

After web, deploy apps/admin.

The admin is required for initialization and ongoing management, so it should be online immediately after the public site.

apps/admin usually needs fewer extra variables on day one

Section titled “apps/admin usually needs fewer extra variables on day one”

For the first pass, apps/admin often works with fewer additional environment variables than web.

Still, you should verify:

  • auth-related URLs
  • service endpoints
  • any admin-specific public config

You may see a warning about an invalid SESSION binding during build or deployment.

That warning usually means the expected Cloudflare KV binding has not been configured yet in the target environment.

Do not ignore it blindly.

Check:

  • the Wrangler binding configuration
  • the Cloudflare Pages or Worker environment bindings
  • whether the target environment matches the one you prepared earlier

5. Checklist before you leave this chapter

Section titled “5. Checklist before you leave this chapter”

Before moving on, confirm:

  • both Pages projects exist
  • apps/web has been deployed successfully
  • apps/admin has been deployed successfully
  • critical frontend environment variables are filled
  • the SESSION warning is understood and resolved if it was real

Once those are done, you can move on to domains and production URLs.