DEV Community

Haripriya Veluchamy
Haripriya Veluchamy

Posted on

🚀 My First Microservice Deployment Journey: Lessons from Amplify + Next.js

When I started working on launching web app, I wanted to try something new: deploy two microservices with a connected strategy.

  • One repo for backend (API + IaC).
  • One repo for frontend (Next.js app).
  • A CodePipeline for backend that provisions Amplify and references the frontend repo.
  • On commit, Amplify picks up changes and hosts the site.

This was my first real microservice deployment, connecting two services in one flow. I was excited, but also a bit lost.


⚡ The Confusion Phase

At first, I thought: “Frontend is just Next.js, why not use next export and push static files? Amplify loves static hosting!”

So I configured it that way. The build succeeded, the deployment was lightning fast.

But when I opened the site… disaster:

  • Dynamic routes didn’t work
  • API routes were missing
  • Auth and SSR pages broke

That was my first microservice reality check: deployment strategy matters more than just “getting it running.”


🔑 The Breakthrough: Standalone Mode

After a lot of reading and trial-and-error, I discovered Next.js standalone mode.

// next.config.js
const nextConfig = {
  output: 'standalone',
};

module.exports = nextConfig;
Enter fullscreen mode Exit fullscreen mode

Instead of exporting static HTML, this packaged a minimal Node.js server bundle. When Amplify deployed it, suddenly everything worked:

  • âś… SSR pages
  • âś… Dynamic routes
  • âś… API routes
  • âś… Hybrid static + dynamic content

That’s when I realized: I don’t need to separate static vs dynamic apps — standalone mode handles both.


🛠️ My Deployment Strategy

Here’s how I structured it:

  • Backend pipeline (CodePipeline) → deploys infrastructure + creates Amplify app referencing frontend repo.
  • Frontend repo → contains buildspec.yml + standalone Next.js config.
  • Amplify → automatically builds and deploys on commit.

This way, backend and frontend stay decoupled as microservices, but still integrate in the pipeline.


🌟 Lessons from My First Microservice Deployment

  1. Don’t force static exports on dynamic apps — it breaks SSR and APIs.
  2. Standalone mode is the right fit for Amplify + Next.js microservices.
  3. Keep backend and frontend pipelines separate — but connect them smartly through IaC.
  4. The right deployment strategy saves you from debugging chaos later.

✨ Final Thought

This was my first microservice deployment where I connected backend and frontend pipelines. I was confused, tried the wrong approach, but eventually found the right strategy.

Now, the pipeline runs smooth: backend infra deploys, Amplify auto-builds the frontend, and Dev/Prod stages are stable.

Looking back, I realize the real win wasn’t just hosting the app it was learning how to design a deployment strategy that connects services the right way.


Top comments (0)