Web architecture · Pages deployment · Extension development · Chinese
Web configuration lives in apps/web/config, and its environment schema is apps/web/env.schema.ts.
The root pnpm web -- ... command loads .env.web and profile files from deploy/local (shared with the API's own .env/.env.dev, distinguished by filename); the development profile uses .env.web.dev, while other profiles use .env.web.<SLAX_ENV>.
.env.web.dev overrides .env.web, and variables already present in the process take precedence. Direct app-package commands use the same deploy configuration and no longer read app-local environment files.
The selected environment is read from process SLAX_ENV, then the SLAX_ENV value in the deploy .env.web, and defaults to development. A profile file cannot switch the selected environment. All root commands, including dev and build, follow this rule; the repository-root .env is not loaded automatically.
Environment files are prepared by the contributor, are not committed, and must not be copied from the old repository.
After creating the Web environment file below, run the read-only checks and Web preparation from the repository root:
pnpm preflight --app web
pnpm web -- setuppnpm setup:all performs API, Web, and Extension setup in one ordered
workflow. Run pnpm web -- setup again after removing .nuxt/ or
deploy/local/.generated/web/. Setup prepares generated state; it does not
start pnpm web -- dev or prove that the API is running.
Missing Nuxt preparation or invalid API bindings blocks startup. Missing Google OAuth, cookie settings, or required URLs permits startup but limits features. An absent generated Web Wrangler projection is informational: dev regenerates it. Both failure classes make preflight exit non-zero. See preflight status meanings.
Start by copying deploy/local/.env.web.example:
cp deploy/local/.env.web.example deploy/local/.env.webThe example values are for local placeholders only. Google OAuth is required for Web login; Apple OAuth and Turnstile are optional. Real OAuth, Turnstile, push and Stripe configuration must be supplied by the developer.
| Variable | Required | Purpose |
|---|---|---|
PUBLIC_BASE_URL, AUTH_BASE_URL, SHARE_BASE_URL |
Required | Local Web, login and sharing origins |
DWEB_API_BASE_URL |
Required | API service URL, normally provided by apps/api for local integration |
COOKIE_DOMAIN, COOKIE_TOKEN_NAME |
Required | Local session-cookie configuration |
GOOGLE_OAUTH_CLIENT_ID |
Required | Google Web OAuth client ID |
APPLE_OAUTH_CLIENT_ID |
Optional | Apple login button; empty hides the option |
TURNSTILE_SITE_KEY |
Optional | Turnstile; empty skips the related verification |
SLAX_API_CONFIG / deploy/local/api.toml |
Web dev only | API configuration path required for local Worker integration |
SLAX_ENV |
Optional, defaults to development |
development, preview, beta or production |
CLIENT_ERROR_INGEST_URL |
Optional, local builds only | Front-end error log endpoint; empty in development disables sending |
See env.schema.ts for other optional fields. Deployed builds take the error log endpoint from their profile in nuxt.config.ts, not from CLIENT_ERROR_INGEST_URL. Never put server secrets in frontend public configuration.
Google login requires a Web application OAuth client ID:
- Open Google Cloud Console and create or select a project.
- Open APIs & Services → OAuth consent screen and complete the application name, support email and required scopes.
- Open APIs & Services → Credentials → Create Credentials → OAuth client ID.
- Select Web application.
- Add
PUBLIC_BASE_URL, such ashttp://localhost:3000, to Authorized JavaScript origins. - Add
${AUTH_BASE_URL}/auth, such ashttp://localhost:3000/auth, to Authorized redirect URIs. - Copy the generated Client ID into
GOOGLE_OAUTH_CLIENT_ID.
Only the Client ID belongs in frontend configuration. The Client Secret is a server credential and must not be placed in deploy/local/.env.web.example or browser output.
pnpm web -- dev preserves the existing integration path: the API must have generated deploy/local/.wrangler/state/v3, and Web calls the local Worker through the BACKEND service binding in the generated deploy/local/.generated/web/wrangler.toml.
Nuxt prepare, type checks and builds do not require that backend path. This guide does not claim that login, bookmark synchronization or saving work without an API integration environment.
Do not start, install or modify the old frontend repository for this migration. Connect to an API integration environment only with configuration supplied by the developer. This work does not deploy Cloudflare resources or change production bindings.
The following placeholder values allow prepare, type checks, unit tests and builds without starting the API:
export SLAX_ENV=development
export PUBLIC_BASE_URL=http://localhost:3000
export AUTH_BASE_URL=http://localhost:3000
export SHARE_BASE_URL=http://localhost:3000
export DWEB_API_BASE_URL=http://localhost:8787
export COOKIE_DOMAIN=localhost
export COOKIE_TOKEN_NAME=slax_test
# Required Google OAuth Client ID; see the steps above.
export GOOGLE_OAUTH_CLIENT_ID=your-google-client-id
# Optional: leave empty to hide Apple login.
export APPLE_OAUTH_CLIENT_ID=
# Optional: leave empty to disable Turnstile.
export TURNSTILE_SITE_KEY=These values do not start the API and cannot verify real login, synchronization or production deployment. A successful development-profile build does not verify production configuration. A complete install still requires Node.js, pnpm and any native build tools required by the local platform; skipping install scripts is not a complete install.
Run these commands from the repository root:
pnpm install --frozen-lockfile
pnpm --filter @apps/slax-reader-dweb type
pnpm --filter @slax-reader/selection typecheck
pnpm web -- typecheck
pnpm web -- test
pnpm web -- buildThese checks use the existing Vitest suite. Passing tests and a build do not prove successful backend integration.
With local integration configuration available, run pnpm web -- dev and verify login, the bookmark list, articles, highlights and comments. Also check /x/ext-bridge together with the Extension. Use development test accounts only.
The build hook projects public API TOML data into deploy/local/.generated/web/wrangler.toml; it does not rewrite the tracked apps/web/wrangler.toml.
apps/web/tests/fixtures/media-recovery/ holds the Playwright scripts that produced the browser evidence for openspec/changes/restore-media-article-recovery. No package script or CI job runs them: each one needs a running Nuxt dev server, a local Chrome, and in two cases real public content. Run them by hand when a change touches the YouTube article status, the transcript reading layout, or the saved article body, and record the result in the change's validation.md.
pnpm web -- dev --port 3210
node apps/web/tests/fixtures/media-recovery/20261027-browser-check.mjs # fixtures only: retry and owner guidance in both views
node apps/web/tests/fixtures/media-recovery/20261027-readable-transcript-check.mjs # real public transcript through a local proxy
node apps/web/tests/fixtures/media-recovery/20261027-public-transcript-check.mjs # production public page, no login
node apps/web/tests/fixtures/media-recovery/20261027-edited-youtube-check.mjs # needs the local publication server on port 8797Each script accepts the dev server origin as its first argument. The scripts write screenshots to a temporary directory and never to the repository. A script that drifts from the components it exercises fails on its own assertions; fix the script with the component change.
open_docs contains product content read by Nuxt Content and stays inside the app. content.config.ts also lists the app-local docs/en and docs/zh content roots, but those directories are not present in the current snapshot.
Long-form Web documentation lives in docs/web and is not treated as page content. Application dependencies belong in the app manifest, and workspace packages are linked by pnpm rather than copied from the old repository.
You can participate without a local environment by reporting an issue or suggestion on GitHub, or by editing Markdown and translation files in the web editor. Include the location, environment, reproduction steps, expected result and actual result in a report, and remove account details, private articles, cookies and tokens.
For a small wording, translation or documentation change, use GitHub's editor, check the Markdown preview, and propose the change from a new branch. Larger multi-file changes should start with an Issue and follow the local workflow. Do not commit directly to dev, beta or main. Features, APIs and behavior changes require a reviewed OpenSpec proposal; documentation-only changes may use OpenSpec: n/a.
Translations live in apps/web/i18n/locales and apps/extension/src/locales. Preserve keys, placeholders, line breaks and JSON structure. Web uses placeholders such as {username}, while the Extension uses placeholders such as $1. Code changes should use an isolated worktree and should report the actual type checks, tests and builds run in the PR.