# Sovereign Afrihost deployment

Prepared from the latest live source on 12 October 2026. Not yet deployed to Afrihost.

## Requirements
Node.js 22.13 or newer, persistent writable private storage, an application manager that can run a Next.js Node server, and outgoing HTTPS. Confirm these in cPanel before uploading.

## Install and build
Use the package dependencies in package.json. Install on Afrihost or a matching Linux build system; then run npm run build. The built standalone server is at .next/standalone/server.js. Copy public and .next/static into the corresponding standalone paths before starting it. Alternatively install all dependencies in the source folder and run npm run start. Configure the application port and hostname according to Afrihost's Node manager.

Set SOVEREIGN_DATA_DIR to a private absolute directory outside public_html and outside any directory replaced during deployments. Run npm run db:migrate once before starting. This creates schema only, NOT member data. Never run migrations against a database imported without verifying its migration history.

## Data and secrets
Obtain a COMPLETE SQL export of the live database; bounded table previews truncate saved plans and cannot restore them. Import into a staging database, compare all table counts and full plan JSON, then take a final consistent export for cutover. Preserve the existing Supabase project and accounts. No passwords are included. PAYMENT_CONFIG_KEY must match the key used for existing encrypted settings, or re-enter payment settings securely. Keep existing subscription tokens and receipts. Obtain full upload objects and their keys; import into the private upload directory with matching metadata.

The environment variables for SMS are read from the existing emergency route. Verify actual variable names before setting them. Supabase config is retained from the current app. Payfast callback and return URLs require hersovereign.com at final cutover.

## Verify before DNS
Check /api/hosting-status, signup and email verification, login, private plan read/save across two accounts, images, uploads, review, billing status/cancellation/notifications and all phone layouts. Keep email MX/SPF/DKIM/DMARC unchanged. After staging tests pass, change website records only, enable HTTPS and repeat tests on hersovereign.com. Keep the previous deployment and database for rollback.

## Current limitations
Hosting login is required. No full live database or upload export is included in this source package. Afrihost runtime compatibility and production deployment remain unverified.
