Migrating a Production Next.js + Prisma + Supabase Monorepo to Dodil Cloud (Free Tier Walkthrough & Honest Friction Log)
When evaluating a newer cloud platform, "Hello World" tutorials rarely tell you what happens when you bring a real production codebase with a monorepo structure, Prisma ORM, NextAuth v5, and live users. Over the past fe
When evaluating a newer cloud platform, "Hello World" tutorials rarely tell you what happens when you bring a real production codebase with a monorepo structure, Prisma ORM, NextAuth v5, and live users.
Over the past few days, I migrated a client's bilingual (VI/EN) legal publishing platformβa Next.js 15 + React 19 + TypeScript + Yarn 3.6.1 Workspaces monorepo (app, admin, and packages/database) running on GitHub + Vercel + Supabaseβonto Dodil Cloud (Free Tier).
The core constraint: zero downtime and zero destructive changes to the live production stack. We worked strictly on an isolated branch (feat/dodil-migration), kept the client's repository private, migrated the database and auth layer, and wired up automated CI/CD to Dodil Ignite alongside a one-way sync pipeline from Supabase.
Here is the complete, honest walkthroughβincluding what worked surprisingly well and every real friction point we ran into.
Architecture Overview
To keep the existing production deployment untouched while running a full mirror on Dodil Cloud, we built the following setup:
-
Source Control: Private repo on Dodil Git (
feat/dodil-migration), completely isolated fromorigin/mainon GitHub. - Database: Dodil KΒ³ Postgres (14 tables: 11 Prisma models + 3 implicit MβN join tables), synced one-way from Supabase.
- Authentication: Dodil AppId (OIDC + official REST APIs) integrated at the backend of NextAuth v5 with 0% UI changes to the existing admin login modal.
-
Hosting & CI/CD: Multi-target Docker builds via Dodil Git Actions deploying both
law-blog-webandlaw-blog-adminto Dodil Ignite, plus a scheduled 6-hour sync workflow.
Milestone 1: Dodil CLI & Private Repo Setup on Windows
Environment: Windows 10, PowerShell 5.1, Git 2.50.
Friction #1: Windows install.ps1 fails on PowerShell 5.1
Running the official Windows installer failed at line 89 because [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture returns $null on Windows PowerShell 5.1, breaking architecture detection.
Workaround: Patching install.ps1 locally to use [Environment]::Is64BitOperatingSystem got dodil CLI installed cleanly, followed by dodil auth login --web.
Friction #2: Repo visibility flag & non-TTY dodil git setup
-
dodil git repo createrejects--private; the actual flag is--visibility private. - Running
dodil git setupinside VS Code's integrated terminal failed because it tries to generate an SSH key interactively when~/.sshis empty, which errors out in non-TTY shells.
Workaround: Skip SSH and use the built-in HTTPS credential helper instead:
dodil git credential-helper install
git -c core.askPass="" push -u dodil feat/dodil-migration
Passing -c core.askPass="" prevents Windows Git Credential Manager from popping up and conflicting with Dodil's credential helper.
Milestone 2: Migrating Supabase Postgres β Dodil KΒ³ Postgres
Because pg_dump and psql weren't installed on this Windows machine, we avoided heavy local tooling by generating DDL via Prisma and exporting data with a read-only Node/Prisma script:
yarn workspace @law-blog/database prisma migrate diff `
--from-empty `
--to-schema-datamodel prisma/schema.prisma `
--script > ..\Backup\schema.sql
Then we provisioned a KΒ³ bucket (dodil data bucket create law-blog) and pushed the schema via dodil data pg -b law-blog -f schema.sql --continue-on-error --report report.tsv.
This immediately surfaced three important SQL compatibility differences on Dodil KΒ³:
Friction #3: CREATE TYPE ... AS ENUM is not permitted (SQLSTATE 42501)
ERROR: permission denied: CREATE TYPE is not permitted (SQLSTATE 42501)
Because our User model used Postgres Role and Status ENUMs, table creation failed for User.
Fix: Converted role and status to String columns with defaults (@default("AUTHOR"), @default("PENDING")) in schema.prisma, and exported TypeScript Role / Status constants and union types from @law-blog/database so type safety stayed 100% intact across the monorepo.
Friction #4: ON DELETE CASCADE is not supported (SQLSTATE 0A000)
ERROR: FOREIGN KEY "_PostToTag_A_fkey": ON DELETE CASCADE is not supported.
This engine enforces referential integrity as NO ACTION / RESTRICT...
Fix: Removed onDelete: Cascade from schema.prisma (keeping standard RESTRICT foreign keys) and audited every .delete() call in admin/. In deletePost, we explicitly disconnected join relations (categories, tags, legalDocs) and deleted PostViewStat records before deleting the parent Post.
Friction #5: Statement-by-statement RTT latency in dodil data pg -f
Running a 45-statement SQL file via dodil data pg -f executes each statement sequentially over network RTT (~1s/statement). For bulk data import, connecting directly over pgwire with a scoped dk_ API key (k3.editor) and Prisma createMany (batched in chunks of 100) was dramatically faster.
Because KΒ³ limits concurrent readers per bucket, we appended &connection_limit=8 to both DATABASE_URL and DIRECT_URL:
postgresql://dodil:<REDACTED>@pg.uk-lon-1.dodil.io:5432/law-blog?sslmode=require&connection_limit=8
Result: 14/14 tables (including _CategoryToPost, _PostToTag, _LegalDocumentToPost) achieved 100% row-count parity, and both app and admin passed tsc --noEmit and local read/write smoke tests.
Milestone 3: Integrating Dodil AppId (With 0% Login UI Changes)
The client wanted to keep their existing AuthModal UI and bcrypt password hashes from Supabase intactβno extra login buttons or forced password resetsβwhile backing authentication and account revocation with Dodil AppId.
Provisioning & CLI Gotcha
We created a User Pool (law-blog, --with-local, --allow-signup=false) and registered a first-party PKCE OAuth client (law-blog-admin).
Friction #6: Issuing an API key with --role appid.admin failed with role appid.admin does not exist until we explicitly passed --service appid-authorization-service (the CLI defaults to KΒ³'s authorization service).
Backend Integration
- Added an official REST client (
admin/src/lib/dodilAppId.ts) talking directly tohttps://api.dodil.io/v1/appid/pools/...(zero HTML scraping). - Registered the OIDC provider
dodil-appid(PKCE + state) alongsideCredentialsinadmin/src/auth.ts. - On login, the server validates the user against KΒ³ Postgres (
SUPERADMIN/AUTHORroles, hard-blockingPENDING/LOCKED/BANNED), resolves/syncs theirappidSubon Dodil AppId, and attaches it to the NextAuth JWT session. - Hooked our existing
/lock-accountemergency lock flow (EmergencyLockToken) into AppId'sPOST .../users/{id}/banandPOST .../users/{id}/sessions/revokeendpoints so locking an account immediately bans and revokes sessions in AppId as well.
One-Way Sync Script (scripts/sync-from-supabase.mjs)
To keep Dodil automatically up to date while Supabase remains the primary write source, we wrote a read-only sync script (yarn sync:dodil) that:
- Reads Supabase
Userrows using"role"::textand"status"::textto bridge the Supabase ENUM β KΒ³ String difference cleanly. - Avoids raw
UPSERT(respecting KΒ³'s pgwire constraints) and syncs all 10 entity tables, 3 MβN join tables, 14-day incrementalPostViewStatrows, and AppId user/ban states.
Milestone 4: CI/CD from Dodil Git β Dodil Ignite
Dodil Git runs GitHub Actions-compatible workflows from .github/workflows/*.yml and deploys containers declaratively via .dodil/deploy.yamlβand supports deploying multiple apps from a single monorepo.
Preparing the Monorepo for Ignite Containers
-
Prisma binary targets: Added
binaryTargets = ["native", "debian-openssl-3.0.x"]inschema.prisma. -
Conditional standalone mode: Enabled
output: "standalone"(withoutputFileTracingRoot) only whenSTANDALONE=trueso Docker images stay lean (~129MB, <400ms startup) without affecting Vercel builds. -
Health endpoints: Added
/api/healthroutes on bothappandadmin(Ignite pods crash-loop if the configured readiness probe returns 404). -
Numeric non-root user: Ignite enforces
runAsNonRooton Kubernetes and rejects string usernames likeUSER nextjsβyourDockerfilemust use a numeric UID (USER 1001). -
Secrets hygiene: Uploaded all runtime secrets via
dodil git secret set law-blog <NAME>overstdin. Crucially,SUPABASE_DATABASE_URLis only exposed to the sync workflowβnever to the live Web/Admin containers.
.dodil/deploy.yaml Highlights
- Declared both
law-blog-webandlaw-blog-adminunder a shared group (create_if_missing: true). - Set
public_invoke: trueon both apps (by default, Ignite blocks anonymous traffic with401). - Set
AUTH_TRUST_HOST: "true"andAUTH_URLonlaw-blog-adminso NextAuth v5 works cleanly behind Ignite's reverse proxy withoutUntrustedHosterrors. - Did a two-pass deploy: Pass 1 provisioned the Ignite apps and generated their public hostnames; Pass 2 updated AppId's redirect URIs and
NEXT_PUBLIC_*secrets, then rebuilt the client bundles sositemap.xml,feed.xml, and OAuth callbacks pointed to the live Ignite URLs.
Four Real CI/CD & Runtime Frictions We Solved
-
Local proxy TLS error (
x509): Ifhttp_proxy/https_proxyare present in your local shell,dodil.exefails withx509: certificate signed by unknown authority. Clearing those env vars in the shell fixes it immediately. -
Runner missing global
yarn: Oncatthehacker/ubuntu:act-latestafteractions/setup-node@v4, globalyarnwasn't onPATH, failing our sync job. Fix: invoke the committed Yarn 3 binary directly vianode .yarn/releases/yarn-3.6.1.cjs. -
Cron schedules only run on the default branch:
dodil git run schedulesignoreson: scheduleworkflows until the branch containing them is set as the repository's default branch in Dodil Git settings (manualworkflow_dispatchworks on any branch). -
DuckDB Boolean Subquery Bug on KΒ³ (
SQLSTATE 42601): After deployinglaw-blog-web, post and category lists came back empty. The logs revealed:
Conversion Error: Could not convert string '\u{1}' to BOOL
Prisma's post.count({ where: { published: true } }) and _count subqueries triggered a boolean typing mismatch in KΒ³'s DuckDB pgwire layer.
Fix: Replaced count / _count with findMany({ where, select: { id: true } }).length and include: { posts: { select: { published: true } } }, and replaced postViewStat.upsert with findUnique + update/create (avoiding a KΒ³ upsert quirk). Redeployed v4 and all live pages, categories, RSS feed, sitemap, and view counters worked cleanly with zero Prisma errors.
Honest Verdict: What Worked Great vs. What Needs Polish
What I Liked
-
Unified developer experience: Having Git, Container Registry, Postgres (KΒ³), OIDC Auth (AppId), and Serverless Containers (Ignite) under one CLI and one
deploy.yamlis genuinely refreshing. -
dodil git ci verify: Catching misconfigured secrets, branch names, anddeploy.yamlschema issues before pushing saved multiple wasted CI cycles. -
Multi-app monorepo support: Deploying both
webandadminfrom a single multi-targetDockerfileworked cleanly out of the box. - Fast cold/warm starts: Next.js standalone containers booted in under 400ms on Ignite.
Rough Edges for the Dodil Team
-
Windows PowerShell 5.1 installer:
install.ps1should fall back gracefully whenRuntimeInformation::OSArchitectureis$null. -
KΒ³ Postgres compatibility docs & DuckDB boolean bug: The
ENUM(42501) andON DELETE CASCADE(0A000) error messages are actually very clear, which helped a lotβfixing the DuckDB boolean subquery conversion ('\u{1}' to BOOL) would make Prisma apps work out of the box without query rewrites. -
CLI ergonomics: Making
dodil auth apikey issue --role appid.admininfer--service appid-authorization-serviceautomatically (or printing the exact flag in the error message) would save debugging time.
Overall, migrating a full Next.js 15 + Prisma + NextAuth monorepo to Dodil Cloud's Free Tier is completely viable todayβas long as you know about KΒ³'s SQL differences and Ignite's container rules ahead of time. Hopefully this log saves you a few hours if you're trying it yourself!
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.

