Skip to content
SEUNGWOO CHOI edited this page Nov 8, 2026 · 7 revisions

Self-hosting the client

English · 한국어

The client exports static files. It can run without an API, behind a same-origin API proxy, or with a same-site HTTPS API subdomain. Server installation, database migrations, workers, storage, and backups are covered by API deployment and operations; this page covers the client side.

Build configuration

Build a selected tag or full commit SHA whose client/API compatibility you have checked. Record the source ref rather than assuming an unpinned main snapshot is a release. Supported runtime requirements are in web/package.json; exact CI/Docker runtimes are in .github/workflows/ci.yml and Dockerfile. See client development for source and toolchain setup.

Set public variables using web/.env.example, then run npm ci and npm run build inside web/. Deploy web/out/.

Public build variable Meaning
NEXT_PUBLIC_APP_URL App origin used by canonical URLs, Open Graph, sitemap, and robots
NEXT_PUBLIC_MIROVEN_API_URL Empty for local-only; /api/v1 for same-origin; an absolute HTTPS URL for a separate API
NEXT_PUBLIC_WEBSITE_URL Website base URL for product information, terms, and privacy links

Set app and website URLs explicitly for your instance; omitted values use official-service defaults. API URLs allow HTTPS or loopback development HTTP. Rebuild whenever these values change. Docker accepts the same names as --build-arg; changing runtime container environment variables cannot reconfigure already-built static JavaScript. Never put server secrets, database credentials, or SMTP credentials in public variables.

Example for a local-only Docker image, run from the Miroven root:

docker build -t miroven-client:local --build-arg NEXT_PUBLIC_APP_URL=https://journal.example.com --build-arg NEXT_PUBLIC_MIROVEN_API_URL= --build-arg NEXT_PUBLIC_WEBSITE_URL=https://www.example.com .

The tag here is a local build example, not a published container image. For Pages, use root web, build command npm run build, and output out.

Corresponding source delivery

Deploy out/source/ with the JavaScript from the same completed build, including in Docker images. /notice links miroven-source.tar.gz, SHA256SUMS and the per-file manifest. The archive includes actual source inputs and public build settings; GitHub's automatic repository ZIP/tar alone does not capture those per-build settings. Keep this source download reachable alongside the object files, and retain the matching source whenever older JavaScript remains available through a CDN or release host. CI artifacts expire and are not the delivery channel.

Recipients can extract the archive, restore BUILD-SETTINGS.json into the build environment and follow its included rebuild instructions without Git metadata or private signing tools. See client development. Check actual hosting access, retention and deployment terms separately; repository automation does not configure or verify them.

PWA deployment and updates

Deploy the complete out/ from one finished npm run build, including the finalized sw.js, generated _headers, shell files, and every emitted JS/CSS chunk. The worker installs the complete shell/executable precache before activation; missing required chunks reject installation. Keep content-addressed assets available for online documents still using older builds, and apply each response's matching CSP/MIME headers. Avoid serving mixed deployments of HTML, Service Worker, and assets through a CDN.

Online / navigation and unhashed shell files use HTTP-cache-revalidating Network First; failure or non-success HTTP status falls back to the installed complete build without replacing its cached HTML. Takeover does not reload existing tabs, and older app caches retain their lazy chunks until conservative cleanup is possible. Cache eviction can still remove offline resources; this is not a backup of journal data. See PWA and updates for boundaries, readiness, Safari Worker handling, and verification.

npm run test:offline and npm run test:updates verify local production outputs and controlled A/B transitions. They do not establish historical-release compatibility or a CDN's deployment consistency. Verify your host's update/failure behavior separately; performance measurements also need the intended build/settings.

Authentication and hosting boundaries

On the server, MIROVEN_PUBLIC_ORIGIN is the app origin and MIROVEN_API_ORIGIN is the API origin. Cookie authentication supports same-origin or same-site HTTPS subdomains, not unrelated sites. API cookies are host-only, HttpOnly, Secure in HTTPS, and SameSite=Lax. Do not connect website or preview builds to the production API.

Apply the generated CSP and security headers in out/_headers at the actual host. The Service Worker must not cache API responses. Review policy wording, support contacts, storage providers, and retention for your operation rather than presenting official-service policies as your own.

Changing origin does not move IndexedDB. Export an encrypted backup at the old address and restore into an empty vault at the new one; see backup and recovery.

For API production Compose files, installation, and paired DB/blob backups, consult API Deployment and API Operations in the API checkout. Use a server with multi-photo migration 0004_attachments; deploy the current API with its full Alembic head, including 0005_subscriptions for account/limit queries. API and website package versions are independent of the client version.

Clone this wiki locally