Skip to content

Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.

docs: document the public site and the move to app.twiligent.ujjwal.fyi

spacesdrive171f42c63eb2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b8474d1..ee5ac13 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,16 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
+**Public website and docs site**
+- A marketing site at `https://twiligent.ujjwal.fyi` that explains what Twiligent does, with product previews, platform and FAQ sections, and Sign in and Get started buttons that open the app
+- The docs now live on the same site at `/docs`, written in MDX: section tabs, a grouped sidebar, an "On this page" outline, previous and next links, highlighted code blocks, and Suggest edits and Raise issue links on every page
+- Full-text docs search with Ctrl K (Cmd K on a Mac); the index is built with the site and opens results at the matching section
+- A light and dark theme toggle that follows the system setting until you choose, and remembers the choice
+- Product previews that play while on screen: a cursor schedules an Instagram Reel step by step, reads a channel's growth chart and opens Shorts and regular, and each feature card shows one live detail (a new account row, the Worker's request log, a GitHub run, a filter click, a tracked link)
+- Smooth area charts drawn at real size, with numbers that count up
+- `sitemap.xml`, `llms.txt` and `robots.txt` for search engines and AI tools
+- A new `site/` workspace with `npm run dev:site`, its own tests, and a deploy workflow for the `twiligent-site` Pages project (ADR-035)
+
**API rate limiting**
- Every API request is rate limited: per network before sign-in is checked, per user after it, and tighter on actions that use YouTube, Instagram or Reddit quota (adding accounts, refreshing, the scheduler trigger) and on Instagram publishing
- Token bucket, leaking bucket, fixed window, sliding window log and sliding window counter algorithms, counted atomically in Redis with Lua scripts and per server instance in memory when Redis is not configured or not reachable
@@ -39,9 +49,16 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Separate paths for members (sign in, connect accounts, analytics, publishing, tracked content, troubleshooting) and administrators (Supabase, YouTube, Instagram, Cloudinary, Redis, backend and frontend deploys, GitHub automation, launch checklist)
- Reference pages for every environment variable, how scheduling works, the security model and common questions
- Links to the docs from the sign-in page, the user menu, the command palette and Settings
+- These docs were first built into the app and then moved, before release, to the public site at `https://twiligent.ujjwal.fyi/docs` (see Public website and docs site above, and Changed)
### Changed
+**Docs and app addresses**
+- The docs moved from the app to the public site; links in the app (sign-in page, user menu, command palette, Settings) open `https://twiligent.ujjwal.fyi/docs`, and old `/docs/...` links in the app redirect to the same page there
+- The app moves to `https://app.twiligent.ujjwal.fyi`. The app's old paths on `twiligent.ujjwal.fyi` (such as `/login` and `/settings`) redirect to the new address. The Worker's `FRONTEND_URL` and `ALLOWED_ORIGINS`, the Supabase Auth URLs and the Google sign-in origins must name the new address
+- The sign-in page opens on the sign-up form when the link ends in `?mode=signup`
+- `npm run build`, `npm test` and `npm run typecheck` at the root now cover the site as well
+
**Protected main branch**
- `main` only accepts pull requests whose CI check passed on an up-to-date branch, merged with rebase; force pushes and deleting the branch are blocked for everyone (ADR-034)
@@ -108,6 +125,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Removed
+- The in-app documentation under `frontend/src/docs/` and its tests; the app's `/docs/*` route now only redirects to the public docs
- Dead code found during the TypeScript migration: the unused `backend/lib/crypto.ts`, the empty Reddit session refresh in the daily cron and the unread `REDDIT_ENCRYPTION_KEY` secret (delete it from the Worker if it is set), the `scheduled` post status checks (no post ever has it), and fallbacks for fields the API never sends
- The unused GitHub personal access token field and its guide in Settings (nothing used the token)
- Legacy root `public/` dashboard, unmounted `trackedPosts.js` route, unused Redis OAuth helpers, unused shadcn block templates and the unused Geist font package
diff --git a/DECISIONS.md b/DECISIONS.md
index a5d5ace..3edbff2 100644
--- a/DECISIONS.md
+++ b/DECISIONS.md
@@ -563,7 +563,7 @@ Records every significant architectural decision, the alternatives considered, a
## ADR-026: Public documentation inside the frontend at /docs
**Date:** 2026-10-13
-**Status:** Accepted
+**Status:** Superseded by ADR-035 (2026-10-15)
**Decision:** User and self-hosting documentation lives in the React app under `frontend/src/docs/`, served at the public route `/docs` outside `ProtectedRoute`. Pages are JSX built from a small set of doc components (headings with anchors, callouts, steps, tables, code blocks). The navigation is defined once in `docs/nav.js`; `docs/routes.js` maps each slug to a lazily loaded named export, and a test checks the two stay in sync. Content is split into two audiences: members of an instance, who need nothing beyond signing in, and administrators, who run their own instance.
@@ -721,3 +721,27 @@ Records every significant architectural decision, the alternatives considered, a
- "Up to date" means a pull request opened before another one merged must be rebased (`gh pr update-branch --rebase`) and checked again.
- Rebase merges give commits new hashes, so release tags are created after the merge, on `origin/main`.
- Renaming the CI job requires updating the ruleset in the same change.
+
+---
+
+## ADR-035: A separate site workspace for the marketing site and docs, with the app on its own address
+
+**Date:** 2026-10-15
+**Status:** Accepted
+
+**Decision:** The public marketing site and the user and self-hosting documentation move into a third npm workspace, `site/`, deployed to its own Cloudflare Pages project, `twiligent-site`, at `twiligent.ujjwal.fyi`. The app moves to `app.twiligent.ujjwal.fyi` on the existing `twiligent` project. The site is a static React SPA (Vite 7, React 19, Tailwind v4, React Router 7, motion). Docs pages are MDX files in `site/content/docs/`, compiled by `@mdx-js/rollup` with `remark-gfm` and `@shikijs/rehype` (GitHub light and dark themes as CSS variables). Each page starts with `export const meta = { title, description }`; the sidebar is defined once in `site/src/docs/nav.ts`, and a test checks the two match. A Vite plugin (`site/build/docsPlugin.ts`) builds a MiniSearch index at build time, served as the virtual module `virtual:docs-search` and loaded on the first search, and writes `sitemap.xml` and `llms.txt`. The site uses Solar icons (480 Design, CC BY 4.0, credited in `THIRD_PARTY_NOTICES.md` at the repository root), generated into one file by `site/build/genIcons.ts`; the owner chose them on 2026-10-15 to match Activepieces, the structural reference for the site. The app keeps Lucide. Sign-up and sign-in stay in the app: the site's buttons link to `app.twiligent.ujjwal.fyi/login` (with `?mode=signup` for Get started). The app's `/docs/*` route redirects to the same page on the site, and the site's `_redirects` sends the app's old paths to the app address.
+
+**Context:** The project needed a public home page that explains Twiligent to people who have not signed in, next to the docs from ADR-026. Docs written as TSX in the app needed JSX for every paragraph and could only change with an app deploy. The app's address was the only public address, so a home page there would compete with the login screen.
+
+**Alternatives considered:**
+- Keep the docs in the app and add a home page there. The marketing page would ship in the app bundle, and the app's address would stop opening on the login page.
+- A separate repository for the site. It would duplicate the toolchain (TypeScript, ESLint, CI) and split changes that touch the app and its docs into two pull requests.
+- A docs framework (Docusaurus, Mintlify, Starlight). Each brings its own build, theming and component model, and Mintlify is hosted outside the project's control. A Vite and React site keeps one toolchain with the app and full control over the brand.
+
+**Trade-offs:**
+- The site adds dependencies to the root lockfile (`@mdx-js/rollup`, `@mdx-js/react`, `remark-gfm`, `@shikijs/rehype`, `shiki`, `minisearch`, `motion`, `react-router`, `@iconify-json/solar`). None of them reach the Worker or the app bundle.
+- A third deploy workflow (`deploy-site.yml`) and a second Pages project. The site needs no secrets beyond the Cloudflare API token and account id.
+- Moving the app's address means updating `FRONTEND_URL` and `ALLOWED_ORIGINS` on the Worker, the Supabase Auth site URL and redirect allow list, and the Google OAuth JavaScript origins. Old links keep working through the two redirects.
+- The search index is rebuilt on every site build and downloaded only when someone searches, so it adds nothing to the first load.
+- Self-hosters do not need the site: they deploy only the app and the Worker, and read the docs on the project's site.
+- The site follows the brand kit in `frontend/public/` but keeps its own copy of the tokens in `site/src/index.css` (see `docs/brand-notes.md`), so a token change must be made in both places.
diff --git a/README.md b/README.md
index fe92d41..9083142 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,8 @@ Every analytics product wants a monthly subscription and access to your data. Tw
You deploy one Cloudflare Worker and one Cloudflare Pages site using your own API credentials. Your data is stored in your own Supabase database and cached in your own Upstash Redis instance. No shared infrastructure. No accounts created on third-party services beyond the free tiers you choose. No ongoing cost.
+The project's own public site and documentation are at [twiligent.ujjwal.fyi](https://twiligent.ujjwal.fyi), and its own instance of the app runs at [app.twiligent.ujjwal.fyi](https://app.twiligent.ujjwal.fyi). The site is built from the `site/` folder of this repository; you do not need to deploy it to run your own Twiligent.
+
---
## Table of Contents
@@ -128,7 +130,7 @@ You deploy one Cloudflare Worker and one Cloudflare Pages site using your own AP
## Quick Start
-Clone and install dependencies (one install at the root covers the backend and the frontend):
+Clone and install dependencies (one install at the root covers the backend, the frontend and the public site):
```bash
git clone https://github.com/spacesdrive/twiligent.git
@@ -146,7 +148,7 @@ This runs the backend Worker on port 8787 and the frontend on port 5173 in one t
Open [http://localhost:5173](http://localhost:5173) and sign up for an account, then go to **Accounts** to add your first YouTube channel or Instagram account.
-The full documentation, including a step-by-step self-hosting guide that explains every key, is built into the app at `/docs` (for example [http://localhost:5173/docs](http://localhost:5173/docs)). It is public, so you can share the link with members before they sign in.
+The full documentation, including a step-by-step self-hosting guide that explains every key, is at [twiligent.ujjwal.fyi/docs](https://twiligent.ujjwal.fyi/docs). It is public, so you can share the link with members before they sign in. The pages are MDX files in `site/content/docs/`; run `npm run dev:site` to preview the site and docs locally.
**Using someone else's Twiligent?** You need none of this. Sign in with the link you were given; the server, keys and scheduled publishing are already handled by the administrator.
@@ -181,7 +183,7 @@ cd twiligent
npm install
```
-The repository is an npm workspaces monorepo: `backend/` and `frontend/` are workspaces, and one install at the root fills a single `node_modules` from the single root `package-lock.json`. Do not run `npm install` inside `backend/` or `frontend/`.
+The repository is an npm workspaces monorepo: `backend/`, `frontend/` and `site/` (the public marketing site and docs) are workspaces, and one install at the root fills a single `node_modules` from the single root `package-lock.json`. Do not run `npm install` inside `backend/`, `frontend/` or `site/`.
**3. Create the Supabase database tables**
@@ -236,7 +238,7 @@ alter table scheduled_posts enable row level security;
alter table tracked_posts enable row level security;
```
-If you created the tables from an earlier version of this README, run the `tracked_posts` and `alter table` statements above as well. Then, in Supabase Authentication, turn off **Confirm email** unless you have set up email verification codes (`/docs/self-host/email-codes`), and turn off new signups once your team has accounts if the instance is private.
+If you created the tables from an earlier version of this README, run the `tracked_posts` and `alter table` statements above as well. Then, in Supabase Authentication, turn off **Confirm email** unless you have set up email verification codes ([docs](https://twiligent.ujjwal.fyi/docs/self-host/email-codes)), and turn off new signups once your team has accounts if the instance is private.
**4. Configure credentials**
@@ -258,20 +260,21 @@ Run every command from the repository root.
| Command | What it does |
|---|---|
-| `npm install` | Installs both workspaces and the shared tooling |
+| `npm install` | Installs every workspace and the shared tooling |
| `npm run dev` | Starts the Worker (`wrangler dev`, port 8787) and Vite (port 5173) together |
| `npm run dev:backend` / `npm run dev:frontend` | Starts one of them |
-| `npm run typecheck` | Type-checks every TypeScript project: backend, backend tests, frontend, frontend tooling and tests, scripts |
-| `npm run build` | Builds the frontend into `frontend/dist/` |
-| `npm test` | Runs the backend tests, then the frontend tests (Node's built-in test runner on `tests/**/*.test.ts`) |
+| `npm run dev:site` | Starts the public site and docs (`site/`) on its own Vite dev server |
+| `npm run typecheck` | Type-checks every TypeScript project: backend, backend tests, frontend, frontend tooling and tests, site, site build files and tests, scripts |
+| `npm run build` | Builds the frontend into `frontend/dist/`, then the site into `site/dist/` |
+| `npm test` | Runs the backend, frontend and site tests (Node's built-in test runner on `tests/**/*.test.ts`) |
| `npm run lint` | Runs ESLint over the whole repository with the shared `eslint.config.mjs` |
| `npm run format` | Applies Prettier (`.prettierrc.json`) to the whole repository |
-Add a dependency to the app that uses it: `npm install <package> --workspace backend` or `npm install <package> --workspace frontend`. Only shared development tooling goes in the root `package.json`.
+Add a dependency to the workspace that uses it: `npm install <package> --workspace backend`, `--workspace frontend` or `--workspace site`. Only shared development tooling goes in the root `package.json`.
The whole project is TypeScript in `strict` mode. Nothing is compiled ahead of time: Wrangler and Vite strip the types while bundling, and Node strips them when it runs the tests and `scripts/publish-scheduled.ts`. None of them checks types, so run `npm run typecheck` before you commit; CI runs it on every pull request and before every deploy. The API request and response types live once in `shared/types/` and are used by both the backend and the frontend. See `docs/guidelines/TYPESCRIPT.md`.
-Tests live outside the source folders, in `backend/tests/` and `frontend/tests/`, and mirror the source tree: the test for `backend/services/youtube/youtubeChannels.ts` is `backend/tests/services/youtube/youtubeChannels.test.ts`, and the test for `frontend/src/lib/accounts.ts` is `frontend/tests/lib/accounts.test.ts`. Backend fixtures and golden snapshots are in `backend/tests/fixtures/`.
+Tests live outside the source folders, in `backend/tests/`, `frontend/tests/` and `site/tests/`, and mirror the source tree: the test for `backend/services/youtube/youtubeChannels.ts` is `backend/tests/services/youtube/youtubeChannels.test.ts`, and the test for `frontend/src/lib/accounts.ts` is `frontend/tests/lib/accounts.test.ts`. Backend fixtures and golden snapshots are in `backend/tests/fixtures/`.
ESLint (with `typescript-eslint`), Prettier and EditorConfig are configured once at the root, and the shared compiler settings are in `tsconfig.base.json`. The existing code has not been reformatted in bulk, so run `npm run format` only when you mean to reformat.
@@ -310,7 +313,7 @@ VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
VITE_API_URL=http://localhost:8787/api
# Optional: who users contact for Instagram tester access and scheduling problems
-# Optional: Google web client ID; shows Continue with Google (see /docs/self-host/google-sign-in)
+# Optional: Google web client ID; shows Continue with Google (see https://twiligent.ujjwal.fyi/docs/self-host/google-sign-in)
VITE_GOOGLE_CLIENT_ID=1234567890-abc.apps.googleusercontent.com
```
@@ -338,7 +341,7 @@ npx wrangler secret put EMAIL_FROM # optional
npx wrangler secret put EMAIL_DAILY_LIMIT # optional; defaults to 100
```
-The four email secrets turn on 6-digit verification codes for email sign-ups, sent free through Resend (100 a day). Supabase Auth hands each email to the Worker through its Send Email hook (`POST /api/auth/email-hook`). Past the daily limit, the sign-up page asks people to sign in with Google instead. Setup steps are in the app at `/docs/self-host/email-codes`.
+The four email secrets turn on 6-digit verification codes for email sign-ups, sent free through Resend (100 a day). Supabase Auth hands each email to the Worker through its Send Email hook (`POST /api/auth/email-hook`). Past the daily limit, the sign-up page asks people to sign in with Google instead. Setup steps are in the [docs](https://twiligent.ujjwal.fyi/docs/self-host/email-codes).
### Getting API credentials
@@ -443,6 +446,7 @@ twiligent/
│ ├── ci.yml # Type check, lint, test, build and Worker dry-run on pull requests and branches
│ ├── deploy-backend.yml # Type check, test, then Wrangler deploy on backend, shared or root config changes
│ ├── deploy-frontend.yml # Type check, test, then Cloudflare Pages deploy on frontend, shared or root config changes
+│ ├── deploy-site.yml # Type check, test, then deploy the public site to the twiligent-site Pages project
│ └── publish-scheduled.yml # Scheduled post fallback (every 15 minutes, Node 24)
│
├── backend/
@@ -481,7 +485,7 @@ twiligent/
│ └── package.json # Backend workspace: hono, supabase-js, upstash redis, wrangler, workers-types
│
├── frontend/
-│ ├── tests/ # Node tests (*.test.ts) mirroring src/ (lib, utils, features, docs)
+│ ├── tests/ # Node tests (*.test.ts) mirroring src/ (lib, utils, features)
│ ├── index.html # Loads /src/main.tsx
│ ├── vite.config.ts # Vite config: React and Tailwind plugins, @ alias
│ ├── tsconfig.json # Type check for src/ (DOM, JSX, @/ and @shared/ paths)
@@ -510,6 +514,14 @@ twiligent/
│ └── services/
│ └── api.ts # Frontend API client (all fetch calls)
│
+├── site/ # Public marketing site and docs (twiligent.ujjwal.fyi); not needed to self-host
+│ ├── content/docs/ # Docs pages in MDX, each starting with export const meta = { title, description }
+│ ├── build/ # Vite docs plugin (search index, sitemap.xml, llms.txt) and the icon generator
+│ ├── public/ # Fonts, brand assets, _redirects to the app, robots.txt
+│ ├── src/ # Pages, sections, mockups, the docs layout and search, nav.ts
+│ ├── tests/ # Node tests: docs navigation, metadata, links and search helpers
+│ └── package.json # Site workspace: React, Vite, Tailwind, MDX, MiniSearch, motion
+│
├── shared/
│ └── types/ # API contract shared by backend and frontend (types only)
│
@@ -518,7 +530,7 @@ twiligent/
│ └── tsconfig.json # Type check for scripts/ (Node types)
│
├── package.json # npm workspaces root: scripts, shared dev tooling, engines (Node 22.18+)
-├── package-lock.json # The only lockfile, for both workspaces
+├── package-lock.json # The only lockfile, for every workspace
├── tsconfig.base.json # Shared strict compiler settings
├── eslint.config.mjs # Shared ESLint config
├── .prettierrc.json # Shared Prettier config
@@ -533,7 +545,7 @@ twiligent/
| Tool | Version | Purpose |
|---|---|---|
-| TypeScript | 6.0 | Strict type checking across the backend, frontend, shared types, scripts and tests |
+| TypeScript | 6.0 | Strict type checking across the backend, frontend, public site, shared types, scripts and tests |
| typescript-eslint | 8 | TypeScript lint rules |
| Node.js | 22.18 or later | Runs the tests and the scheduled publisher by stripping types |
@@ -551,6 +563,16 @@ twiligent/
| Lucide React | 1.17 | Icon library |
| Sonner | 2 | Toast notifications |
+**Public site (`site/`)**
+
+| Library | Version | Purpose |
+|---|---|---|
+| MDX (`@mdx-js/rollup`) | 3 | Docs pages written in Markdown with components |
+| Shiki | 4 | Code highlighting at build time, light and dark |
+| MiniSearch | 7 | Docs search index built at build time |
+| motion | 14 | Page and section animation |
+| Solar icons (`@iconify-json/solar`) | 1 | Site icons, generated into one file (CC BY 4.0) |
+
**Backend**
| Library | Version | Purpose |
@@ -566,7 +588,7 @@ twiligent/
| Service | Purpose |
|---|---|
| Cloudflare Workers | Backend API and built-in cron scheduler |
-| Cloudflare Pages | Frontend SPA hosting with CI/CD |
+| Cloudflare Pages | Frontend SPA hosting with CI/CD (and the project's public site) |
| Supabase | PostgreSQL database and authentication (JWT) |
| Upstash Redis | Analytics caching layer (optional) |
| YouTube Data API v3 | Channel and video analytics |
@@ -623,7 +645,7 @@ git push origin feature/your-feature-name
## License
-[MIT](LICENSE)
+[MIT](LICENSE). Work by others that the project includes, and the credit its licence asks for, is listed in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
---
diff --git a/ROADMAP.md b/ROADMAP.md
index c7a8f4c..d2390bf 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -12,7 +12,7 @@ What Twiligent is for, and what every change should move forward.
1. **One place for a creator's numbers.** YouTube, Instagram and Reddit analytics on one dashboard, with the same metrics, terms and layout across platforms.
2. **Publishing that does not miss.** Scheduled Instagram posts go out on time, exactly once, even if one of the two schedulers fails.
-3. **Cheap and simple to self-host.** Runs on the free tiers of Cloudflare, Supabase, Upstash and Cloudinary. Setup is documented step by step at `/docs`, and members of an instance need no setup at all.
+3. **Cheap and simple to self-host.** Runs on the free tiers of Cloudflare, Supabase, Upstash and Cloudinary. Setup is documented step by step in the public docs at `https://twiligent.ujjwal.fyi/docs`, and members of an instance need no setup at all.
4. **Safe by default.** Secrets stay server-side, every query is scoped to the signed-in user, tokens never reach the browser, and no client can exhaust the shared API quotas.
5. **Easy to change without breaking.** Typed code, tests that pin behaviour, one shared toolchain, and docs that stay in step with the code.
diff --git a/claude.md b/claude.md
index 82ba4e3..78fa480 100644
--- a/claude.md
+++ b/claude.md
@@ -7,6 +7,7 @@ Twiligent is a self-hosted social media analytics and publishing dashboard for c
- Primary users: Small creator teams, agencies, individual power users
- Primary value: Unified analytics and scheduled Instagram publishing across multiple accounts
- Current platforms: YouTube (analytics only), Instagram (analytics and publishing), Reddit (analytics only)
+- Public site: https://twiligent.ujjwal.fyi is the project's own marketing site and documentation (the `site/` workspace); the app runs at https://app.twiligent.ujjwal.fyi. Self-hosters run only the app and the Worker; the site is not needed to run Twiligent
- GitHub repository: https://github.com/spacesdrive/twiligent
- Goals and priorities: `ROADMAP.md`
@@ -31,24 +32,26 @@ Every task is tracked by a GitHub issue, no matter how small: features, fixes, r
The repo is an npm workspaces monorepo. Run every install and script from the root.
```
-package.json workspaces ["backend", "frontend"], shared dev tooling, root scripts
+package.json workspaces ["backend", "frontend", "site"], shared dev tooling, root scripts
package-lock.json the only lockfile; one node_modules at the root
tsconfig.base.json shared TypeScript settings (strict, erasable syntax only); each project extends it
-eslint.config.mjs shared ESLint config (typescript-eslint, frontend rules, backend Workers rules, Node rules for tests)
+eslint.config.mjs shared ESLint config (typescript-eslint, frontend and site rules, backend Workers rules, Node rules for tests and site build files)
.prettierrc.json shared Prettier config matching the existing style (not applied in bulk)
.editorconfig editor defaults (4 spaces in backend, 2 elsewhere)
shared/types/ API contract types shared by backend and frontend (types only, no runtime code)
backend/ Hono Worker in layers: middleware/, routes/, controllers/, services/, repositories/,
validators/, database/, jobs/, lib/; app.ts builds the pipeline, container.ts wires services;
tests in backend/tests/ mirroring the source folders
-frontend/ React SPA; tests in frontend/tests/ mirroring frontend/src/
+frontend/ React SPA (the app); tests in frontend/tests/ mirroring frontend/src/
+site/ public marketing site and docs (Vite, React, MDX); docs pages in site/content/docs/,
+ build plugins in site/build/, tests in site/tests/
scripts/ publish-scheduled.ts, run by GitHub Actions with no dependencies
```
-- `npm install` at the root installs both apps. Never run `npm install` inside `backend/` or `frontend/`, and never commit a lockfile there.
-- `npm run dev` starts the Worker (port 8787) and Vite (port 5173) together; `npm run typecheck`, `npm test`, `npm run lint` and `npm run build` cover the whole repo.
-- Add a dependency to the app that uses it: `npm install <pkg> --workspace backend` or `--workspace frontend`. Only shared dev tooling belongs in the root `package.json`.
-- Tests never live next to source files. A test for `backend/services/accountService.ts` is `backend/tests/services/accountService.test.ts`; a test for `frontend/src/lib/accounts.ts` is `frontend/tests/lib/accounts.test.ts`.
+- `npm install` at the root installs every workspace. Never run `npm install` inside `backend/`, `frontend/` or `site/`, and never commit a lockfile there.
+- `npm run dev` starts the Worker (port 8787) and Vite (port 5173) together; `npm run dev:site` starts the public site on its own. `npm run typecheck`, `npm test`, `npm run lint` and `npm run build` cover the whole repo, the site included (`build` builds the app, then the site).
+- Add a dependency to the workspace that uses it: `npm install <pkg> --workspace backend`, `--workspace frontend` or `--workspace site`. Only shared dev tooling belongs in the root `package.json`.
+- Tests never live next to source files. A test for `backend/services/accountService.ts` is `backend/tests/services/accountService.test.ts`; a test for `frontend/src/lib/accounts.ts` is `frontend/tests/lib/accounts.test.ts`; site tests live in `site/tests/`.
---
@@ -62,7 +65,7 @@ Before implementing any feature or fix, read these documents in this exact order
4. `docs/architecture/OVERVIEW.md` - system topology and request flow
5. `docs/guidelines/TYPESCRIPT.md` - code standards and typing rules (always apply)
6. `docs/guidelines/CODE_STYLE.md` - how code reads here: layer shapes, comments, naming, messages, tests (always apply; its checklist runs before every commit)
-7. Relevant architecture doc - backend, frontend, database, or cloudflare
+7. Relevant architecture doc - backend, frontend, site, database, or cloudflare
8. Relevant feature guide - if one exists in `docs/features/`
9. Relevant engineering guideline - if the task touches a specific layer
10. `ROADMAP.md` - if the task is a planned item, link its issue there
@@ -77,6 +80,7 @@ For MCP usage, read `docs/mcp/OVERVIEW.md` before using any MCP server.
docs/
WRITING_STANDARDS.md Typography, icons, writing style, UI copy, commit messages
design-reference.md Measured interface reference, brand kit inventory, token sources
+ brand-notes.md What the public site takes from the brand kit: palette, type, logo, icons, voice
architecture/
OVERVIEW.md System topology, connections, request lifecycle
backend/
@@ -95,12 +99,14 @@ docs/
CONTEXTS.md AuthContext, AppContext, usage rules
API_LAYER.md api.ts, request(), auth header injection
FEATURES.md Feature module conventions, directory map
+ site/
+ SITE.md Public site and docs: stack, folders, docs pipeline, theming, icons, deploy
database/
SCHEMA.md All tables, columns, types, constraints
SECURITY.md RLS policy, service vs anon key, isolation
cloudflare/
WORKERS.md Worker export, env binding, cron handler
- PAGES.md Frontend deployment, build step, env vars
+ PAGES.md App and site deployment, build step, env vars
CI_CD.md GitHub Actions workflows, path filters
data-flows/
AUTHENTICATION.md Login, JWT lifecycle, session management
@@ -145,8 +151,9 @@ docs/
SECURITY.md Security model, key handling, isolation
PERFORMANCE.md Caching strategy, edge optimization
-frontend/src/docs/ Public user and self-hosting docs served at /docs (in-app, TSX)
+site/content/docs/ Public user and self-hosting docs (MDX) served at twiligent.ujjwal.fyi/docs
DECISIONS.md Architectural decision log
+THIRD_PARTY_NOTICES.md Credit for work by others that the project includes (the Solar icons)
CHANGELOG.md Version history and feature changes
ROADMAP.md Planned features and priorities
```
@@ -158,14 +165,14 @@ ROADMAP.md Planned features and priorities
Read `docs/WRITING_STANDARDS.md` for the full specification. The non-negotiable rules:
- Never use emojis, em dashes (--), or emoticons anywhere in the project
-- Never use emoji as icons in UI - use Lucide React SVG icons
+- Never use emoji as icons in UI - use Lucide React SVG icons in the app, and the Solar icons generated into `site/src/components/icons.tsx` on the public site
- Write clear, professional English with no marketing buzzwords or filler text
- UI copy names things from the user's perspective, not the system's internals
- Error messages explain what went wrong and what to do - no "Something went wrong"
- One comment per non-obvious logic block, maximum - never restate what the code does
- Every page must feel like it belongs to the same application: consistent padding, cards, skeletons, toasts, icons
- All styling goes through the design tokens in `frontend/src/index.css` and the shared components listed in `docs/architecture/frontend/DESIGN_SYSTEM.md`; no hex or Tailwind palette colours in components
-- Brand assets (logos, fonts, tokens, guidelines) live in `frontend/public/`; sentence case in UI copy, no exclamation marks
+- Brand assets (logos, fonts, tokens, guidelines) live in `frontend/public/` (the public site keeps copies in `site/public/brand/` and `site/public/fonts/`, and `docs/brand-notes.md` records what it takes from the kit); sentence case in UI copy, no exclamation marks
---
@@ -376,6 +383,12 @@ When anything changes, update every relevant docs file from the table below. The
| api.ts changed | `docs/architecture/frontend/API_LAYER.md` |
| App.tsx routing changed | `docs/architecture/frontend/ROUTING.md` |
| Frontend deployment config changed | `docs/architecture/cloudflare/PAGES.md` |
+| Site deployment config changed (`deploy-site.yml`, `site/public/_redirects`, the `twiligent-site` project) | `docs/architecture/cloudflare/PAGES.md`, `docs/architecture/cloudflare/CI_CD.md`, `docs/workflows/DEPLOYMENT.md`, `docs/architecture/site/SITE.md` |
+| Site structure, build plugins, routes or theming changed | `docs/architecture/site/SITE.md`, `docs/brand-notes.md` (if a brand rule changes) |
+| New npm package (site) | `docs/architecture/site/SITE.md`, `DECISIONS.md` |
+| Docs page added, moved or renamed | The `.mdx` file in `site/content/docs/` (starting with `export const meta = { title, description }`), its entry in `site/src/docs/nav.ts`, any `docsUrl()` links in the app, and a 301 line in `site/public/_redirects` for a moved or renamed page |
+| Site icon added | The `ICONS` list in `site/build/genIcons.ts`, then `npm run icons --workspace site` to regenerate `site/src/components/icons.tsx` (never edit that file by hand) |
+| Third-party work with an attribution licence added (icons, fonts, images) | `THIRD_PARTY_NOTICES.md` (author, source, licence link, changes made) |
| Architecture decision made | `DECISIONS.md` (append only, never delete) |
| Any feature shipped | `CHANGELOG.md` (append to Unreleased section) |
| Release tagged | `CHANGELOG.md` (convert Unreleased to version number with date) |
@@ -391,4 +404,4 @@ When anything changes, update every relevant docs file from the table below. The
| Workflow changed | `docs/workflows/` (relevant file) |
| Guideline changed | `docs/guidelines/` (relevant file) |
| Philosophy changed | `docs/philosophy/` (relevant file) |
-| Project setup, features, or deployment instructions change | `README.md`, and the self-hosting pages in `frontend/src/docs/pages/selfHost/` |
+| Project setup, features, or deployment instructions change | `README.md`, and the self-hosting pages in `site/content/docs/self-host/` |
diff --git a/docs/WRITING_STANDARDS.md b/docs/WRITING_STANDARDS.md
index 1ae1d61..243aebd 100644
--- a/docs/WRITING_STANDARDS.md
+++ b/docs/WRITING_STANDARDS.md
@@ -19,8 +19,9 @@ These rules apply to all generated code, documentation, UI copy, commit messages
- Never use emoji as icons in UI.
- Use SVG icons only.
-- Prefer Lucide React icons (`lucide-react`) at a 1.75 stroke. Platform logos (YouTube, Instagram, Reddit) come from `components/brand/platform-icons.tsx`.
+- In the app (`frontend/`), prefer Lucide React icons (`lucide-react`) at a 1.75 stroke. Platform logos (YouTube, Instagram, Reddit) come from `components/brand/platform-icons.tsx`.
- If Lucide does not have an appropriate icon, use another open-source SVG icon library (e.g. Heroicons, Radix Icons).
+- On the public site (`site/`), use the Solar icons (480 Design, CC BY 4.0, credited in `THIRD_PARTY_NOTICES.md`) generated into `site/src/components/icons.tsx`: the bold style for things and places, the linear style for small controls. Add an icon to the list in `site/build/genIcons.ts` and run `npm run icons --workspace site`. Platform logos on the site come from `site/src/components/marks.tsx`. The owner chose Solar for the site on 2026-10-15; the app keeps Lucide.
- All icons in the same UI context must have consistent size, stroke width, spacing, and visual weight.
---
diff --git a/docs/architecture/OVERVIEW.md b/docs/architecture/OVERVIEW.md
index 0bb4611..6dc35e6 100644
--- a/docs/architecture/OVERVIEW.md
+++ b/docs/architecture/OVERVIEW.md
@@ -4,9 +4,16 @@
```
┌─────────────────────────────────────────────────────────────────┐
-│ Browser (User) │
-│ React SPA - Cloudflare Pages │
+│ Public site and docs - Cloudflare Pages "twiligent-site" │
│ https://twiligent.ujjwal.fyi │
+│ No API calls; Sign in and Get started link to the app │
+└────────────────────────┬────────────────────────────────────────┘
+ │ links
+ ▼
+┌─────────────────────────────────────────────────────────────────┐
+│ Browser (User) │
+│ React SPA (the app) - Cloudflare Pages "twiligent" │
+│ https://app.twiligent.ujjwal.fyi │
└────────────────────────┬────────────────────────────────────────┘
│ HTTPS + Bearer JWT
▼
@@ -53,7 +60,8 @@
| Component | Platform | URL |
|---|---|---|
| Backend API | Cloudflare Workers | `twiligent.ujjwalkrai.workers.dev` |
-| Frontend SPA | Cloudflare Pages | `twiligent.ujjwal.fyi` (also `twiligent.pages.dev`; `twiligent.spacesdrive.cc` redirects with a 301 rule on the spacesdrive.cc zone) |
+| Public site and docs | Cloudflare Pages, project `twiligent-site` | `twiligent.ujjwal.fyi` (`twiligent.spacesdrive.cc` redirects here with a 301 rule on the spacesdrive.cc zone) |
+| Frontend SPA (the app) | Cloudflare Pages, project `twiligent` | `app.twiligent.ujjwal.fyi` (also `twiligent.pages.dev`) |
| Database + Auth | Supabase | `nheuatbcevaxgxyvahtr.supabase.co` |
| Media cache | Upstash Redis | Configured via `UPSTASH_REDIS_REST_URL` |
| Media hosting | Cloudinary | `CLOUDINARY_CLOUD_NAME` |
@@ -128,7 +136,7 @@ See `docs/architecture/cloudflare/WORKERS.md` for the full list of required Work
Frontend env vars are documented in `docs/architecture/cloudflare/PAGES.md`.
-The SPA also serves public documentation at `/docs` (no sign-in, no API calls). It is static TSX in `frontend/src/docs/`, code-split per section; see `docs/architecture/frontend/FEATURES.md`.
+The public marketing site and the user and self-hosting documentation are a separate static site in the `site/` workspace, deployed to the `twiligent-site` Pages project at `https://twiligent.ujjwal.fyi` (docs under `/docs`). It makes no API calls and needs no secrets; its sign-in and sign-up buttons link to the app. The app keeps a `/docs/*` route that sends old links to the same page on the site. Self-hosters do not need the site to run Twiligent. See `docs/architecture/site/SITE.md`.
## Key Architectural Invariants
diff --git a/docs/architecture/cloudflare/CI_CD.md b/docs/architecture/cloudflare/CI_CD.md
index b1fd95f..1813474 100644
--- a/docs/architecture/cloudflare/CI_CD.md
+++ b/docs/architecture/cloudflare/CI_CD.md
@@ -6,7 +6,8 @@
|---|---|---|
| `ci.yml` | Pull requests, pushes to any branch except `main`, manual | Type check, lint, test, build and bundle before anything reaches `main` |
| `deploy-backend.yml` | Pushes to `main` that touch the backend, manual | Type check and test the backend, then deploy the Worker |
-| `deploy-frontend.yml` | Pushes to `main` that touch the frontend, manual | Type check and test the frontend, then build and deploy to Pages |
+| `deploy-frontend.yml` | Pushes to `main` that touch the frontend, manual | Type check and test the frontend, then build and deploy the app to Pages |
+| `deploy-site.yml` | Pushes to `main` that touch the site, manual | Type check and test the public site, then build and deploy it to Pages |
| `publish-scheduled.yml` | Every 15 minutes, manual | Publish due Instagram posts (fallback for the Worker cron) |
Nothing compiles TypeScript ahead of time: Wrangler and Vite strip the types while bundling, and Node strips them when it runs tests and `scripts/publish-scheduled.ts`. None of those steps checks types, so each workflow that ships code runs `tsc` first.
@@ -19,10 +20,10 @@ Nothing compiles TypeScript ahead of time: Wrangler and Vite strip the types whi
1. Checkout repo
2. `actions/setup-node@v4` with Node 24 and the npm cache keyed on the root `package-lock.json`
3. `npm ci` at the repository root
-4. `npm run typecheck` - every TypeScript project: backend, backend tests, frontend, frontend tooling and tests, scripts
+4. `npm run typecheck` - every TypeScript project: backend, backend tests, frontend, frontend tooling and tests, site, site build files and tests, scripts
5. `npm run lint` - ESLint over the whole repository
-6. `npm test` - backend then frontend tests
-7. `npm run build` - Vite production build of the frontend (without the `VITE_*` secrets)
+6. `npm test` - backend, frontend, then site tests
+7. `npm run build` - Vite production builds of the frontend (without the `VITE_*` secrets) and then the site
8. `npx wrangler deploy --dry-run --outdir dist` in `backend/` - bundles the Worker without deploying, which catches import and bundling errors
**Required GitHub secrets:** none.
@@ -81,6 +82,27 @@ The workflow does not set the Worker's own secrets (`SUPABASE_*`, `FRONTEND_URL`
---
+### `deploy-site.yml`
+
+**Trigger:** Push to `main` branch, when files under `site/**`, `tsconfig.base.json`, the root `package.json`, the root `package-lock.json` or `.github/workflows/deploy-site.yml` change; also `workflow_dispatch` for a manual run
+
+**What it does:**
+1. Checkout repo
+2. `actions/setup-node@v4` with Node 24 and the npm cache keyed on the root `package-lock.json`
+3. `npm ci` at the repository root, which installs every workspace, including Wrangler
+4. `npm run typecheck --workspace site` - checks `site/src` (`tsconfig.json`) and `vite.config.ts`, `site/build` and the site tests (`tsconfig.node.json`)
+5. `npm test --workspace site`
+6. `npm run build --workspace site` - Vite builds to `site/dist/`, and the docs plugin adds `sitemap.xml` and `llms.txt`
+7. Deploy `dist/` to the Cloudflare Pages project `twiligent-site` via `wrangler pages deploy dist --project-name=twiligent-site` (`cloudflare/wrangler-action@v4` with `workingDirectory: site`)
+
+**Required GitHub secrets:**
+- `CLOUDFLARE_API_TOKEN`
+- `CLOUDFLARE_ACCOUNT_ID`
+
+The site needs no other secret: every value it shows is public and lives in the source. The `twiligent-site` project must exist before the first run; see `PAGES.md`.
+
+---
+
### `publish-scheduled.yml`
**Trigger:**
@@ -106,10 +128,12 @@ The script is type-checked by `npm run typecheck` (`scripts/tsconfig.json`) in `
The deploy workflows use path filters; `ci.yml` does not.
-- Editing `frontend/` only -> triggers `deploy-frontend.yml`, not `deploy-backend.yml`
-- Editing `backend/` only -> triggers `deploy-backend.yml`, not `deploy-frontend.yml`
-- Editing `shared/` or `tsconfig.base.json` -> triggers both, because both apps import the shared types and extend the base config
-- Editing the root `package.json` or `package-lock.json` -> triggers both, because the single lockfile pins the dependencies of both apps
+- Editing `frontend/` only -> triggers `deploy-frontend.yml`, not `deploy-backend.yml` or `deploy-site.yml`
+- Editing `backend/` only -> triggers `deploy-backend.yml`, not `deploy-frontend.yml` or `deploy-site.yml`
+- Editing `site/` only (including the docs pages in `site/content/docs/`) -> triggers `deploy-site.yml` only
+- Editing `shared/` -> triggers the backend and frontend deploys, because both apps import the shared types; the site does not use them
+- Editing `tsconfig.base.json` -> triggers all three deploys, because every workspace extends the base config
+- Editing the root `package.json` or `package-lock.json` -> triggers all three deploys, because the single lockfile pins the dependencies of every workspace
- Editing root tooling config (`eslint.config.mjs`, `.prettierrc.json`, `.editorconfig`) -> triggers no deploy; `ci.yml` checks it on the branch or pull request before it reaches `main`
- Editing `scripts/` -> triggers neither deploy workflow (only `publish-scheduled.yml` on its cron)
- Editing `docs/` -> triggers no deploy
@@ -127,8 +151,11 @@ curl https://twiligent.ujjwalkrai.workers.dev/api/health
# Should return: {"status":"ok","timestamp":"..."}
```
-**Frontend:**
-Open `https://twiligent.ujjwal.fyi` - verify login page loads, accounts load after auth.
+**Frontend (the app):**
+Open `https://app.twiligent.ujjwal.fyi` - verify login page loads, accounts load after auth. Open `https://app.twiligent.ujjwal.fyi/docs/self-host` - verify it lands on the same page of the public docs.
+
+**Site:**
+Open `https://twiligent.ujjwal.fyi` - verify the home page renders, then open `https://twiligent.ujjwal.fyi/docs` and search for a term such as `redis`. Check that `https://twiligent.ujjwal.fyi/sitemap.xml` and `https://twiligent.ujjwal.fyi/llms.txt` load, and that `https://twiligent.ujjwal.fyi/login` redirects to the app.
**Publisher:**
Trigger `publish-scheduled.yml` manually via GitHub Actions UI -> Actions -> "Instagram Scheduled Publisher" -> "Run workflow" -> check the run log for expected output.
@@ -137,7 +164,7 @@ Trigger `publish-scheduled.yml` manually via GitHub Actions UI -> Actions -> "In
1. Create `.github/workflows/my-workflow.yml`
2. Add appropriate path filters to avoid unnecessary runs
-3. If the workflow needs project dependencies, run `actions/setup-node` with Node 24, `cache-dependency-path: package-lock.json` and `npm ci` at the repository root; there are no lockfiles inside `backend/` or `frontend/`
+3. If the workflow needs project dependencies, run `actions/setup-node` with Node 24, `cache-dependency-path: package-lock.json` and `npm ci` at the repository root; there are no lockfiles inside `backend/`, `frontend/` or `site/`
4. If it ships code, run `npm run typecheck` (or the workspace's `typecheck` script) before the deploy step
5. Document it in `docs/architecture/cloudflare/CI_CD.md` (this file)
6. Add any required secrets via GitHub repo -> Settings -> Secrets -> Actions
diff --git a/docs/architecture/cloudflare/PAGES.md b/docs/architecture/cloudflare/PAGES.md
index e1bfb5b..5d4a765 100644
--- a/docs/architecture/cloudflare/PAGES.md
+++ b/docs/architecture/cloudflare/PAGES.md
@@ -1,7 +1,16 @@
-# Cloudflare Pages (Frontend Deployment)
+# Cloudflare Pages (App and Site Deployment)
## Overview
+Two Cloudflare Pages projects serve the browser side:
+
+| Project | Workspace | Address | Build output | Build secrets |
+|---|---|---|---|---|
+| `twiligent` | `frontend/` (the app) | `app.twiligent.ujjwal.fyi` | `frontend/dist` | The `VITE_*` values below |
+| `twiligent-site` | `site/` (marketing site and docs) | `twiligent.ujjwal.fyi` | `site/dist` | None |
+
+Most of this page describes the app. The site is covered in [The Public Site](#the-public-site-twiligent-site) below and in `docs/architecture/site/SITE.md`. Self-hosters only need the app project.
+
The React frontend is deployed to Cloudflare Pages. It is a static SPA - all routing is client-side (React Router), and the Cloudflare Pages `_redirects` file handles the SPA fallback.
## Build Configuration
@@ -14,7 +23,7 @@ The React frontend is deployed to Cloudflare Pages. It is a static SPA - all rou
| Root directory | `/` (repo root) |
| Node.js version | 22.18 or later (the root `package.json` `engines` field; the deploy workflow uses 24) |
-These are configured in the Cloudflare Pages project settings, not in a file. The repository is an npm workspaces monorepo: the install runs once at the root against the root `package-lock.json` (there is no lockfile in `frontend/`), and the root `build` script runs `npm run build --workspace frontend`.
+These are configured in the Cloudflare Pages project settings, not in a file. The repository is an npm workspaces monorepo: the install runs once at the root against the root `package-lock.json` (there is no lockfile in `frontend/`), and the root `build` script runs `npm run build --workspace frontend` and then `npm run build --workspace site`. The app's output is still `frontend/dist`; to build only the app, run `npm run build --workspace frontend`.
The build is `vite build` with `frontend/vite.config.ts`, starting from `frontend/index.html`, which loads `/src/main.tsx`. Vite strips the TypeScript types and does not check them, so a Pages build connected directly to the repository does not type-check. The GitHub Actions deploy runs `npm run typecheck --workspace frontend` and the frontend tests before it builds.
@@ -66,7 +75,9 @@ npx wrangler pages deploy dist --project-name=twiligent
The app is accessible at both:
- `twiligent.pages.dev` (Cloudflare Pages default)
-- Custom domain configured in Cloudflare Pages -> Custom domains
+- `app.twiligent.ujjwal.fyi`, the custom domain configured in Cloudflare Pages -> Custom domains
+
+`twiligent.ujjwal.fyi` belongs to the `twiligent-site` project, not the app. When the app moves to `app.twiligent.ujjwal.fyi`, these settings must name the app address: `FRONTEND_URL` and `ALLOWED_ORIGINS` on the Worker, the Supabase Auth site URL and redirect allow list, and the authorised JavaScript origins of the Google OAuth client. See `docs/workflows/DEPLOYMENT.md`.
The Worker's CORS policy only answers the origins it knows: `FRONTEND_URL` and the comma-separated `ALLOWED_ORIGINS` Worker secrets. Set `FRONTEND_URL` to the main address and list any other address the site is served from (such as `pages.dev` next to a custom domain) in `ALLOWED_ORIGINS`, or the browser blocks the API calls from that address. See `WORKERS.md`.
@@ -87,3 +98,34 @@ The frontend calls the Worker at `VITE_API_URL`, which defaults to `http://local
3. Set build command and output directory as above
4. Add environment variables (`VITE_SUPABASE_URL`, `VITE_SUPABASE_ANON_KEY`, `VITE_API_URL`)
5. Trigger the first deploy manually or push to `main`
+
+## The Public Site (`twiligent-site`)
+
+The marketing site and the docs are a second static SPA, built from the `site/` workspace and served at `twiligent.ujjwal.fyi`. It is the project's own public site: a self-hosted instance does not need it.
+
+| Setting | Value |
+|---|---|
+| Project name | `twiligent-site` |
+| Custom domain | `twiligent.ujjwal.fyi` |
+| Build command | `npm run build --workspace site` (after `npm ci` at the root) |
+| Build output directory | `site/dist` |
+| Environment variables | None. Every value the site shows is public and written in the source |
+
+`.github/workflows/deploy-site.yml` builds and uploads it with `wrangler pages deploy dist --project-name=twiligent-site` from `site/`; see `CI_CD.md`. Besides the Vite output, the build writes `sitemap.xml` and `llms.txt` into `site/dist`.
+
+**Redirects.** `site/public/_redirects` sends the app's old paths on this domain (`/login`, `/accounts`, `/settings`, `/upload`, `/videos`, `/shorts`, `/reels`, `/tracked-content`, `/reddit-posts`, `/reddit-tracked`, `/channel/*`, `/instagram/*`, `/reddit/*`) to the same path on `https://app.twiligent.ujjwal.fyi` with a 301, so bookmarks from before the move still work. The file has no `/* /index.html 200` line: the build has no top-level `404.html`, so Pages treats the project as a single-page application and serves `index.html` for every other path, where the site's router shows its own not found page.
+
+`site/public/robots.txt` allows every crawler and points at `https://twiligent.ujjwal.fyi/sitemap.xml`.
+
+Manual deployment, from the repository root:
+
+```bash
+npm ci
+npm run typecheck --workspace site
+npm run build --workspace site
+cd site
+npx wrangler pages deploy dist --project-name=twiligent-site
+```
+
+Create the project before the workflow's first run, because the workflow cannot answer Wrangler's prompt to create a missing project: run the manual deployment above once from a terminal, or run `npx wrangler pages project create twiligent-site --production-branch=main`. Then add `twiligent.ujjwal.fyi` in Cloudflare Pages -> `twiligent-site` -> Custom domains (after removing it from the `twiligent` project and adding `app.twiligent.ujjwal.fyi` there).
+
diff --git a/docs/architecture/database/SECURITY.md b/docs/architecture/database/SECURITY.md
index 6ae410b..98fbae1 100644
--- a/docs/architecture/database/SECURITY.md
+++ b/docs/architecture/database/SECURITY.md
@@ -37,7 +37,7 @@ alter table scheduled_posts enable row level security;
alter table tracked_posts enable row level security;
```
-This denies the anon and authenticated roles everything, while the service-role key used by the Worker and the GitHub Actions scheduler still bypasses RLS. The frontend never queries tables directly (it uses Supabase only for Auth), so no policies are needed. Supabase's Table Editor flags any table with RLS disabled. The setup SQL in the README and on the `/docs/self-host/supabase` page includes these statements.
+This denies the anon and authenticated roles everything, while the service-role key used by the Worker and the GitHub Actions scheduler still bypasses RLS. The frontend never queries tables directly (it uses Supabase only for Auth), so no policies are needed. Supabase's Table Editor flags any table with RLS disabled. The setup SQL in the README and on the public docs page `/docs/self-host/supabase` (`site/content/docs/self-host/supabase.mdx`) includes these statements.
## Signups
diff --git a/docs/architecture/frontend/DESIGN_SYSTEM.md b/docs/architecture/frontend/DESIGN_SYSTEM.md
index e8bfd7a..8c100c3 100644
--- a/docs/architecture/frontend/DESIGN_SYSTEM.md
+++ b/docs/architecture/frontend/DESIGN_SYSTEM.md
@@ -66,5 +66,5 @@ Shared components live in `frontend/src/components/`. Reach for these before wri
- Destructive actions go through `ConfirmDialog` with `hold`.
- Every async action disables its trigger, shows a spinner or progress, and ends in a toast that names what happened.
- Sentence case in all UI copy. No exclamation marks. Errors say what happened and what to do.
-- Lucide icons at 1.75 stroke. 18px in navigation, 16px in controls.
+- Lucide icons at 1.75 stroke. 18px in navigation, 16px in controls. (The public site in `site/` uses Solar icons instead; see `docs/architecture/site/SITE.md`.)
- New logic that can be pure goes in `src/lib/`, with its test at the mirrored path in `frontend/tests/` (`src/lib/library.ts` -> `frontend/tests/lib/library.test.ts`; run `npm test`).
diff --git a/docs/architecture/frontend/FEATURES.md b/docs/architecture/frontend/FEATURES.md
index 0af0816..df39c78 100644
--- a/docs/architecture/frontend/FEATURES.md
+++ b/docs/architecture/frontend/FEATURES.md
@@ -8,18 +8,10 @@ frontend/src/
│ ├── SurfaceBox.tsx, MetricBox.tsx, PageHeader.tsx, ... <- Shared components, see DESIGN_SYSTEM.md
│ ├── MetricAreaChart.tsx <- Shared Recharts area chart for single-metric comparisons
│ ├── ChartPanel.tsx <- Titled chart container with an empty state
-│ └── ImageLightbox.tsx <- Thumbnail that opens the full image in a Dialog
-├── docs/ <- Public documentation at /docs (outside the feature tree: no auth, no AppContext)
-│ ├── DocsLayout.tsx <- Page frame: theme, search shortcut, copy page, scroll to hash
-│ ├── DocsHeader.tsx, DocsSidebarNav.tsx, DocsMobileNav.tsx, DocsPager.tsx, DocsToc.tsx, DocsSearch.tsx
-│ ├── useTableOfContents.ts <- Collects page headings and tracks the one in view
-│ ├── components.tsx <- DocTitle, H2, H3, Callout, Steps, CodeBlock, Table, PathCards, Badge
-│ ├── nav.ts <- Tabs, groups and pages; the single source for navigation; firstPagePath(tab)
-│ ├── routes.ts <- Slug to lazy page map; nav.test.ts checks it matches nav.ts
-│ └── pages/ <- Overview, Use, SelfHost, Reference (one chunk each)
-│ ├── use/ <- One file per page plus AdminLink.tsx; Use.tsx re-exports them
-│ ├── reference/ <- One file per page; Reference.tsx re-exports them
-│ └── selfHost/ <- One file per self-hosting page plus selfHostSql.ts (selfHostSql.test.ts); SelfHost.tsx re-exports them
+│ ├── ImageLightbox.tsx <- Thumbnail that opens the full image in a Dialog
+│ └── DocsRedirect.tsx <- The /docs/* route: replaces the location with the same page on the public docs
+├── lib/
+│ └── docs.ts <- DOCS_URL and docsUrl(path): links from the app to the public docs
├── features/
│ ├── analytics/
│ │ ├── channel/
@@ -116,7 +108,9 @@ frontend/src/
│ └── reelsLibrary.ts <- Pure merge, filter, sort and totals (reelsLibrary.test.ts)
```
-Test files are not in this tree. A `(name.test.ts)` or `with *.test.ts` note above means the helper has a test in `frontend/tests/` at the mirrored path: `src/features/analytics/channel/channelChartData.ts` is covered by `frontend/tests/features/analytics/channel/channelChartData.test.ts`, and `src/docs/nav.ts` by `frontend/tests/docs/nav.test.ts`. See `docs/workflows/TESTING.md`.
+Test files are not in this tree. A `(name.test.ts)` or `with *.test.ts` note above means the helper has a test in `frontend/tests/` at the mirrored path: `src/features/analytics/channel/channelChartData.ts` is covered by `frontend/tests/features/analytics/channel/channelChartData.test.ts`. See `docs/workflows/TESTING.md`.
+
+The user and self-hosting documentation is not part of the app. It lives in the `site/` workspace and is served at `https://twiligent.ujjwal.fyi/docs`; see `docs/architecture/site/SITE.md`.
## Metric Naming
@@ -217,7 +211,7 @@ Each page manages its own loading/data/error state. Pages do not write to `AppCo
| Video Explorer | `/videos/:id` | YouTube video library with search and sort |
| Publish | `/upload` | Publish or schedule to Instagram, bulk upload, and the scheduled post queue |
| Settings | `/settings` | Theme, server key status, who sets up scheduling, the optional GitHub backup guide |
-| Documentation | `/docs` | Public guides for members and administrators, and the environment variable reference |
+| Documentation | `/docs/*` | Not a page in the app: `DocsRedirect` sends the visitor to the same path on the public docs at `https://twiligent.ujjwal.fyi/docs`. The Documentation item in the sidebar user menu and Open documentation in the command palette open the docs in a new tab |
## Adding a New Feature
diff --git a/docs/architecture/frontend/REACT_ARCHITECTURE.md b/docs/architecture/frontend/REACT_ARCHITECTURE.md
index 28b3234..5780daf 100644
--- a/docs/architecture/frontend/REACT_ARCHITECTURE.md
+++ b/docs/architecture/frontend/REACT_ARCHITECTURE.md
@@ -19,6 +19,8 @@
Visual tokens and shared components are described in `DESIGN_SYSTEM.md`.
+This page covers the app (`frontend/`). The public marketing site and docs are a separate workspace, `site/`, described in `docs/architecture/site/SITE.md`.
+
## TypeScript and Vite
Every file in `frontend/src` is `.ts`, or `.tsx` when it contains JSX. Vite (with `@vitejs/plugin-react` and `@tailwindcss/vite`, configured in `frontend/vite.config.ts`) strips the types while it serves and builds; it does not check them. `npm run typecheck` does:
@@ -59,6 +61,7 @@ ThemeProvider (next-themes) <- OS/user theme preference
Suspense (fallback=null)
RouterProvider
/login -> Login (no protection)
+ /docs/* -> DocsRedirect <- leaves the app for the public docs
/* ->
ProtectedRoute <- redirects to /login if no session
AppProvider <- accounts[], loading, showToast
@@ -87,6 +90,7 @@ frontend/src/
library.ts Filter tiers, paging, duration and engagement helpers
commandSearch.ts Command palette ranking
holdProgress.ts Hold-to-confirm timing
+ docs.ts DOCS_URL and docsUrl(path), links to the public docs on the site
services/
api.ts All backend HTTP calls
context/
@@ -107,6 +111,7 @@ frontend/src/
Header.tsx TopBar: breadcrumb, refresh all, theme toggle
components/
ProtectedRoute.tsx Auth guard component
+ DocsRedirect.tsx /docs/* route: sends old docs links to the same page on the public site
PageHeader.tsx, SurfaceBox.tsx, MetricBox.tsx, ... Shared components (see DESIGN_SYSTEM.md)
brand/ Logo and platform icons
ui/ shadcn generated components, restyled onto the tokens
diff --git a/docs/architecture/frontend/ROUTING.md b/docs/architecture/frontend/ROUTING.md
index ff19cf8..41b2863 100644
--- a/docs/architecture/frontend/ROUTING.md
+++ b/docs/architecture/frontend/ROUTING.md
@@ -8,8 +8,8 @@ The app uses React Router v6 in `frontend/src/App.tsx`. The router uses `Browser
| Path | Component | Notes |
|---|---|---|
-| `/login` | `Login.tsx` | Public - redirects to `/` if already authenticated |
-| `/docs`, `/docs/*` | `docs/DocsLayout.tsx` | Public documentation. Child routes come from `docsChildRoutes` in `docs/routes.ts`; unknown paths redirect to `/docs` |
+| `/login` | `Login.tsx` | Public - redirects to `/` if already authenticated. `?mode=signup` opens the sign-up form (the public site's Get started buttons link to `https://app.twiligent.ujjwal.fyi/login?mode=signup`) |
+| `/docs/*` | `components/DocsRedirect.tsx` | Public. The docs live on the public site; this route replaces the location with the same path and hash under `https://twiligent.ujjwal.fyi/docs` (`docsUrl()` in `lib/docs.ts`), so old links keep working |
| `/` (layout) | `AppLayout` (inline) | Protected - redirects to `/login` if unauthenticated |
| `/` (index) | `Overview.tsx` | Default page after login |
| `/accounts` | `AccountManager.tsx` | Connect and remove accounts. `?add=1` opens the add flow; `?ig_connected` and `?ig_error` report the Instagram OAuth result |
@@ -29,7 +29,7 @@ The app uses React Router v6 in `frontend/src/App.tsx`. The router uses `Browser
## Auth Guard
-Auth protection is applied via a `<ProtectedRoute>` component wrapping the layout route in `App.tsx`. All child routes are protected. `/login` and `/docs` are the only public routes.
+Auth protection is applied via a `<ProtectedRoute>` component wrapping the layout route in `App.tsx`. All child routes are protected. `/login` and `/docs/*` (the redirect to the public docs) are the only public routes.
## Lazy Loading
diff --git a/docs/architecture/site/SITE.md b/docs/architecture/site/SITE.md
new file mode 100644
index 0000000..78c4766
--- /dev/null
+++ b/docs/architecture/site/SITE.md
@@ -0,0 +1,208 @@
+# Public Site and Docs
+
+The `site/` workspace is the project's public website: a marketing home page and the user and self-hosting documentation. It is served at `https://twiligent.ujjwal.fyi` from the Cloudflare Pages project `twiligent-site`. The app itself runs at `https://app.twiligent.ujjwal.fyi` (see `docs/architecture/frontend/`).
+
+The site is static. It makes no API calls, needs no secrets and shares no code with the app at runtime. Self-hosters do not need it to run Twiligent; it exists so the project has one public home and one copy of the docs. The decision is recorded in ADR-035 in `DECISIONS.md`.
+
+## Stack
+
+| Concern | Library | Version |
+|---|---|---|
+| Language | TypeScript (`strict`) | 6.0 |
+| Framework | React | 19 |
+| Router | React Router (`react-router`) | 7 |
+| Build tool | Vite | 7 |
+| Styling | Tailwind CSS (`@tailwindcss/vite`) | 4 |
+| Animation | motion | 14 |
+| Docs pages | MDX (`@mdx-js/rollup`, `@mdx-js/react`) with `remark-gfm` | 3 |
+| Code highlighting | Shiki (`@shikijs/rehype`), at build time | 4 |
+| Docs search | MiniSearch | 7 |
+| Icons | Solar (`@iconify-json/solar`), generated into one file | - |
+| Fonts | Sora, Manrope, JetBrains Mono (self-hosted from `public/fonts`) | - |
+
+The site does not use shadcn/ui, next-themes or Lucide; those belong to the app.
+
+## Folder Map
+
+```
+site/
+ index.html Meta tags, favicons, font preloads, and the inline script that sets data-theme before paint
+ vite.config.ts MDX (before the React plugin), React, Tailwind, docsPlugin; @ alias to src/
+ build/
+ docsPlugin.ts Vite plugin: search index as virtual:docs-search, sitemap.xml and llms.txt in closeBundle
+ genIcons.ts Writes src/components/icons.tsx from @iconify-json/solar (npm run icons --workspace site)
+ content/docs/ One .mdx file per docs page; folders match the URL (self-host/redis.mdx is /docs/self-host/redis)
+ public/
+ _redirects 301s from the app's old paths to app.twiligent.ujjwal.fyi
+ robots.txt Allows every crawler; points at the sitemap
+ brand/ Logos, favicon, app icons and the share image, copied from the brand kit
+ fonts/ Latin woff2 files for the three brand families
+ src/
+ main.tsx Entry point: RouterProvider inside StrictMode
+ router.tsx Route table (see Routing)
+ index.css Fonts, brand palette, light and dark tokens, type styles, motion
+ pages/
+ Home.tsx Hero; everything below it is HomeBelow, loaded lazily
+ HomeBelow.tsx The home page sections in order
+ NotFound.tsx Marketing 404
+ components/
+ MarketingLayout.tsx Skip link, Navbar, page, Footer
+ Navbar.tsx, Footer.tsx, navLinks.ts, Pill.tsx, ThemeToggle.tsx, ScrollManager.tsx
+ brand.tsx Logo, Mark, RibbonCrop, FoldBand (the brand graphics)
+ marks.tsx Hand-written SVG logos for YouTube, Instagram, Reddit and GitHub
+ icons.tsx Generated Solar icons; never edited by hand
+ sections/ Home page sections: Story, Platforms, Faq, and the shared blocks (SectionHeader, FeatureSection, BentoCard, CtaBand)
+ mockups/ Product previews drawn in React (see Mockups and Motion): OverviewWindow, AnalyticsCard,
+ ScheduleCard, AreaChart, Cursor, Typed, CountUp, kit, sample, platforms; bento/ holds the
+ grid cards (Frame and one file per card)
+ docs/
+ DocsLayout.tsx Top bar with search, tabs, sidebar drawer on phones, page outlet
+ DocPage.tsx Loads one MDX page, sets its meta, shows Suggest edits, Raise issue and previous and next links
+ DocsSidebar.tsx Groups and pages of the current tab
+ nav.ts Tabs, groups and pages: the single source for docs navigation
+ Search.tsx Ctrl K or Cmd K search over the build-time index
+ searchShared.ts SearchDocument, the MiniSearch options and slugify(), shared by the plugin and the browser
+ Toc.tsx "On this page" outline of the h2 and h3 headings
+ mdx.tsx Heading, DocLink, CodeBlock, InlineCode, Callout, Steps, Step, Cards, Card, Badge
+ mdxComponents.tsx MDX_COMPONENTS: maps Markdown elements and the custom tags to the components above
+ virtual.d.ts Types the virtual:docs-search module
+ hooks/ useAutoplay, useElementSize, usePrefersReducedMotion
+ lib/
+ chart.ts Chart geometry: seriesRange, chartPoints, smoothPath (monotone cubic), areaPath
+ format.ts formatNumber(): 84,213, 18.4K, 5.2%
+ links.ts App, GitHub, edit, issue, changelog, licence and privacy URLs
+ seo.ts usePageMeta(): title, description, canonical URL, Open Graph and Twitter tags
+ theme.ts useTheme(): reads and toggles data-theme and saves the choice
+ cn.ts Class name joiner
+ tests/ Node tests in docs/ and lib/ (see Tests)
+```
+
+## Routing
+
+`src/router.tsx` uses `createBrowserRouter`:
+
+| Path | Element | Notes |
+|---|---|---|
+| `/` | `MarketingLayout` > `Home` | The home page ships with the first load |
+| `*` | `MarketingLayout` > `NotFound` | Lazy |
+| `/docs`, `/docs/*` | `DocsLayout` > `DocPage` | Both lazy; `DocPage` reads the slug from the path |
+
+Fallback: the build has no top-level `404.html`, so Cloudflare Pages serves `index.html` for any path that is not a file, and the router decides. A docs path with no content file shows a docs 404 inside the docs frame.
+
+Links to the app use the constants in `src/lib/links.ts`: `SIGN_IN_URL` (`https://app.twiligent.ujjwal.fyi/login`) and `SIGN_UP_URL` (the same with `?mode=signup`, which opens the app's sign-up form). Sign-up and sign-in only exist in the app.
+
+## Docs Pipeline
+
+**Pages.** Each page is `content/docs/<slug>.mdx`; `index.mdx` is the folder's own page (`content/docs/index.mdx` is `/docs`, `content/docs/self-host/index.mdx` is `/docs/self-host`). Every file starts with one line:
+
+```mdx
+export const meta = { title: 'Upstash Redis (optional)', description: 'Cache analytics and share rate limits across Worker instances.' }
+```
+
+The title and description become the page heading, the lead paragraph, the document title and the meta tags. The build plugin reads them with a regular expression, so keep the object on one line with single-quoted strings.
+
+**Components.** MDX files do not import anything. `DocPage` wraps the page in `MDXProvider` with `MDX_COMPONENTS`, which styles the Markdown elements (headings with anchor links, paragraphs, lists, tables, code) and makes `Callout`, `Steps`, `Step`, `Cards`, `Card` and `Badge` available as tags. A link that starts with `/` is a router link, a `#` link stays on the page, and any other link opens in a new tab. Code blocks get a copy button.
+
+**Navigation.** `src/docs/nav.ts` lists the tabs, the sidebar groups in each tab, and each page's slug, sidebar title and icon. The sidebar, the tabs, the group label above the page title and the previous and next links all come from it.
+
+**Loading.** `DocPage` finds pages with `import.meta.glob('/content/docs/**/*.mdx')`, so each page is its own chunk, loaded when it is opened.
+
+**Code highlighting.** `@shikijs/rehype` highlights code blocks at build time with the `github-light` and `github-dark` themes. With `defaultColor: false`, both themes are written as CSS variables, and `index.css` picks one by `data-theme`, so code switches with the rest of the page and no highlighter ships to the browser.
+
+**Search.** `build/docsPlugin.ts` splits every page into one entry for the text above the first heading and one per `##` and `###` heading, strips MDX syntax, and indexes the entries with MiniSearch (fields `title`, `page` and `text`; titles weigh most; prefix and fuzzy matching). The serialised index is served as the virtual module `virtual:docs-search`. `Search.tsx` imports it the first time someone searches, so it adds nothing to the first load, and each result links to the page with the heading's anchor. Anchors come from `slugify()` in `searchShared.ts`, which both the plugin and the `Heading` component use, so they always agree. In development, editing a page invalidates the module.
+
+**Sitemap and llms.txt.** After the bundle is written, the plugin writes `dist/sitemap.xml` (the marketing routes in `MARKETING_ROUTES` plus every docs page) and `dist/llms.txt` (a summary and a link with description to every docs page, following llmstxt.org). Both use `SITE_URL` from the plugin.
+
+## Theming
+
+The site has a light (paper) and a dark (dusk) theme, set by `data-theme` on `<html>`:
+
+- The inline script in `index.html` runs before paint: it uses the choice saved in `localStorage` under `twiligent-theme`, else the system setting, and falls back to dark when storage is not available.
+- `ThemeToggle` (in the navbar and the docs top bar) calls `useTheme()` from `src/lib/theme.ts`, which flips the attribute and saves the choice.
+- Tailwind's `dark:` variant is redefined to follow `[data-theme="dark"]`, not the media query.
+
+`src/index.css` holds the brand palette under its brand names (`twiligent-red`, `ember`, `oxblood`, `dusk`, `paper`, `afterglow`), the semantic tokens for each theme (`surface`, `surface-raised`, `surface-sunken`, `line`, `ink`, `ink-muted`, `accent`, `accent-text` and the rest), the type styles (`display`, `eyebrow`), the radii, the easing curves and the fold entrance animation. The values come from the brand kit's `frontend/public/tokens.json`; `docs/brand-notes.md` records which tokens, type sizes, logo rules, icon rules and voice the site takes from the kit. Components use the semantic tokens (`bg-surface`, `text-ink-muted`), never hex values; the platforms' own colours are only for their marks.
+
+The site keeps its own copy of the tokens rather than importing the app's `index.css`, so a token change in the brand kit must be made in both places.
+
+## Icons
+
+The site uses the Solar icon set (480 Design, CC BY 4.0, credited in `THIRD_PARTY_NOTICES.md`), chosen by the owner on 2026-10-15 to match Activepieces: the bold style for things and places, the linear style for small controls. The app keeps Lucide.
+
+`src/components/icons.tsx` is generated and is not edited by hand. To add an icon:
+
+1. Add a line to the `ICONS` list in `site/build/genIcons.ts`: the component name and the Solar icon name (for example `Calendar: 'calendar-bold'`).
+2. Run `npm run icons --workspace site`.
+3. Import it from `@/components/icons`.
+
+Each icon draws in `currentColor` at `1em`, so it takes its colour and size from the text beside it. Platform logos are not icons: they are hand-written SVG in `src/components/marks.tsx`.
+
+## Adding a Docs Page
+
+1. Create `site/content/docs/<section>/<name>.mdx`, starting with the `export const meta = { title: '...', description: '...' }` line.
+2. Add `{ slug: '<section>/<name>', title: '...', icon: ... }` to the right group in `site/src/docs/nav.ts`. The order in `nav.ts` sets the sidebar order and the previous and next links.
+3. Link to other pages with `/docs/...` paths; the content test checks that each one exists.
+4. Run `npm test --workspace site` and `npm run dev:site` to check the page, its outline and its search results.
+
+When a page moves or is renamed, update links to it in other pages and in the app (`docsUrl()` calls in `frontend/src`), and add a 301 line for the old path to `site/public/_redirects`. Pages follow `docs/WRITING_STANDARDS.md`: no em or en dashes, which the content test enforces.
+
+## Adding a Marketing Section or Page
+
+- A home page section is a component in `src/components/sections/`, built from the shared blocks in `blocks.tsx` (`SectionHeader`, `FeatureSection`, `BentoCard`, `CtaBand`), and placed in `src/pages/HomeBelow.tsx`. Product previews are React mockups in `src/components/mockups/`, not screenshots.
+- A new page is a component in `src/pages/`, a lazy child of the `MarketingLayout` route in `src/router.tsx`, with `usePageMeta()` for its title and description. Add its path to `MARKETING_ROUTES` in `build/docsPlugin.ts` so it is in the sitemap, and to `navLinks.ts` or the footer if it should be linked.
+- Motion follows `docs/brand-notes.md`: the fold entrance along the 60 degree diagonal, colour-only hover, and a plain fade when the visitor prefers reduced motion (`usePrefersReducedMotion`).
+
+## Mockups and Motion
+
+The product previews are React components drawn with the site's tokens, never screenshots, and every number in them comes from `mockups/sample.ts` (one made-up creator, Northwind Kitchen) so the pictures agree with each other. Each preview is one `role="img"` with an `aria-label` that describes what it shows.
+
+- **Loops:** `useAutoplay(ref, durations)` steps a preview through numbered phases while at least 35% of it is on screen, then loops. It returns `phase`, `loop` (finished loops, used as a `key` to restart typing, counting and charts) and `reduce`. Under reduced motion the preview shows its last phase and stays there.
+- **Cursor:** `Cursor` glides between elements marked `data-cursor="<name>"` inside its stage (the element passed as `stage`, which must also be the cursor's positioned parent), and clicks when its `clicks` count goes up. Timings follow the Activepieces previews: a 0.72s glide on `cubic-bezier(.5,.02,.2,1)`, a 0.26s fade, a press to 0.82 scale and a ring that grows from 0.35 to 1.9 while fading over 0.48s. In a bento card, pass it as the `Frame`'s `overlay`.
+- **Charts:** `AreaChart` measures its box and draws at real pixels (no stretched SVG), with a monotone curve from `lib/chart.ts` that never overshoots its data, a gradient fill, a dot on the latest point, optional `focus` with a guide line and tooltip, and `anchors` (`data-cursor="point-<n>"`) for a cursor to move along the line. It animates in CSS only (`chart-play`, `chart-line`, `chart-fill`, `chart-dot` in `index.css`), so the hero uses it without loading motion.
+- **Text and numbers:** `Typed` types text with a blinking caret; `CountUp` counts a number up in fixed-width digits. Numbers never fade in blurred.
+- **Hero:** `OverviewWindow` uses CSS animations only (`rise-in`, `grow-x`, the chart classes) with `--delay` for the stagger, because the hero is in the first bundle and motion is not.
+- **Bento cards:** `bento/Frame` is a small app window that fills its panel and is cut off by the panel's lower edge. Its body is laid out on its own, so a long list never makes the grid row taller. Each card has one live detail (a row arriving, a log streaming, a run completing, a filter clicked).
+- **Reduced motion:** `HomeBelow` wraps the page in `MotionConfig reducedMotion="user"`; `useAutoplay` holds the last phase; the CSS animations switch off under `prefers-reduced-motion`; cursors stay hidden.
+
+## Deploy
+
+| | |
+|---|---|
+| Pages project | `twiligent-site` |
+| Address | `https://twiligent.ujjwal.fyi` |
+| Build | `npm run build --workspace site` (after `npm ci` at the root) |
+| Output | `site/dist` (the Vite build plus `sitemap.xml` and `llms.txt`) |
+| Secrets | None in the build; the workflow needs only `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` |
+| Workflow | `.github/workflows/deploy-site.yml`, on pushes to `main` that touch `site/**`, `tsconfig.base.json`, the root `package.json` or `package-lock.json`, or the workflow itself |
+
+`site/public/_redirects` sends the app's old paths on this domain (`/login`, `/accounts`, `/settings`, `/upload`, `/videos`, `/shorts`, `/reels`, `/tracked-content`, `/reddit-posts`, `/channel/*`, `/instagram/*`, `/reddit/*` and others) to the same path on `https://app.twiligent.ujjwal.fyi` with a 301. In the other direction, the app's `/docs/*` route sends old docs links to the same page here. See `docs/architecture/cloudflare/PAGES.md`, `docs/architecture/cloudflare/CI_CD.md` and `docs/workflows/DEPLOYMENT.md`.
+
+## TypeScript and Lint
+
+| Config | Checks |
+|---|---|
+| `site/tsconfig.json` | `site/src`: DOM lib, `jsx: react-jsx`, `vite/client` and `mdx` types, `@/*` path |
+| `site/tsconfig.node.json` | `vite.config.ts`, `build/`, `tests/`: Node types |
+
+`npm run typecheck --workspace site` runs both. MDX files are not type-checked. In `eslint.config.mjs`, `site/**` gets the React hooks and React Refresh rules with browser globals, and `vite.config.ts`, `build/**` and `tests/**` get Node globals.
+
+## Tests
+
+`npm test --workspace site` runs `node --test "tests/**/*.test.ts"`:
+
+| Test | Checks |
+|---|---|
+| `tests/docs/content.test.ts` | Every page in `nav.ts` has a content file and every content file is in `nav.ts`; slugs are unique; every page starts with a `meta` export with a title and description; every `/docs/...` link points at a page that exists; no page uses an em or en dash |
+| `tests/docs/searchShared.test.ts` | `slugify()` turns headings into anchor ids |
+| `tests/lib/chart.test.ts` | The value range is padded; points spread across the box; the smooth path passes through every point and never overshoots between two; the area closes to the baseline |
+| `tests/lib/format.test.ts` | Full numbers get separators, short numbers use K and M and drop a zero decimal, rates keep one decimal |
+
+`content.test.ts` reads `nav.ts` as text, because `nav.ts` imports the generated JSX icons, which Node cannot load. The root `npm test`, `npm run typecheck` and `npm run build` include the site, so `ci.yml` checks it on every pull request.
+
+## Local Development
+
+```bash
+npm run dev:site
+```
+
+This starts Vite for the site alone. It does not need the Worker or any environment file. `npm run preview --workspace site` serves a production build from `site/dist`.
diff --git a/docs/brand-notes.md b/docs/brand-notes.md
new file mode 100644
index 0000000..e0df9b4
--- /dev/null
+++ b/docs/brand-notes.md
@@ -0,0 +1,109 @@
+# Brand Notes for the Website
+
+What the marketing and docs site takes from the Twiligent brand kit. Activepieces sets the structure; this file sets the surface. Sources: `frontend/public/brand-guidelines.md`, `frontend/public/tokens.json`, `frontend/public/Logos/README.md`, `frontend/public/App icons/README.md` and the font files in `frontend/public/fonts/`.
+
+The kit has no guideline page images, banners or photography. The guidelines mention "Logo usage" and "Applications" pages, but those pages are not in the repository, so the rules below come from the written guidelines only.
+
+## Palette
+
+The palette is the ribbon: a red lit face folding into shadow, set on dusk and paper, with one warm accent.
+
+| Brand name | Hex | Role | Rules |
+|---|---|---|---|
+| `twiligent-red` | `#C11F2F` | Primary fills, the mark, key highlights | White text on it holds 5.9:1. Never as text on dusk (3.2:1, fails): use `accent-text` |
+| `ember` | `#9A1423` | Mid fold; hover of red fills on light; gradient middle stop | |
+| `oxblood` | `#5E0B14` | Deep fold; large dark brand fields; gradient end | White text holds 12:1 |
+| `dusk` | `#140E10` | Warm near-black: dark ground, light-theme ink | |
+| `paper` | `#F7F3EF` | Warm off-white: light ground | |
+| `afterglow` | `#E8A33D` | The one accent: highlights, second data series, badges | A fill or stroke only; as text always `afterglow-text` |
+
+Semantic tokens (light / dark), each with its contrast note from `tokens.json`:
+
+| Token | Light | Dark | Note |
+|---|---|---|---|
+| `surface` | paper `#F7F3EF` | dusk `#140E10` | Page ground |
+| `surface-raised` | `#FFFFFF` | `#1F1719` | Cards, menus, inputs |
+| `surface-sunken` | `#EFE8E3` | `#0C0809` | Wells, code blocks |
+| `line` | `#E2D8D3` | `#3A2F33` | Hairlines, card borders |
+| `line-strong` | `#8C7E83` | `#86777C` | Control borders, 3:1 |
+| `dusk-panel` | dusk | `#2A1D21` | Dark feature panels in both themes |
+| `ink` | dusk | `#F5EFEB` | Body text |
+| `ink-muted` | `#5F5357` | `#B8ABAF` | Secondary text |
+| `accent` | red | red | Button fill; text on it is `on-accent` white |
+| `accent-hover` | ember | `#D93444` | |
+| `accent-text` | `#B01C2B` | `#FF7A82` | Red as text, links |
+| `accent-soft` | `#FBE7E8` | `#3A1419` | Behind `accent-text` |
+| `afterglow-text` / `-soft` | `#7F4C00` / `#FCEFD9` | `#F2B65E` / `#3A2A12` | |
+| `success`, `info` (+ soft) | `#1E7349`, `#2C5A99` | `#5FCB95`, `#8DB3EC` | Always with a word or icon |
+| `danger` | = `accent-text` | = `accent-text` | Errors share the brand red, so they always carry an icon and a word |
+| `focus-ring` | `#C11F2F` | `#FF7A82` | 2px solid, 2px offset |
+
+- **Proportion on brand surfaces:** about 60% paper or dusk, 30% red/ember/oxblood, 10% afterglow and muted details.
+- **The only gradient** is `fold-gradient`: `linear-gradient(120deg, #C11F2F 0%, #C11F2F 35%, #9A1423 70%, #5E0B14 100%)`. Hero bands, covers and social only; never behind paragraphs, never mixed with other hues.
+- **Charts** use series in the order red, ink-muted, afterglow, info, oxblood, with one series highlighted in red.
+- The palette already has a "failed" colour (`danger`), so no extra danger colour is added.
+
+## Typography
+
+| Role | Family and weight | Scale (size / leading / tracking) |
+|---|---|---|
+| `display-xl` | Sora 600 | 64 / 68, -0.03em. One per page: the hero |
+| `display` | Sora 600 | 44 / 50, -0.025em. Page and section titles on marketing pages |
+| `h1` | Sora 600 | 32 / 40, -0.02em |
+| `h2` | Sora 600 | 24 / 32, -0.015em. Card titles in marketing |
+| `h3` | Sora 600 | 19 / 26, -0.01em |
+| `body-lg` | Manrope 400 | 18 / 28. Leads and marketing body |
+| `body` | Manrope 400 | 16 / 24 |
+| `small` | Manrope 500 | 14 / 20 |
+| `eyebrow` | Manrope 700 | 12 / 16, +0.12em, uppercase: the only uppercase text |
+| `code` | JetBrains Mono 400 | 14 / 22. Code, commands, IDs, numbers in tables |
+
+- **Case:** sentence case everywhere, headings and buttons included. Display text is not uppercase.
+- **Headline length:** the guidelines set no maximum line count. The site caps hero and section headlines at three lines on desktop and four on phones, and pairs each headline with at most one supporting paragraph before a visual break.
+- **Body line length:** 60 to 75 characters.
+- **Files:** Sora 600 and 700, Manrope 400 to 700, JetBrains Mono 400 and 500, all latin woff2, all SIL Open Font License 1.1, so self-hosting on the web is allowed. Sora has two real weights, so no `font-weight: 100 900` range is needed.
+
+## Logo
+
+- **Primary:** `twiligent-lockup-horizontal.svg` on paper or white; `twiligent-lockup-horizontal-reversed.svg` (white word) on dusk. The site swaps them with the theme.
+- **Single colour:** the white files on red, the fold gradient or photography; the dusk file for one-ink print.
+- **Mark alone:** `twiligent-mark-color.svg`; single-colour `-red`, `-dusk`, `-white` below 24px and on any coloured ground. The mark is only red, dusk or white.
+- **Clear space:** one ribbon thickness, about 18% of the mark height, on every side.
+- **Minimum size:** lockup 24px tall on screen, mark 16px. Below 24px use a single-colour mark.
+- **Never:** stretch, rotate, recolour, glow, shadow, outline, put the colour mark on red, or retype the wordmark.
+- **Copy:** call it "the ribbon", never "the triangle". Write "Twiligent" with a capital T only.
+- **Favicon:** `twiligent-favicon.svg` (red mark on dusk) with the 32px PNG and the 180px Apple touch icon (`twiligent-app-icon-dusk-180.png`).
+
+## Corners, Shapes and Graphics
+
+- **Radius:** capsules (`999px`) for buttons, badges and tags, echoing the ribbon's rounded ends; cards 16px; hero media and large feature blocks 24px; menus and tiles 10px; inputs and code blocks 6px. Nothing interactive has square corners.
+- **Spacing:** 4px base; 48px between sections, 64 to 96px on marketing pages.
+- **Shadows:** borders first; `shadow-md` only for hover and floating menus, `shadow-lg` for dialogs.
+- **The one diagonal:** the ribbon's 60 degree angle, for cropped graphic bands, image masks and dividers. No other angles.
+- **Graphic elements:** large crops of the ribbon in a single colour at 10 to 15% white on red or dusk, and 60 degree capsule bands from the cover. The ribbon stays whole and unstretched; crops bleed off an edge rather than cutting the mark into an unreadable sliver. No AI-brain or circuit imagery, no blue-purple gradients, no 3D renders of the mark.
+- **Photography:** none in the kit; the site uses brand graphics and product mockups instead.
+
+## Icons and Motion
+
+- **Icons:** the guidelines name Lucide at 1.75 stroke. On the website the owner chose the Solar set instead (2026-10-15), as Activepieces uses it: the bold style for things and places, the linear style (1.5 stroke, round caps) for small controls. Solar is by 480 Design under CC BY 4.0, credited in `THIRD_PARTY_NOTICES.md` at the repository root (the owner removed the footer credit line on 2026-10-15). Sizes stay 18px in buttons, 20px in navigation, 24px standalone, in the colour of the text beside them. The app keeps Lucide. No emoji.
+- **The fold:** elements enter by sliding 8 to 16px along the 60 degree diagonal while fading in, 220ms, `cubic-bezier(0.2, 0.8, 0.2, 1)`.
+- **Hover and press:** colour changes only, 150ms. No bounces, no spinning the mark.
+- **Reduced motion:** movement becomes a plain fade.
+- Larger scroll effects borrowed from Activepieces keep these rules: no rotation of the mark, the diagonal for slides, blur and fade for text.
+- **Product previews:** measured from the Activepieces previews and reused as they are. A cursor glides 0.72s on `cubic-bezier(.5,.02,.2,1)`, fades 0.26s, presses to 0.82 scale with a ring growing from 0.35 to 1.9 over 0.48s. Menus open in 0.36s on `cubic-bezier(.16,1,.3,1)` from 10px and 0.95 scale, and close in 0.2s. Content swaps fade over 0.26s from 4px. Charts draw their line in 1.6s with the fill rising after it; numbers count up and are never shown blurred. Each preview loops in 8 to 17 seconds and only while on screen.
+
+## Voice
+
+- Short declarative sentences; the outcome first, then the detail.
+- "We" for Twiligent, "you" for the reader; never "users".
+- Sentence case; no exclamation marks, emoji or hype words ("revolutionary", "magic", "10x").
+- At most one light metaphor per screen (dusk, glow, fold, edge).
+- Errors say what happened and what to do.
+- **Tagline:** "Intelligence, folded into everything." for the site hero, covers and social; never in product UI.
+- **Promise:** clarity from many sources, folded into one picture.
+- **Personality:** sharp, not cold; calm, not quiet; warm, not cute.
+- The project rules also ban em dashes, en dashes and diagonal arrows.
+
+## Theme
+
+The brand defines both a dusk and a paper theme. The site follows the system setting and has a toggle, like the app: dusk is the default when the system gives no preference, matching the brand's decks, social and app icon.
diff --git a/docs/features/NEW_DATABASE_TABLE.md b/docs/features/NEW_DATABASE_TABLE.md
index 45ed179..69a6ef5 100644
--- a/docs/features/NEW_DATABASE_TABLE.md
+++ b/docs/features/NEW_DATABASE_TABLE.md
@@ -50,7 +50,7 @@ The backend uses the service-role key, which bypasses RLS. Every application tab
ALTER TABLE content_drafts ENABLE ROW LEVEL SECURITY;
```
-Add the statement to the setup SQL in the README and on the `/docs/self-host/supabase` page (`frontend/src/docs/pages/selfHost/selfHostSql.ts`).
+Add the statement to the setup SQL in the README and in the SQL block of the public docs page `/docs/self-host/supabase` (`site/content/docs/self-host/supabase.mdx`). Add the `CREATE TABLE` there too, so a new instance gets the table.
### Step 4: Add the Types
diff --git a/docs/guidelines/CODE_STYLE.md b/docs/guidelines/CODE_STYLE.md
index aed7bff..9543416 100644
--- a/docs/guidelines/CODE_STYLE.md
+++ b/docs/guidelines/CODE_STYLE.md
@@ -19,7 +19,7 @@ When this page and the code disagree, the code in the newest reviewed files wins
Prettier settings in `.prettierrc.json` and `.editorconfig` describe the layout; match the file you edit rather than reformatting it.
-| | Backend, scripts | Frontend, docs TSX |
+| | Backend, scripts | Frontend, site |
|---|---|---|
| Indentation | 4 spaces | 2 spaces |
| Quotes | single | single (JSX attributes use double) |
@@ -124,6 +124,7 @@ export default function LoginEmailForm({ copy, email, onEmailChange, loading, on
- Icons are Lucide with `data-icon="inline-start"` or `inline-end` in buttons.
- When markup repeats in two places, extract it (`PasswordInput.tsx` for the password field with its show button) rather than copying it.
- Copy that changes by mode lives in a typed table (`loginCopy.ts`, `LOGIN_COPY: Record<LoginMode, LoginCopy>`).
+- The public site (`site/`) follows the same React rules without shadcn: it has its own tokens in `site/src/index.css` and uses the Solar icons from `@/components/icons`, never Lucide. See `docs/architecture/site/SITE.md`.
## Tests
@@ -137,6 +138,7 @@ Rules in `docs/workflows/TESTING.md`.
## Docs and Commits
- Docs follow `docs/WRITING_STANDARDS.md`: short declarative sentences, tables for structured facts, code blocks for commands, no marketing words.
+- User and self-hosting docs are MDX pages in `site/content/docs/`; engineering docs stay in `docs/`. Adding or moving a docs page is in `docs/architecture/site/SITE.md`.
- Commits follow `docs/workflows/GIT.md`: `type(scope): imperative summary`, a body that says why, and `Refs #N` or `Closes #N`. No AI attribution lines.
- Every change is tracked by an issue (`docs/workflows/ISSUES.md`) and lands on `main` through a pull request that passed CI.
diff --git a/docs/guidelines/TYPESCRIPT.md b/docs/guidelines/TYPESCRIPT.md
index bdd420f..0e3e48a 100644
--- a/docs/guidelines/TYPESCRIPT.md
+++ b/docs/guidelines/TYPESCRIPT.md
@@ -2,7 +2,7 @@
Start with `docs/guidelines/CODE_STYLE.md`, which shows how code reads across the repository and ends with the checklist to run before every commit; this page has the detailed rules for its area.
-The whole project is TypeScript in `strict` mode: the Worker (`backend/`), the React app (`frontend/`), the shared API types (`shared/types/`), the scheduled publisher (`scripts/`) and every test. These rules apply everywhere.
+The whole project is TypeScript in `strict` mode: the Worker (`backend/`), the React app (`frontend/`), the public site (`site/`), the shared API types (`shared/types/`), the scheduled publisher (`scripts/`) and every test. These rules apply everywhere.
Nothing compiles TypeScript to JavaScript ahead of time. Wrangler and Vite strip the types while bundling, and Node strips them when it runs the tests and the publisher script. Type checking is a separate step, `npm run typecheck`, which CI runs before every deploy.
@@ -17,6 +17,8 @@ Shared settings live in `tsconfig.base.json` at the root; each project extends i
| `backend/tests/tsconfig.json` | Backend tests and the source they import | adds `node` types |
| `frontend/tsconfig.json` | `frontend/src` | DOM lib, `jsx: react-jsx`, `vite/client` types, `@/*` and `@shared/*` paths |
| `frontend/tsconfig.node.json` | `vite.config.ts`, `frontend/tests` | `node` types, DOM lib |
+| `site/tsconfig.json` | `site/src` | DOM lib, `jsx: react-jsx`, `vite/client` and `mdx` types, `@/*` path |
+| `site/tsconfig.node.json` | `site/vite.config.ts`, `site/build`, `site/tests` | `node` types |
| `scripts/tsconfig.json` | `scripts/` | `node` types |
`npm run typecheck` at the root runs all of them. The project uses TypeScript 6.0: TypeScript 7 (the native compiler) is not yet supported by `typescript-eslint`.
@@ -103,7 +105,7 @@ export default function ChannelHeader({ account, onRefresh }: ChannelHeaderProps
## Module System
-ES modules everywhere (`"type": "module"` in both workspaces). Use `import`/`export`, never `require()`.
+ES modules everywhere (`"type": "module"` in every workspace). Use `import`/`export`, never `require()`.
## File Conventions
@@ -192,11 +194,11 @@ Do not leave unused variables, imports, types or commented-out code. Remove them
## Lint and Format
-The tooling config lives once at the repository root and covers both apps:
+The tooling config lives once at the repository root and covers every workspace:
| File | What it sets |
|---|---|
-| `eslint.config.mjs` | ESLint flat config. Every `.ts`/`.tsx` file: ESLint recommended plus `typescript-eslint` recommended (`no-explicit-any` is an error). Frontend: React hooks and React Refresh rules with browser globals. Backend: service worker globals (the Worker has no Node APIs). Tests, `scripts/` and `vite.config.ts`: Node globals. |
+| `eslint.config.mjs` | ESLint flat config. Every `.ts`/`.tsx` file: ESLint recommended plus `typescript-eslint` recommended (`no-explicit-any` is an error). Frontend and site: React hooks and React Refresh rules with browser globals. Backend: service worker globals (the Worker has no Node APIs). Tests, `scripts/`, `vite.config.ts` and `site/build/`: Node globals. |
| `tsconfig.base.json` | Shared compiler settings; see Compiler Settings above |
| `.prettierrc.json` | Single quotes, semicolons, trailing commas, `arrowParens: "avoid"`, 120 columns, 2-space indentation, 4 spaces in `backend/` |
| `.prettierignore` | Skips `node_modules`, build output, `package-lock.json`, the shadcn files in `frontend/src/components/ui`, the backend golden snapshots and Markdown |
diff --git a/docs/workflows/DEPLOYMENT.md b/docs/workflows/DEPLOYMENT.md
index 4167f35..a67756f 100644
--- a/docs/workflows/DEPLOYMENT.md
+++ b/docs/workflows/DEPLOYMENT.md
@@ -7,20 +7,22 @@ A pull request merged into `main` -> GitHub Actions deploys automatically. `main
| What changed | Workflow that runs | What it deploys |
|---|---|---|
| `backend/**` | `deploy-backend.yml` | Cloudflare Worker |
-| `frontend/**` | `deploy-frontend.yml` | Cloudflare Pages |
-| Both | Both workflows | Both (in parallel) |
-| `shared/**` or `tsconfig.base.json` | Both workflows | Both (in parallel) |
-| Root `package.json` or `package-lock.json` | Both workflows | Both (in parallel) |
-| `docs/`, `scripts/`, `*.md` | Neither | Nothing deployed |
+| `frontend/**` | `deploy-frontend.yml` | The app on Cloudflare Pages (`twiligent`) |
+| `site/**`, including the docs pages in `site/content/docs/` | `deploy-site.yml` | The public site on Cloudflare Pages (`twiligent-site`) |
+| `backend/**` and `frontend/**` | Both workflows | Both (in parallel) |
+| `shared/**` | Backend and frontend workflows | Worker and app (in parallel) |
+| `tsconfig.base.json` | All three workflows | Worker, app and site (in parallel) |
+| Root `package.json` or `package-lock.json` | All three workflows | Worker, app and site (in parallel) |
+| `docs/`, `scripts/`, root `*.md` | None | Nothing deployed |
Monitor deployment status at:
`https://github.com/spacesdrive/twiligent/actions`
-Both deploy workflows set up Node 24, run `npm ci` once at the repository root (the root `package-lock.json` is the only lockfile), type-check and test their workspace (`npm run typecheck --workspace <app>`, `npm test --workspace <app>`), and only then deploy with the Wrangler version pinned in that lockfile. A type error or failing test stops the deploy. Before code reaches `main`, `ci.yml` runs the full type check, lint, tests, frontend build and a Worker dry-run bundle on every pull request and branch push. See `docs/architecture/cloudflare/CI_CD.md`.
+Each deploy workflow sets up Node 24, runs `npm ci` once at the repository root (the root `package-lock.json` is the only lockfile), type-checks and tests its workspace (`npm run typecheck --workspace <name>`, `npm test --workspace <name>`), and only then deploys with the Wrangler version pinned in that lockfile. A type error or failing test stops the deploy. Before code reaches `main`, `ci.yml` runs the full type check, lint, tests, the frontend and site builds and a Worker dry-run bundle on every pull request and branch push. See `docs/architecture/cloudflare/CI_CD.md`.
## Manual Deployment (Local)
-The repository is an npm workspaces monorepo. Install once at the root; never run `npm install` inside `backend/` or `frontend/`:
+The repository is an npm workspaces monorepo. Install once at the root; never run `npm install` inside `backend/`, `frontend/` or `site/`:
```bash
npm ci
@@ -52,7 +54,17 @@ cd frontend
npx wrangler pages deploy dist --project-name=twiligent
```
-`npm run build` at the root builds the frontend workspace into `frontend/dist/`.
+`npm run build` at the root builds the frontend workspace into `frontend/dist/` and then the site into `site/dist/`. `npm run build --workspace frontend` builds the app alone.
+
+### Public site (Cloudflare Pages)
+
+```bash
+npm run build --workspace site
+cd site
+npx wrangler pages deploy dist --project-name=twiligent-site
+```
+
+The site needs no environment variables or secrets. Self-hosters can skip this step: the site is the project's own marketing site and docs, not part of a running instance. See `docs/architecture/cloudflare/PAGES.md`.
## Setting Worker Secrets
@@ -80,13 +92,13 @@ npx wrangler secret put EMAIL_DAILY_LIMIT # optional; defaults to 100
Each command prompts for the value (no echo - the value is not shown).
-`FRONTEND_URL` is also the browser origin the API accepts: CORS answers only `FRONTEND_URL` and the origins listed in `ALLOWED_ORIGINS`. Set `ALLOWED_ORIGINS` when the app is served from more than one address (for example a custom domain and the `pages.dev` address), and update `FRONTEND_URL` when the domain changes, or the browser blocks every API call.
+`FRONTEND_URL` is also the browser origin the API accepts: CORS answers only `FRONTEND_URL` and the origins listed in `ALLOWED_ORIGINS`. Set `ALLOWED_ORIGINS` when the app is served from more than one address (for example a custom domain and the `pages.dev` address), and update `FRONTEND_URL` when the domain changes, or the browser blocks every API call. Both name the app's address (`https://app.twiligent.ujjwal.fyi` for the project's own instance), not the public site, which makes no API calls.
-The email secrets only matter once Supabase's Send Email hook points at `https://<worker>/api/auth/email-hook`. Set them before turning the hook on: while the hook is on and the secrets are missing, every sign-up and password reset fails with a 503. The full setup (Resend domain, hook, **Confirm email**, rate limit) is in the in-app guide at `/docs/self-host/email-codes`. To check the hook after a deploy, sign up with an address you own and watch `npx wrangler tail` for the `auth email sent` line. Keep Resend's click and open tracking off: its tracking record once took the name `twiligent` and replaced the Pages record for `twiligent.ujjwal.fyi`, which took the site offline until the record was pointed back at `twiligent.pages.dev` (proxied) and the Pages custom domain was reactivated (#37).
+The email secrets only matter once Supabase's Send Email hook points at `https://<worker>/api/auth/email-hook`. Set them before turning the hook on: while the hook is on and the secrets are missing, every sign-up and password reset fails with a 503. The full setup (Resend domain, hook, **Confirm email**, rate limit) is in the public docs at `https://twiligent.ujjwal.fyi/docs/self-host/email-codes` (source: `site/content/docs/self-host/email-codes.mdx`). To check the hook after a deploy, sign up with an address you own and watch `npx wrangler tail` for the `auth email sent` line. Keep Resend's click and open tracking off: its tracking record once took the name `twiligent` and replaced the Pages record for `twiligent.ujjwal.fyi`, which took the site offline until the record was pointed back at `twiligent.pages.dev` (proxied) and the Pages custom domain was reactivated (#37). That name now belongs to the public site; the same care applies to the `app.twiligent` record.
## Setting GitHub Actions Secrets
-Required for `deploy-frontend.yml` and `publish-scheduled.yml`:
+Required for `deploy-frontend.yml`, `deploy-backend.yml`, `deploy-site.yml` and `publish-scheduled.yml`:
1. GitHub -> repository -> Settings -> Secrets and variables -> Actions
2. Click "New repository secret" for each:
@@ -104,6 +116,10 @@ Required for `deploy-frontend.yml` and `publish-scheduled.yml`:
- `CLOUDFLARE_API_TOKEN`
- `CLOUDFLARE_ACCOUNT_ID`
+**For site deploy:**
+- `CLOUDFLARE_API_TOKEN`
+- `CLOUDFLARE_ACCOUNT_ID`
+
**For scheduled publisher only:**
- `SUPABASE_URL`
- `SUPABASE_SERVICE_KEY`
@@ -117,18 +133,41 @@ Required for `deploy-frontend.yml` and `publish-scheduled.yml`:
curl -i https://twiligent.ujjwalkrai.workers.dev/api/health
# Expected: 200 with {"status":"ok","timestamp":"2025-..."} and an X-Request-Id header
-curl -i -H "Origin: https://twiligent.ujjwal.fyi" https://twiligent.ujjwalkrai.workers.dev/api/health
-# Expected: Access-Control-Allow-Origin: https://twiligent.ujjwal.fyi (the FRONTEND_URL origin)
+curl -i -H "Origin: https://app.twiligent.ujjwal.fyi" https://twiligent.ujjwalkrai.workers.dev/api/health
+# Expected: Access-Control-Allow-Origin: https://app.twiligent.ujjwal.fyi (the FRONTEND_URL origin)
```
A request with any other `Origin` gets no `Access-Control-Allow-Origin` header. The Worker writes one JSON log line per request with its request id; use `npx wrangler tail` from `backend/` to watch them, and search for the id a user quotes from an error message.
-**Frontend:**
-Open `https://twiligent.ujjwal.fyi` (custom domain on the `twiligent` Pages project; `twiligent.spacesdrive.cc` 301-redirects here) -> verify login page loads -> sign in -> verify accounts load.
+**Frontend (the app):**
+Open `https://app.twiligent.ujjwal.fyi` (custom domain on the `twiligent` Pages project) -> verify login page loads -> sign in -> verify accounts load. Open `https://app.twiligent.ujjwal.fyi/login?mode=signup` -> verify the sign-up form opens. Open `https://app.twiligent.ujjwal.fyi/docs/use/publishing` -> verify it lands on the same page of the public docs.
+
+**Public site:**
+Open `https://twiligent.ujjwal.fyi` (custom domain on the `twiligent-site` Pages project; `twiligent.spacesdrive.cc` 301-redirects here) -> verify the home page renders in light and dark (the theme toggle in the navbar) -> open `/docs`, press Ctrl K and search for `redis` -> open a result. Check that `/sitemap.xml` and `/llms.txt` load and that `https://twiligent.ujjwal.fyi/settings` redirects to `https://app.twiligent.ujjwal.fyi/settings`.
**Scheduled publisher:**
GitHub Actions -> "Instagram Scheduled Publisher" -> "Run workflow" -> check run output.
+## Addresses: Site and App
+
+The project's own deployment uses two addresses:
+
+| Address | Pages project | Serves |
+|---|---|---|
+| `https://twiligent.ujjwal.fyi` | `twiligent-site` | Marketing site and docs (`site/`) |
+| `https://app.twiligent.ujjwal.fyi` | `twiligent` | The app (`frontend/`) |
+
+The app used to be served at `twiligent.ujjwal.fyi`. Moving it is a one-time change made by the owner when the site first ships, in this order:
+
+1. Create the `twiligent-site` Pages project (see `docs/architecture/cloudflare/PAGES.md`) and run `deploy-site.yml` once.
+2. In Cloudflare Pages, add `app.twiligent.ujjwal.fyi` as a custom domain of the `twiligent` project, then move `twiligent.ujjwal.fyi` from `twiligent` to `twiligent-site`.
+3. On the Worker, set `FRONTEND_URL` to `https://app.twiligent.ujjwal.fyi` and list any other app address in `ALLOWED_ORIGINS` (run from `backend/`: `npx wrangler secret put FRONTEND_URL`). Instagram sign-in returns members to `FRONTEND_URL`.
+4. In Supabase, Authentication -> URL Configuration: set the site URL to `https://app.twiligent.ujjwal.fyi` and add it to the redirect allow list. The password reset link returns to `/settings` on the address the request came from, so that address must be allowed.
+5. In Google Cloud, on the OAuth web client used for Sign in with Google, add `https://app.twiligent.ujjwal.fyi` to the authorised JavaScript origins.
+6. Run the verification below for the app and the site.
+
+`site/public/_redirects` sends the app's old paths on `twiligent.ujjwal.fyi` (such as `/login` and `/settings`) to the same path on the app with a 301, and the app's `/docs/*` route sends old docs links to the site. Self-hosted instances are not affected: they keep whatever address they already use.
+
## Rollback
**Backend:** Deploy a specific previous version:
@@ -140,7 +179,7 @@ npx wrangler deployments list
npx wrangler rollback <deployment-id>
```
-**Frontend:** Cloudflare Pages -> deployments list -> "Rollback to this deployment" on a previous build.
+**Frontend and site:** Cloudflare Pages -> the `twiligent` or `twiligent-site` project -> deployments list -> "Rollback to this deployment" on a previous build.
## First-Time Setup
diff --git a/docs/workflows/FEATURE_DEVELOPMENT.md b/docs/workflows/FEATURE_DEVELOPMENT.md
index e34e760..448577e 100644
--- a/docs/workflows/FEATURE_DEVELOPMENT.md
+++ b/docs/workflows/FEATURE_DEVELOPMENT.md
@@ -18,6 +18,7 @@ Confirm you have the project context and know which docs to load.
Based on what the feature touches:
- Backend change -> read `docs/architecture/backend/`
- Frontend change -> read `docs/architecture/frontend/`
+- Public site or docs page change -> read `docs/architecture/site/SITE.md` and `docs/brand-notes.md`
- DB change -> read `docs/architecture/database/SCHEMA.md`
- New integration -> read `docs/guidelines/API_CONVENTIONS.md`, relevant data flow doc
@@ -92,7 +93,7 @@ Before creating new patterns, check:
10. Frontend: `layout/navigation.ts` (if new page needs a nav entry)
11. Tests for new pure logic, in the workspace's `tests/` folder at the path that mirrors the source file (`backend/routes/accountRoutes.ts` -> `backend/tests/routes/accountRoutes.test.ts`, `backend/services/youtube/youtubeChannels.ts` -> `backend/tests/services/youtube/youtubeChannels.test.ts`, `frontend/src/lib/accounts.ts` -> `frontend/tests/lib/accounts.test.ts`); see `docs/workflows/TESTING.md`
-If the feature needs a new npm package (approval required, see CLAUDE.md), add it to the app that uses it from the repository root: `npm install <pkg> --workspace backend` or `--workspace frontend`. Never run `npm install` inside `backend/` or `frontend/`; the root `package-lock.json` is the only lockfile.
+If the feature needs a new npm package (approval required, see CLAUDE.md), add it to the workspace that uses it from the repository root: `npm install <pkg> --workspace backend`, `--workspace frontend` or `--workspace site`. Never run `npm install` inside `backend/`, `frontend/` or `site/`; the root `package-lock.json` is the only lockfile.
**Step 12 - Eliminate duplication**
After implementing, look for logic that duplicates something that already existed. Extract it into the appropriate shared location (`repositories/`, `services/`, `lib/analyticsMath.ts`, `utils/formatters.ts`, shared components).
@@ -105,14 +106,15 @@ After implementing, look for logic that duplicates something that already existe
Run from the repository root:
```bash
npm run typecheck # every TypeScript project must type-check
-npm run build # frontend must build without errors
-npm test # backend and frontend unit tests must pass
+npm run build # the app and the public site must build without errors
+npm test # backend, frontend and site unit tests must pass
npm run dev # Worker (8787) and Vite (5173) must both start without errors
+npm run dev:site # the public site, when the change touches site/
```
**Step 14 - Lint**
```bash
-npm run lint # one ESLint run over backend, frontend, tests and scripts
+npm run lint # one ESLint run over backend, frontend, site, tests and scripts
```
Lint must report 0 problems; CI fails otherwise.
diff --git a/docs/workflows/SCHEDULING_SETUP.md b/docs/workflows/SCHEDULING_SETUP.md
index cb92eea..eaf9e79 100644
--- a/docs/workflows/SCHEDULING_SETUP.md
+++ b/docs/workflows/SCHEDULING_SETUP.md
@@ -1,6 +1,6 @@
# Set Up Your Own Scheduling With GitHub
-> **Who this is for:** the administrator of a Twiligent instance. Step 2 needs the secret key of the instance's Supabase project. If you only sign in to someone else's Twiligent, you need none of this: the server already publishes your scheduled posts. This backup is optional even for administrators; the Worker cron publishes on its own once the backend is deployed. The public docs cover the same steps at `/docs/self-host/github`.
+> **Who this is for:** the administrator of a Twiligent instance. Step 2 needs the secret key of the instance's Supabase project. If you only sign in to someone else's Twiligent, you need none of this: the server already publishes your scheduled posts. This backup is optional even for administrators; the Worker cron publishes on its own once the backend is deployed. The public docs cover the same steps at `https://twiligent.ujjwal.fyi/docs/self-host/github`.
GitHub can check your scheduled Instagram posts every 15 minutes and publish the ones that are due, for free. It runs alongside the server's own scheduler as a backup, so posts still go out if the server is paused. You set it up once. It takes about 5 minutes.
diff --git a/docs/workflows/TESTING.md b/docs/workflows/TESTING.md
index 3e9b77e..49bc11e 100644
--- a/docs/workflows/TESTING.md
+++ b/docs/workflows/TESTING.md
@@ -2,18 +2,19 @@
## Current State
-Most testing is manual. Both the backend and the frontend have unit tests for pure logic using Node's built-in test runner (no dependencies). Broader coverage is a known gap - see ROADMAP.md.
+Most testing is manual. The backend, the frontend and the public site each have unit tests for pure logic using Node's built-in test runner (no dependencies). Broader coverage is a known gap - see ROADMAP.md.
Run every test and the type check from the repository root:
```bash
-npm test # backend, then frontend
+npm test # backend, frontend, then site
npm test --workspace backend # backend only
npm test --workspace frontend # frontend only
+npm test --workspace site # site only
npm run typecheck # every TypeScript project
```
-Each workspace's `test` script is `node --test "tests/**/*.test.ts"`. The tests are TypeScript: Node strips the types and runs the files directly, which needs Node 22.18 or newer (CI uses Node 24). Node does not check types while it runs them, so a test can pass with a type error; `npm run typecheck` covers the tests too (`backend/tests/tsconfig.json` and `frontend/tsconfig.node.json`).
+Each workspace's `test` script is `node --test "tests/**/*.test.ts"`. The tests are TypeScript: Node strips the types and runs the files directly, which needs Node 22.18 or newer (CI uses Node 24). Node does not check types while it runs them, so a test can pass with a type error; `npm run typecheck` covers the tests too (`backend/tests/tsconfig.json`, `frontend/tsconfig.node.json` and `site/tsconfig.node.json`).
### Test layout
@@ -37,11 +38,16 @@ Tests never sit next to source files. Each workspace has a `tests/` folder that
| `frontend/src/lib/authErrors.ts` | `frontend/tests/lib/authErrors.test.ts` |
| `frontend/src/lib/passwords.ts` | `frontend/tests/lib/passwords.test.ts` |
| `frontend/src/features/analytics/overview/overviewStats.ts` | `frontend/tests/features/analytics/overview/overviewStats.test.ts` |
-| `frontend/src/docs/nav.ts` | `frontend/tests/docs/nav.test.ts` |
+| `site/src/docs/searchShared.ts` | `site/tests/docs/searchShared.test.ts` |
+| `site/content/docs/**/*.mdx` and `site/src/docs/nav.ts` | `site/tests/docs/content.test.ts` |
+| `site/src/lib/chart.ts` | `site/tests/lib/chart.test.ts` |
+| `site/src/lib/format.ts` | `site/tests/lib/format.test.ts` |
Backend tests are in `backend/tests/lib`, `backend/tests/middleware`, `backend/tests/repositories`, `backend/tests/routes`, `backend/tests/services` (with `youtube/`, `instagram/` and `reddit/` for the platform modules) and `backend/tests/validators`. A route test is named after its route table (`accountRoutes.test.ts`) and exercises the whole stack below it: controller, service and repository. Shared test helpers (`fakeSupabase.ts`, `fakeFetch.ts`, `golden.ts`, `routeHarness.ts`, the per-platform `*Fixtures.ts` data) and the `*.golden.json` snapshots are in `backend/tests/fixtures/`. Wrangler only bundles files reachable from `server.ts`, so nothing in `backend/tests/` ships in the Worker.
-Frontend tests cover shared helpers in `src/lib/` and `src/utils/` (hold-to-confirm timing, command palette ranking, library filtering and paging, platform helpers, and a check that every Lucide icon imported in `src` exists) and page helpers in `src/features/**` and `src/docs/**`, such as `features/analytics/overview/overviewStats.ts`. A testable helper is a plain `.ts` file with no JSX and no `@/` or `@shared/` imports, and its imports of project files (including `shared/types`) are relative paths that end in `.ts`, so Node can load it directly. It uses only erasable TypeScript (no `enum`, no parameter properties) and `import type` for types. This rule lives here, so helper files do not repeat it in a header comment.
+Frontend tests cover shared helpers in `src/lib/` and `src/utils/` (hold-to-confirm timing, command palette ranking, library filtering and paging, platform helpers, and a check that every Lucide icon imported in `src` exists) and page helpers in `src/features/**`, such as `features/analytics/overview/overviewStats.ts`. A testable helper is a plain `.ts` file with no JSX and no `@/` or `@shared/` imports, and its imports of project files (including `shared/types`) are relative paths that end in `.ts`, so Node can load it directly. It uses only erasable TypeScript (no `enum`, no parameter properties) and `import type` for types. This rule lives here, so helper files do not repeat it in a header comment.
+
+Site tests are in `site/tests/docs/` and `site/tests/lib/`. `chart.test.ts` checks the chart geometry the product previews draw with (the smooth line passes through every point and never overshoots between two), and `format.test.ts` the number formats they show. `content.test.ts` reads the MDX files in `site/content/docs/` and checks that every page in `site/src/docs/nav.ts` has a content file and every content file is in the navigation, that the navigation slugs are unique, that every page starts with `export const meta = { title, description }`, that every link to another docs page points at a page that exists, and that no page uses an em or en dash. It reads `nav.ts` as text, because that file imports the generated JSX icons, which Node cannot load. `searchShared.test.ts` covers `slugify()`, which makes the heading anchors that search results open.
Test files import the code under test the same way, by relative path with the `.ts` extension (`../../src/lib/accounts.ts`). Type test fakes narrowly: cast a fake once to the interface it stands in for, rather than using `any`, which is a lint error.
@@ -63,7 +69,7 @@ The testing workflow documented here describes what should run before shipping a
# From the repository root: every TypeScript project must type-check
npm run typecheck
-# Frontend must build without errors
+# The app and the public site must build without errors
npm run build
# Unit tests must pass
@@ -85,7 +91,8 @@ One ESLint run from the root covers the whole repository. The shared config is `
- Every `.ts` and `.tsx` file: the ESLint recommended rules plus the `typescript-eslint` recommended rules (`@typescript-eslint/no-explicit-any` is an error)
- `frontend/**`: also React hooks rules (no conditional hooks) and React Refresh rules, with browser globals; unused variables are errors unless they start with a capital letter or underscore
- `backend/**`: service worker globals, because the Worker runs on the web platform, not Node; unused variables and arguments starting with `_` are allowed, and unused caught errors are not reported
-- `backend/tests/**`, `frontend/tests/**`, `frontend/vite.config.ts` and `scripts/**`: Node globals
+- `site/**`: React hooks and React Refresh rules with browser globals; every unused variable is an error, capitalised names included
+- `backend/tests/**`, `frontend/tests/**`, `frontend/vite.config.ts`, `site/vite.config.ts`, `site/build/**`, `site/tests/**` and `scripts/**`: Node globals
- Root `*.js` and `*.mjs` config files: the ESLint recommended rules with Node globals
Lint must report 0 problems; the CI workflow fails on any error. The shadcn files that export their cva variants next to the component (`badgeVariants`, `buttonVariants`, `tabsListVariants`, `toggleVariants`, `useSidebar`) and the contexts that export their hooks (`useAppContext`, `useAuth`) are listed in `allowExportNames` for `react-refresh/only-export-components` in `eslint.config.mjs`; editing one of those files reloads the page instead of hot-updating it. Add a name there only for the same pattern.
@@ -176,6 +183,19 @@ Open the app in a browser. For each changed area, test:
- [ ] Manual trigger processes due posts correctly
- [ ] Failed posts show error in UI
+**Public site and docs (if `site/` or the app's docs links changed):**
+
+Run `npm run dev:site`, or `npm run build --workspace site` and `npm run preview --workspace site` to check the production build.
+- [ ] The home page renders in both themes: switch with the theme toggle in the navbar, reload, and the choice is kept
+- [ ] `/docs` opens the docs home; the sidebar, the table of contents and the previous and next links work
+- [ ] Ctrl K (Cmd K on a Mac) focuses the docs search; searching for `redis` lists the Redis page and opening a result scrolls to its section
+- [ ] Code blocks are highlighted in both themes
+- [ ] After a build, `site/dist/sitemap.xml` and `site/dist/llms.txt` list every docs page
+- [ ] In the app, `/docs/self-host/github` (or any `/docs/...` path) lands on the same page of the public docs, and the Documentation item in the user menu opens the docs in a new tab
+- [ ] The app's `/login?mode=signup` opens the sign-up form
+- [ ] The product previews play while on screen: the cursor in Publish clicks the upload, caption, time and Schedule post, the Analytics cursor reads the chart and opens Shorts and regular, and each bento card fills its panel down to the lower edge
+- [ ] With reduced motion on (DevTools, Rendering, prefers-reduced-motion), every preview shows its finished state and no cursor appears
+
### 5. Error State Testing
- [ ] What happens with no accounts? (empty state)