meridian dev is the everyday command. It opens a local connection to your managed developer database and starts your app’s dev server, and stops both together, so quitting your server closes the connection with it.
The connection goes through the Meridian database gateway. On every run the CLI generates a key on your machine, keeps it in memory only, and gets a certificate for your own developer database, valid for 24 hours and renewed while meridian dev keeps running. Nobody else’s certificate reaches your database, and yours reaches no one else’s. Removing you from the organization or the app ends your access within a minute.
--, then dev_command in .meridian/project.json, then npm run dev.
For an app built from Shopify’s template, npm run dev is shopify app dev, which previews your app on a development store. Test there with the same Shopify app you release: see Recommended Shopify app setup.
meridian dev also exports MERIDIAN_DEV_DATABASE_ID, so that a shop subscribing from your local app is billed with its session in your developer database, as a Shopify test charge. See Billing from local development.
Without
--port, the CLI takes 3307 for a MySQL app or 5433 for a PostgreSQL app, or the next free port when that one is busy, so nothing fails because you left yesterday’s session running. An explicit --port is a contract: the CLI uses exactly that port, and stops with Port <port> is already in use. when it is taken.
One meridian dev per app at a time: a second one on the same app, from this checkout or another one, stops with the first one’s pid and port. Stop the first one, or run your other process with the DATABASE_URL from .env, which already points at its connection.
Prepare Prisma (once)
Shopify’s app template stores its data in SQLite. Every database command (meridian dev, meridian migrate, meridian db) refuses a Prisma schema that doesn’t read the developer database, before it provisions anything:
provider = "mysql" for a MySQL app, provider = "postgresql" for a PostgreSQL app.
prisma/schema.prisma
urlmust readDATABASE_URL, the variablemeridian devsets. A hardcoded URL or another variable name is refused with... so this command would not touch the managed developer database.shadowDatabaseUrlis whatprisma migrate devneeds. Without it,meridian migrateoffers to add the line (--yesaccepts). In a script without--yesit stops and prints the line to add.- The migration history has to match the app’s engine. Migrations generated for SQLite or for the other engine use their own SQL, so
meridian migraterefuses them before it starts (... was written for a different database engine and cannot apply to MySQL., or... PostgreSQL.). Deleteprisma/migrationsand create a fresh one withmeridian migrate --name init. Don’t delete migrations that already ran against a hosted database.--allow-foreign-migrationsmakesmeridian migratetry anyway. skip_datasource_checkin.meridian/project.jsonturns the check off (see Flags and configuration).
First run
In a linked project (see Signing in and linking):- Prepare Prisma.
- Create the tables:
meridian migrate --name initfor a new history, ormeridian db reset --yes --migrateto apply a history you already have, written for your app’s engine. - Start the app:
meridian dev. The first run provisions your developer database, which takes up to five minutes.
From a script or an agent
A coding agent’s shell has no terminal, so nothing can be asked interactively.meridian devruns in the foreground until your dev server stops. Start it in the background. With--json, its first line on stdout is the JSON summary, followed by the dev server’s own output.npm run devin the template isshopify app dev, which asks the developer to sign in to Shopify and pick a development store the first time. Leave that step to them.meridian migrateneeds--name(Prisma can’t ask for one) and--yesif it has to addshadowDatabaseUrl. A migration that would lose data, or a database that drifted from the history, still needs a person. See Migrations and rollback.meridian db resetasks you to type the database name: pass--yes, with--migrateand--seedfor the follow-ups.- A production change (
meridian deployormeridian rollbackto production,meridian env setormeridian env unseton production or with--all-environments) needs production access, which a person approves in the browser, and--yesfor its confirmation. An agent passes--yesonly after the person agreed to that change. See AI coding agents. - A prompt the CLI can’t show stops the command with
Cannot prompt for <question> in a non-interactive shell.and names the flag or variable that answers it. See Errors and exit codes.
When the developer database is not there
Each developer database takes at most 10 connections at a time through the gateway, shared by
meridian dev and the commands that reuse its connection. Prisma’s default pool grows with your CPU cores, so on a large machine lower it with connection_limit in the database URL when connections are refused.
The database URL
Before starting your dev command,meridian dev writes two lines into .env:
postgresql scheme, port 5433 on 127.0.0.1 and sslmode=disable, because the local leg is plain TCP and the TLS runs from the CLI to the gateway:
SHADOW_DATABASE_URLis a second databaseprisma migrate devneeds; it’s dropped with your developer database.- Every other line in the file (comments, order, quoting) is preserved, and the first change saves a one-time
.env.backup. - Credentials are short-lived and rotate, and the port changes when 3307 (5433 on a PostgreSQL app) is busy, so treat the line as a cache rather than a secret to share, and keep
.envout of git. - Your dev command gets both variables in its environment either way, so
--no-envstill works for a process that reads the environment rather than the file. - Only
meridian devwrites these lines.meridian migrateand themeridian dbcommands pass the URL to the process they run and leave.envas it is.
--env-file when your framework reads something other than .env, such as .env.local or .env.development. The path is relative to the project root, not to your shell.
--env-file matters here only. meridian migrate and the meridian db commands still accept it, but they no longer write any .env file, and say so.SDK credentials
The SDK needsMERIDIAN_APP_ID, MERIDIAN_API_KEY and MERIDIAN_API_URL. meridian dev asks Meridian for a dev SDK key for you, limited to dev stores, and gives your dev server all three in its environment. There is nothing to paste into .env. Each run mints a new key, and the previous one stops working. Deleting your developer database revokes it too. MERIDIAN_WEBHOOK_SECRET is not set: a local app does not receive forwarded webhooks.
The summary shows SDK: dev key …abcd injected with the last four characters. The key itself is never written to .env, to the summary or to --json, which carries sdk.source and sdk.key_last_four.
You win. If MERIDIAN_APP_ID or MERIDIAN_API_KEY already comes from your shell or from your env file (--env-file, default .env), meridian dev injects nothing, mints no key and says where the value comes from (from your shell, from .env). It reads the file even with --no-env. An empty value counts as not set, as it does in the SDK.
- It is all or nothing: the app ID and the key are never mixed with yours.
MERIDIAN_API_URLis injected only together with the pair, and only when you do not set it. If your env file sets one that points to another API than the CLI’s, nothing is injected and the summary says so.- An empty
MERIDIAN_API_KEY=line in your env file does not block the injection. Remove the line anyway, because some tools reload the file over the environment. - If the key cannot be minted (no rights on the app, an older API, no network), you get a one-line warning and your app starts without the credentials.
DATABASE_URL, which meridian dev always sets. On staging, the CLI uses the API URL Meridian returns, so a CLI logged in on staging gives the SDK the staging API, not production.
Migrations while it runs
Whilemeridian dev runs, it records its connection in ~/.meridian/sessions/, in a file only you can read, and deletes it when it stops. meridian migrate, meridian db seed, meridian db shell and the follow-ups of meridian db reset find it and use the same connection:
--port only applies when no meridian dev runs.