Skip to content

Self-host Directus in France, with its PostgreSQL database, from your AI agent

A back office and an API for your content, with no server to maintain. Connected to while over MCP, your AI agent deploys Directus in France, with its content in a PostgreSQL database backed up every day.

By Aloïs Oddon, co-founder of Nextmap. Facts checked on November 3, 2026.

View as Markdown

Prerequisites

  • A new Directus instance, or your exported schema.
  • Your AI agent: Claude Code, Codex, Cursor or Gemini CLI.

Step 1: Ask your agent for Directus

You, to your agent: Connect to while with my account (while.sh/agents), then deploy Directus with its PostgreSQL database.

Your agent adds while’s MCP server itself. If it asks you to, restart it. On the first call to while, a page opens in your browser. In Claude Code, if it doesn’t open, type /mcp, choose while, then Authenticate. On that page, choose “A new app”, then click Authorize.

Step 2: Open your back office

Your agent gives you your Directus address, for example https://directus.while.cloud, with the admin account’s email address and password. Sign in, change that password, then create your collections.

What your agent does

Directus reads its database from DB_CONNECTION_STRING1, and while provides it in DATABASE_URL. So your agent writes a Dockerfile, on the official Directus image, that copies one into the other at startup:

Dockerfile
FROM directus/directus:11
ENV PORT=8080 HOST=0.0.0.0
CMD ["sh", "-c", "export DB_CONNECTION_STRING=\"$DATABASE_URL\"; node cli.js bootstrap && pm2-runtime start ecosystem.config.cjs"]

Then while.yaml:

while.yaml
apiVersion: while/v1
project: directus
services:
  - name: web
    port: 8080
    health: { path: /server/health }
databases:
  - name: main

At startup, node cli.js bootstrap creates the Directus tables and the admin account, then Directus answers on /server/health. Your agent sets Directus’s KEY and SECRET keys and the admin password in while as secrets3, and sets ADMIN_EMAIL, DB_CLIENT: pg and TELEMETRY: false in plain text.

Move to your own domain

You, to your agent: Put Directus on cms.acme.com.

Your agent declares the domain, you add the DNS records it gives you, and the HTTPS certificate follows.

Upgrade to the latest version of Directus

You, to your agent: Upgrade Directus to the latest version.

Your agent deploys the latest Directus image. If the new version disappoints, it rolls back to the previous one.

Put Directus back the way it was yesterday

You, to your agent: Restore Directus’s database to yesterday at 6 pm.

Your agent prepares the restore, and you approve it: a safety backup is taken first, then the database goes back to the requested moment.

Read your content from your agent

You, to your agent: How many articles were published this month?

Your agent reads the Directus database in SQL over MCP, with your permissions, and it can’t write to it.

In the docs: PostgreSQL databases and Variables and secrets.

Next steps

Sources

  1. Directus, database configuration, accessed November 2, 2026
  2. Directus, file storage, accessed November 2, 2026
  3. Directus, security (SECRET), accessed November 2, 2026

Questions

Is my content backed up?

Yes: it lives in the PostgreSQL database, which is backed up every day and can go back to a precise moment.

Where do my images and files go?

Directus keeps them on its disk2, which starts from scratch on every deployment: keep your media elsewhere, or import them again after an update.

Can my site read the Directus API?

Yes, Directus stays public, and its own sign-in protects the back office.

Where is my Directus hosted?

In France, by Nextmap, a French company.

Connect your agent, it takes care of the rest

To paste into your agent

Read while.sh/agents, then deploy my app with while.

Copy the instructions

No account needed to try: your app is live right away. To keep it, sign in.

A project for your company? Talk to the team: hello@while.sh