close

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)