Extend the build and connect services

Extend the build and connect services

Trusted plugins run during the Node.js build. Browser modules and external embeds wait for the matching service consent. Static website hosting needs no site-owned backend proxy.

Build-time plugins

Local JavaScript modules in plugins/ may transform source documents, register hooks or renderers, and generate routes. They execute with the build process permissions, so only load code reviewed by the project owner.

The starter consent plugin adds a privacy panel after the shared page layout. Build plugins are trusted code and are not deployed as browser scripts.

Register a route generator
export default function projectMeta(api) {
  api.registerGenerator('project-meta', ({ site }) => ({
    path: 'project-meta.json',
    body: JSON.stringify({
      title: site.config.site.title,
      posts: site.posts.length
    }),
    contentType: 'application/json; charset=utf-8'
  }));
}

Tracking, statistics, advertising, and CAPTCHA

Add browser providers in config.yml under plugins.consent.services. Each service needs a unique ID, provider, purpose, dataCategories, recipient, retention, a privacyUrl pointing to the provider's current privacy information, and its public site identifier. privacyUrl must be an HTTPS URL. Localized fields are maps keyed by every enabled locale, such as en and zh-CN.

Available providers include Google Tag Manager and Meta Pixel; Cloudflare Web Analytics, Google Analytics, and Baidu Tongji; Google AdSense; and Cloudflare Turnstile, Google reCAPTCHA, and hCaptcha.

Set plugins.consent.proposedDate to the YYYY-MM-DD date the notice was drafted. Set effectiveDate when the notice takes effect; omit it while no effective date has been set. Updating either date makes saved consent stale, so visitors are asked again.

Provider code is imported only after the visitor accepts that integration. The first layer offers accept and reject together; service data and individual switches are available in its details. Keep CAPTCHA secret keys out of config.yml and client code. The server must submit each CAPTCHA response to the provider verification API before accepting a form.

Register external-api or external-widget under plugins.consent.services in config.yml. Each service needs an HTTPS endpoint, complete privacy disclosures for every enabled language and explicit visitor consent.

Websites serve static frontend assets. Independent services own authentication, authorization, CAPTCHA verification, validation, storage and rate limits. Put operator secrets in the service platform settings.

Import callService from /edgepress/services.js in theme source to call a registered API when the visitor requests it. Widget modules export mount and load only after consent.

Content security and maintenance

The built-in Markdown renderer sanitizes post output. Custom renderers, plugins, themes, and files in static/ are trusted project code; review changes before building or deploying. Do not put secrets in posts, themes, or public assets.

edgepress iterate writes a report-only review plan under .edgepress/reports/. It does not edit source files, update dependencies, or deploy. edgepress security checks dependency advisories. Review the lockfile and generated page report before deployment, and keep a known-good deployment for rollback.

Review project changes
edgepress security
edgepress iterate
edgepress check
edgepress server

Register each service by name under plugins.consent.services. Before consent, its resources are not loaded. When consent is granted, visible embeds load on demand. Authentication, storage and other backend work belong to the independent service, with platform adapters under backend/<platform>.