Sub topic 20
Knowing when to move to custom code
This chapter assumes you have shipped or are close to shipping an MVP on a no-code platform or AI app builder. It also assumes you have read the earlier chapters on metrics and on platform limits and lock-in. The goal is to decide, with evidence, whether to stay on your tools, patch around them, or rebuild in code.
Why the decision is hard
Moving to custom code is expensive. It costs weeks of work, and during the move you ship few new features. Staying too long is also expensive, because workarounds pile up and each one makes the eventual migration harder.
Two mistakes are common:
- Migrating early. The team dislikes the tool's quirks and rebuilds before the hypothesis is validated. The product may never have needed the rebuild.
- Migrating late. The team keeps stacking automations and plugins until a single change takes days and nobody understands the whole system.
A good decision rests on named triggers, measured against your own product, not on a general feeling that "real products use code."
Triggers that justify a move
Not every annoyance is a trigger. The signals below are strong enough to justify serious planning.
| Trigger | What it looks like | Is a workaround enough? |
|---|---|---|
| Hard platform limit | You need a capability the platform cannot do, such as a custom auth flow, a long-running job or a specific integration | Sometimes. A small external service or webhook handler can fill the gap |
| Cost curve | The bill grows faster than revenue, for example per-record, per-workflow-run or per-seat pricing | Only if you can restructure usage |
| Performance | Pages or queries slow down as data grows, and indexing or pagination options are limited | Rarely, if the cause is the platform's data layer |
| Compliance and data control | A customer requires a specific region, audit logs, or a contract the vendor cannot sign | No. This one is usually a hard requirement |
| Team and velocity | Changes need a fragile chain of workflows, and new contributors cannot reason about it | Partly, by documenting and simplifying |
| Lock-in risk | The vendor changes pricing or terms, or you cannot export your logic | Mitigate by exporting data regularly |
Compliance and hard capability gaps are the most decisive. Cost and performance are the most often misjudged, so measure them before acting.
Measure before you decide
Gather numbers for the last 30 to 90 days:
- Platform cost per active user, compared with revenue per active user.
- Time to ship a typical change, from request to production.
- Workaround count: how many features depend on external glue such as scripts, extra services or manual steps.
- Incident count: outages or data problems caused by platform behavior.
- Blocked roadmap items: features you have not built because the platform cannot support them.
The next script turns those numbers into a simple, repeatable check. The thresholds are examples, so replace them with values that fit your business.
// Returns the migration triggers that fired, given measured values.
export function migrationSignals(m) {
const signals = [];
if (m.platformCostPerUser > 0.3 * m.revenuePerUser) {
signals.push("cost: platform spend exceeds 30% of revenue per user");
}
if (m.medianDaysToShipChange > 5) {
signals.push("velocity: a typical change takes more than 5 days");
}
if (m.workaroundCount >= 5) {
signals.push("complexity: 5 or more features rely on external glue");
}
if (m.blockedRoadmapItems >= 3) {
signals.push("capability: 3 or more roadmap items are blocked");
}
if (m.hardRequirementUnmet) {
signals.push("compliance: a hard requirement cannot be met");
}
return signals;
}
const result = migrationSignals({
platformCostPerUser: 4.2,
revenuePerUser: 9.0,
medianDaysToShipChange: 7,
workaroundCount: 6,
blockedRoadmapItems: 1,
hardRequirementUnmet: false,
});
console.log(result);This prints three signals: cost, velocity and complexity. One signal usually means "watch it." Several signals together, or any hard requirement, mean "plan the move."
The decision path
Three options, not two
Treat the choice as a spectrum.
- Stay. Appropriate when the hypothesis is still unproven or growth is slow. Spend your effort on users, not infrastructure.
- Extract one component. Keep the no-code front end and database, and move the pain point, such as a billing calculation, an import job or a webhook handler, into a small service. This is often the best first step because it limits risk and teaches you the platform boundary.
- Full migration. Rebuild the app in a code framework. Choose this when the problems are spread across many parts, or when a hard requirement affects the whole system.
Extraction works best when your platform exposes data through an API or a standard database such as Postgres, because both sides can read the same records.
Planning a migration safely
If you choose a full migration, reduce risk with these steps.
- Export and verify your data. Confirm that you can get every table, including relationships and files, in a usable format. Check row counts against the live app.
- Write down the behavior. List every workflow, permission rule and integration as plain statements, such as "only the owner can edit a task." The old app is your specification, and these statements are your tests.
- Carry over the data model. If your tables already have clear ownership fields and access rules, they translate directly. Row-level security policies, for example, can move with a Postgres database.
- Migrate by slice. Move one user flow at a time and route traffic gradually, so you can compare results with the old system.
- Run both in parallel for a period. Keep the old app live and read-only fallback ready until the new one has handled real traffic.
- Avoid adding features during the move. A migration that also redesigns the product hides the cause of any new bug.
AI coding assistants help here. They can generate boilerplate and port a described workflow quickly. They do not remove the need for tests, so reuse the behavior list from step 2 to check what they produce.
Common errors
- Rebuilding for a technology reason with no business reason. "Code is cleaner" is not a trigger.
- Underestimating the hidden work. Auth, email, backups, monitoring and deployment were handled by the platform. You now own them.
- Losing data fidelity. IDs, timestamps and file links often break during export. Test the import with a copy first.
- Ignoring who will maintain it. If nobody on the team can maintain code, a migration shifts the bottleneck instead of removing it.
- Moving before validation. If users have not confirmed the problem, the rebuild may polish the wrong product.
Exercise
Your task app runs on a no-code platform. Your measurements show the platform costs 12% of revenue per user, changes take 3 days to ship, you have 2 workarounds and 1 blocked roadmap item, and no customer has asked for a compliance feature you cannot provide. Should you migrate to custom code? What is the better next step?
Show answer
No. Using the example thresholds, none of the signals fire, since cost is under 30%, shipping time is under 5 days, workarounds are under 5 and blocked items are under 3. With no hard requirement unmet, the right choice is to stay, keep exporting data regularly, and review the measurements next quarter. If the one blocked item becomes important, extract only that piece into a small service instead of rebuilding the whole app.