E-commerce Migration: From Strapi and Neon to Next.js + Payload CMS v3 and Turso
1. The Challenge of Traditional Infrastructure
The B2B e-commerce and corporate catalog of DP-FIRE Chile (the official representatives of Kidde Fire Systems in Chile) required a robust backend for managing products and quotes. Initially, the architecture consisted of a Next.js client application connected to an independent Strapi CMS server on Render (incurring a fixed cost of $25.00 USD per month due to its memory requirements) and a PostgreSQL database on Neon (priced at $14.00 USD monthly).
With a total expenditure of $39.00 USD monthly just for the e-commerce module, management’s goal was clear: minimize fixed infrastructure costs without compromising site performance or the team’s autonomy to update the catalog.
2. Key Architectural Decisions
To address this financial and performance challenge, the system was completely restructured using a coupled approach and serverless databases at the Edge.
graph LR
subgraph "PREVIOUS ARCHITECTURE (E-commerce)"
NextJS_Prev[Next.js App] -->|REST API| Strapi[Strapi CMS on Render]
Strapi -->|SQL Queries| Neon[Neon PostgreSQL Database]
end
subgraph "CURRENT ARCHITECTURE (E-commerce)"
NextJS_New[Next.js + Payload CMS v3] -->|Local DB Call| Turso[Turso libSQL Database Edge]
end
2.1. From Strapi to Payload CMS v3 (Coupled Architecture)
In traditional decoupled (Headless) architectures, Strapi must run on a Node server continuously 24 hours a day. On free or low-cost instances (like Render), inactivity causes the server to sleep, resulting in unacceptable loading latencies (cold starts) for clients. This forced the company to pay for a dedicated $25.00 USD monthly instance.
The Solution: We replaced Strapi with Payload CMS v3. Starting with version 3, Payload CMS integrates in a coupled manner directly within the Next.js framework as a native route (app/(app)/api/...). This allows us to:
- Host the CMS within the same infrastructure as the frontend (on Railway, sharing the environment).
- Eliminate the dedicated CMS hosting cost to $0 USD.
- Benefit from direct local database calls, improving response times.
2.2. From Neon (PostgreSQL) to Turso (SQLite at the Edge)
Neon charged a minimum plan of $14.00 USD monthly for database storage and computing.
By switching to Payload CMS v3, we leveraged its native support for SQLite and libSQL databases using the @payloadcms/db-sqlite adapter.
The Solution: We migrated the data to Turso, a relational database based on libSQL optimized for the Edge.
- Turso distributes copies of the database globally to Edge locations close to users, guaranteeing ultra-fast queries.
- It offers a generous free tier covering up to 500 databases and 9GB of storage.
- Monthly fixed cost: $0.00 USD.
3. Results and Return on Investment
Migrating to this modern architecture not only improved performance and page load speeds, but also achieved a direct financial impact:
- Previous monthly cost: $39.00 USD (E-commerce alone)
- Current monthly cost: $0.00 USD additional (hosted within the shared active-usage Railway cost).
- Net savings: $468.00 USD annually just for the e-commerce section.
This demonstrates how the strategic use of Serverless Edge technologies and integrated frameworks like Payload CMS v3 and Next.js allows startups and medium-sized enterprises to optimize cash flows by reducing fixed maintenance costs.