Deployment

Monad has no opinion on servers, containers, or process managers — that's your infrastructure team's call. What it does specify are the runtime properties an application built on it must satisfy to deploy correctly.

Runtime requirements

  • PHP >=8.2.
  • A database driver matching DB_DRIVER: pdo_mysql (default), or PostgreSQL/SQLite's PDO drivers.
  • mbstring, json, curl (HttpClient), fileinfo (Files — content-based MIME detection, never the client-supplied Content-Type).
  • openssl and/or sodium — needed if your app uses Encryption or SignedURL.
  • redis — only if the Redis cache adapter is configured.

Statelessness and horizontal scaling

Session and Cache both support database-backed and Redis-backed drivers, not filesystem-only — an app can run across multiple stateless web nodes without sticky sessions as long as one of those shared backends is configured. The file-based Session/Cache drivers are single-node only, by nature of local disk.

Storage adapter topology

  • Files — filesystem adapter (/storage/userfiles) by default; S3 is an optional adapter for object storage.
  • Cache — file (/storage/cache, single-node), database (caches table, shared), or Redis (shared, external service).
  • Logger — writes to local files (/storage/logs/...) by design; aggregating logs across multiple nodes is an application/ops concern, not something Monad centralizes.

Outbound network dependencies

HttpClient and the LLM adapters make outbound HTTPS calls to provider APIs (OpenAI, Anthropic, DeepSeek, Gemini) when your app uses them. Google SSO (Authentication middleware) makes outbound HTTPS calls to Google's OAuth endpoints. Provider API keys are supplied via your app's config/.env — Monad never hardcodes, logs, or persists raw API keys.

The deployment acceptance gate: php mitosis health

Run this after every deploy, before considering it live. It checks five things and exits 0 only if all five pass:

php mitosis health
  • Configuration — a .env file is present at the project root.
  • Database connectivity — the configured connection accepts SELECT 1.
  • Writable storagestorage/cache, storage/logs, storage/userfiles exist and are writable.
  • Migration status — no pending migrations in database/migrations.
  • PHP extensionspdo, mbstring, json, curl, fileinfo are loaded.

A non-zero exit code means at least one check failed — the command prints which one and why, so it's suitable as a CI/CD deploy gate, not just a manual spot-check.

What's explicitly out of scope

Server provisioning, container images, reverse proxy/load balancer configuration, and CI/CD pipeline definitions belong to your own infrastructure, not to Monad. php mitosis serve binds PHP's built-in server to port 8000 for local development — it is not a production server.