When I first started working on the Lavandería CRM project, I never imagined that one of the biggest challenges I'd face would be migrating our API from NestJS to Next.js API Routes. As a full-stack developer, I've had my fair share of migrations, but this one was different. It wasn't just about changing the framework; it was about streamlining our entire development process and improving the overall user experience.
The problem we were facing was that our current API setup was becoming increasingly cumbersome. With NestJS, we were having to deal with a lot of overhead, and it was starting to slow down our development pace. We needed a more agile and efficient solution that would allow us to quickly deploy changes and updates. That's when we decided to migrate to Next.js API Routes. The context was clear: we were building a CRM system for a laundry business in Playa del Carmen, and we needed a robust and scalable API to handle the demands of the application.
As I delved deeper into the migration process, I realized that it wasn't going to be a straightforward task. I started by exploring the Next.js API Routes documentation and trying to understand how it differed from NestJS. I spent hours poring over the official guides and tutorials, but I soon realized that I needed a more hands-on approach. I decided to start by building a small test API using Next.js API Routes to get a feel for how it worked. This was my first attempt at solving the problem, and it was a valuable learning experience. I quickly discovered that Next.js API Routes were much simpler and more intuitive than NestJS, but they also required a different mindset and approach.
However, things didn't go as smoothly as I had hoped. When I tried to deploy my test API to Vercel, I ran into a series of issues. The first problem I encountered was that Vercel wasn't recognizing my Next.js project, and I had to add a vercel.json file to specify the framework and build command. This was a frustrating experience, but I learned a valuable lesson about the importance of configuration files in deployment. I also realized that I had to update my CLAUDE.md and CLAUDE_CODE_CONTEXT.md files to reflect the changes I had made to the project. This was a tedious task, but it was essential for maintaining a clear and accurate record of our project's history and context.
As I continued to work on the migration, I encountered another major hurdle. I had to rewrite our entire API using Next.js API Routes, which meant rethinking our entire API architecture. This was a daunting task, but I was determined to see it through. I spent hours rewriting code, testing, and debugging, but eventually, I started to make progress. I added new routes for booking and driver management, and I even implemented a quick links feature in the sidebar. The code for this feature was relatively straightforward, but it required a good understanding of Next.js and React.
For example, I added the following code to our layout.tsx file to implement the quick links feature:
const QUICK_LINKS = [
{ href: "/booking", icon: "📲", label: "Booking público", desc: "Para clientes" },
{ href: "/driver", icon: "🚚", label: "Vista repartidor", desc: "Para repartidores" },
];
I also added new routes for booking and driver management, using the Next.js API Routes syntax. For example:
import { NextRequest } from 'next/server';
import { prisma } from '@/lib/prisma';
import { ok, err } from '@/lib/api-helpers';
// POST /api/booking — sin autenticación, para clientes
export async function POST(request: NextRequest) {
const { name, email, phone } = await request.json();
const booking = await prisma.booking.create({
data: {
name,
email,
phone,
},
});
return ok(booking);
}
The solution to our API migration problem was finally starting to take shape. After weeks of hard work, we had successfully migrated our API to Next.js API Routes, and it was running smoothly. We had also implemented a range of new features, including quick links, booking, and driver management. The experience had been challenging, but it had also been incredibly rewarding.
As I look back on the migration process, I realize that I learned a lot about perseverance and adaptability. I also learned the importance of taking a step back and re-evaluating our approach when things aren't working. In this case, migrating to Next.js API Routes was the right decision, but it required a lot of effort and dedication. One of the key lessons I learned was the importance of testing and debugging. I spent hours testing and debugging our API, and it was essential for ensuring that everything was working as expected.
So, what's next? Now that we've completed the migration, we're focusing on refining and improving our API. We're also exploring new features and functionality, such as integrating AI and machine learning into our application. The possibilities are endless, and I'm excited to see where this journey takes us. As for me, I'm looking forward to continuing to learn and grow as a developer. I'm excited to take on new challenges and to explore new technologies and frameworks. The world of development is constantly evolving, and I'm thrilled to be a part of it.
Part of my Build in Public series — sharing the real process of building Building Lavandería CRM from Playa del Carmen, México.
Repo: zaerohell/lavanderia-crm · 2026-06-20
#playadev #buildinpublic
Top comments (0)