Niraj Chauhan

Niraj Chauhan

#father #husband #SoftwareCraftsman #foodie #gamer #OnePiece #naruto

Why Travelopia is Transitioning from Vercel to AWS Amplify?

Posted by on

At Travelopia, we have long relied on a robust stack of frontend and backend technologies, primarily using ReactJS and NestJS. This combination served us well for years, offering flexibility and power. However, when Next.js introduced server actions, we were eager to explore the potential benefits.

The Promise of Next.js Server Actions

We began with a single project to test the waters, and the results were promising. The developer experience was nothing short of amazing. The team became more efficient and productive because we could now build both frontend and backend within the same repository. Developers no longer had to worry about separating server calls from frontend code, which significantly sped up our development process.

Simplifying Deployments with Vercel

Previously, our deployment process involved deploying the NestJS backend on AWS ECS-Fargate, while the React SPA was hosted on AWS S3 and CloudFront. This was all managed through GitHub Actions and Infrastructure as Code (IAC) with AWS CDK. However, with Next.js, our deployment pipeline became much simpler. We opted for Vercel as our hosting provider, which allowed us to skip writing custom CI/CD scripts and CDK configurations. Vercel’s features, such as preview deployments and environment variable management, further enhanced our productivity.

The Challenges with Vercel

While Vercel was an excellent solution for most of our needs, we hit a roadblock as our projects grew. Many of our new projects required dedicated databases, and our security guidelines mandated that database connections should not be public. In our previous setup, with everything within the same VPC, this was easily managed. The backend was exposed via a load balancer, and the database remained private, accessible only by the Fargate service.

Vercel, however, did not provide a straightforward solution for private databases. The only viable option was VPC peering, which was available only with their Enterprise plan—a significant cost increase from our existing “Pro” plan. Upgrading to an Enterprise plan would have increased our costs tenfold, which was unjustifiable for us.

Exploring Alternatives: SST.dev and AWS Amplify

Faced with these challenges, we began exploring alternatives. Our search led us to SST.dev, a serverless framework built on top of AWS CDK. SST.dev allowed us to deploy Next.js applications on AWS while maintaining the same level of control and security we had with our previous stack. However, the impending migration of SST.dev from CDK to Terraform posed a challenge, as we were not ready to shift to Terraform.

This led us to discover AWS Amplify, another serverless framework built on top of AWS CDK. AWS Amplify offered the perfect balance between simplicity and control. It allowed us to deploy Next.js applications on AWS, manage environment variables, and perform preview deployments—all without the need for custom GitHub Actions or CDK scripts. Importantly, since Amplify operates within AWS, we could keep our databases private, adhering to our security guidelines.

The Financial Impact

One of the most significant benefits of moving to AWS Amplify was the cost savings. Vercel’s pricing model, based on developers, build minutes, and data transfer, quickly became expensive, especially as our team grew. With AWS Amplify, however, pricing is based solely on traffic, making it a much more cost-effective solution. Our monthly bills dropped from $150-$200 on Vercel to just $10-$30 with AWS Amplify—a substantial saving.

Vercel-AWS-meme

Conclusion

Our journey from Vercel to AWS Amplify was driven by a need for more control, better security, and cost efficiency. While Vercel offered an excellent developer experience, its limitations in handling private databases and the high cost of upgrading to an Enterprise plan made it unsustainable for our growing needs. AWS Amplify emerged as the ideal solution, offering the simplicity of Vercel with the power and flexibility of AWS. The transition not only met our technical and security requirements but also resulted in significant cost savings, allowing us to scale our projects without breaking the bank.

If you’re navigating similar challenges with your Next.js deployments, considering alternatives like AWS Amplify could be a game-changer for your team’s productivity and your project’s bottom line.