> For the complete documentation index, see [llms.txt](https://faction-os.gitbook.io/faction-os-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/phases/phase_16/session_04_cloudflare_pages_deployment_path.md).

# Session 04: Cloudflare Pages Deployment Path

**Session ID**: `phase16-session04-cloudflare-pages-deployment-path` **Package**: public-website **Status**: Complete **Estimated Tasks**: \~16-22 **Estimated Duration**: 2-4 hours

***

## Objective

Configure and validate the static Cloudflare Pages deployment path for `https://faction-os.com/` without adding server rendering or coupling the site to the demo artifact.

***

## Scope

### In Scope (MVP)

* Document Cloudflare Pages project settings:
  * Root directory: `public-website`.
  * Build command: `npm run build`.
  * Build output directory: `dist`.
  * Production domain: `https://faction-os.com/`.
* Add or update CI/workflow configuration if the repo has a suitable Pages workflow pattern.
* Validate static build output in `public-website/dist`.
* Prepare the recommended `wrangler pages deploy` command.
* Ensure website deployment remains independent from demo deployment.
* Ensure demo and docs external URLs remain unchanged.
* Record any credential, token, or environment prerequisites without writing secrets into tracked files.

### Out of Scope

* Adding `@astrojs/cloudflare`.
* Server actions, sessions, dynamic personalization, form handling, or Cloudflare bindings.
* Deploying the synthetic demo.
* Production-hosted validation claims for unrelated app-shell or Worker surfaces.

***

## Prerequisites

* [ ] Session 03 automated build gates pass.
* [ ] Cloudflare Pages project name and credential path confirmed by owner or existing repo configuration.

***

## Deliverables

1. Cloudflare Pages settings documented in launch/deployment docs or workflow comments.
2. CI/workflow updates if needed.
3. Static deploy command recorded.
4. Deployment validation checklist.
5. No-secret environment guidance.

***

## Recommended Deploy Command

```bash
npm ci
npm --workspace @factionos/public-website run typecheck
npm --workspace @factionos/public-website run build
npx wrangler pages deploy public-website/dist \
  --project-name=factionos-public-website \
  --branch=main \
  --commit-hash="$(git rev-parse HEAD)" \
  --commit-message="$(git log -1 --pretty=%s)"
```

The production domain should be `https://faction-os.com/`. The demo remains at `https://demo.faction-os.com/`. The public docs remain at `https://faction-os.gitbook.io/faction-os-docs`.

***

## Task Expansion Guidance

When expanded with `plansession`, keep the checklist to 16-22 tasks covering:

* Existing workflow inspection.
* Pages settings record.
* Static output verification.
* Wrangler command record.
* CI update if needed.
* Secret handling review.
* Domain checklist.
* Demo independence check.
* Docs URL check.
* No adapter verification.
* Build/typecheck.

***

## Success Criteria

* [ ] Cloudflare Pages static deployment path is clear.
* [ ] Website can deploy from `public-website/dist`.
* [ ] No Cloudflare server adapter is added.
* [ ] Deployment docs do not expose secrets.
* [ ] Demo and public docs remain independent external destinations.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/phases/phase_16/session_04_cloudflare_pages_deployment_path.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
