<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Rob Myers</title>
    <description>The latest articles on Forem by Rob Myers (@b_myers).</description>
    <link>https://forem.com/b_myers</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2645070%2F96ed8e83-1f89-42f1-b209-8cf1356a2ec7.png</url>
      <title>Forem: Rob Myers</title>
      <link>https://forem.com/b_myers</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/b_myers"/>
    <language>en</language>
    <item>
      <title>Microservices are Dead! Long Live Microservices</title>
      <dc:creator>Rob Myers</dc:creator>
      <pubDate>Fri, 29 Aug 2025 11:58:27 +0000</pubDate>
      <link>https://forem.com/b_myers/microservices-are-dead-long-live-microservices-35md</link>
      <guid>https://forem.com/b_myers/microservices-are-dead-long-live-microservices-35md</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;The original article was published at: &lt;a href="https://buildmicroservicesingo.com/guide/microservices-are-dead-long-live-microservices" rel="noopener noreferrer"&gt;Build Microservices in Go - Microservices are Dead! Long Live Microservices&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you’ve scrolled through tech Twitter/X or reddit lately, you’ve probably seen people declaring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Microservices were a mistake!&lt;/li&gt;
&lt;li&gt;Microservices are dead!&lt;/li&gt;
&lt;li&gt;Microservices are a scam!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;but thats just a catchy ragebait lol&lt;/p&gt;

&lt;p&gt;But here’s the truth: microservices are not dead. They’re very much alive, running inside almost every major tech company you use daily.&lt;/p&gt;

&lt;p&gt;So why do people keep writing eulogies for them? And as a junior developer, should you even bother learning microservices?&lt;/p&gt;

&lt;h2&gt;
  
  
  Are Microservices Really Dead? (Ignore the Clickbait)
&lt;/h2&gt;

&lt;p&gt;The “microservices are dead” claim usually comes from frustration. Teams move from a simple monolith to dozens of microservices, and suddenly their infrastructure feels like it’s held together with duct tape and YAML files.&lt;/p&gt;

&lt;p&gt;They built systems that were overly complex, difficult to debug, and harder to maintain than a well-structured monolith would have been. When these projects inevitably became nightmares to work with, then frustration comes out.&lt;/p&gt;

&lt;p&gt;Just because some people got food poisoning from poorly prepared sushi doesn't mean raw fish is inherently dangerous. It means you need to know what you're doing and choose the right context for your approach.&lt;/p&gt;

&lt;p&gt;But that doesn’t mean microservices are obsolete. It means they are &lt;strong&gt;misused&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Unpopular Truth: Most of the Industry Runs on Microservices
&lt;/h2&gt;

&lt;p&gt;Here’s the reality:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Netflix, Amazon, Uber, and Spotify still rely heavily on microservices.&lt;/li&gt;
&lt;li&gt;Kubernetes, Docker, and gRPC weren’t built for monoliths — they were built for distributed systems.&lt;/li&gt;
&lt;li&gt;Most “microservices are dead” articles end up suggesting… modular monoliths. Which, ironically, is just a step on the journey toward microservices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you order food through DoorDash, you're interacting with dozens of different services. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User authentication service, &lt;/li&gt;
&lt;li&gt;payment processing service, &lt;/li&gt;
&lt;li&gt;restaurant management service, &lt;/li&gt;
&lt;li&gt;delivery tracking service, &lt;/li&gt;
&lt;li&gt;notification service &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All work together seamlessly. Each service can be developed, deployed, and scaled independently by different teams.&lt;/p&gt;

&lt;p&gt;This isn't because these companies enjoy complexity for its own sake. It's because microservices solve real problems that emerge at scale:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Team autonomy&lt;/strong&gt;: Different teams can work on different services without stepping on each other's toes&lt;/li&gt;
&lt;li&gt;T*&lt;em&gt;echnology diversity&lt;/em&gt;*: Your payment service might be written in Java for its robust ecosystem, while your real-time tracking service uses Go for its excellent concurrency primitives&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Independent scaling&lt;/strong&gt;: You can scale your order processing service during dinner rush without scaling your user profile service&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fault isolation&lt;/strong&gt;: If the recommendation service goes down, users can still place orders&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Understanding the Evolution of Microservices
&lt;/h2&gt;

&lt;p&gt;In the early days of web applications, most companies started with monoliths because they made sense. Small teams, simple requirements, and limited traffic meant that a single, well-organised application was often the right choice.&lt;/p&gt;

&lt;p&gt;To appreciate microservices, you need to see the bigger picture of software architecture:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Monoliths – The classic “everything in one codebase.” Great for speed when you’re small.&lt;/li&gt;
&lt;li&gt;Service-Oriented Architecture (SOA) – Larger systems are split into services, often with heavier protocols like SOAP.&lt;/li&gt;
&lt;li&gt;Microservices – SOA’s younger, leaner cousin. Services are smaller, communicate over HTTP/gRPC, and are independently deployable.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Think of it like city planning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A monolith is a single skyscraper with everything inside.&lt;/li&gt;
&lt;li&gt;A modular monolith is a skyscraper with floors clearly divided for different tenants.&lt;/li&gt;
&lt;li&gt;Microservices are like a neighborhood of buildings — each one specialized, independent, and connected by roads.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common Use Cases for Microservices
&lt;/h2&gt;

&lt;p&gt;Microservices shine when you’re dealing with large, complex systems where different parts of the business have very different scaling and reliability needs. Instead of one massive codebase, companies break down functionality into smaller, specialized services that can evolve independently.&lt;/p&gt;

&lt;p&gt;How about a real-life example: yeah, you guessed it: Netflix.&lt;/p&gt;

&lt;p&gt;Netflix is often the poster child for microservices. When you hit play on a movie, you’re not talking to one giant app. Instead, you’re hitting dozens of microservices working together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A recommendation service that suggests what to watch next.&lt;/li&gt;
&lt;li&gt;The streaming service that delivers video at the right quality for your connection.&lt;/li&gt;
&lt;li&gt;And the billing service that makes sure your subscription is up to date.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are just a few of the services they run. The real architecture is much more complex than this.&lt;/p&gt;

&lt;p&gt;By splitting these responsibilities, Netflix can update its recommendation algorithms without risking outages in video playback. Each part scales independently — streaming traffic during peak hours won’t overload billing.&lt;/p&gt;

&lt;p&gt;As you see, microservices aren’t just a “tech trend.” They’re how modern enterprises like Netflix, Amazon, and Uber keep systems reliable, scalable, and resilient in the face of millions of requests per second.&lt;/p&gt;

&lt;h2&gt;
  
  
  When You Shouldn’t Use Microservices
&lt;/h2&gt;

&lt;p&gt;Here’s the truth that rarely makes it into conference talks: most teams don’t need microservices.&lt;/p&gt;

&lt;p&gt;Surprising take from someone who has a microservices course? It can be if I were trying to push you to use microservices for everything, but that's not the case.&lt;/p&gt;

&lt;p&gt;Microservices are powerful, but they also come with heavy costs — deployments, networking, observability, and debugging across services. If you introduce them too early, you’ll spend more time managing infrastructure than building features.&lt;/p&gt;

&lt;p&gt;There are plenty of situations where a modular monolith is usually the smarter choice:&lt;/p&gt;

&lt;h3&gt;
  
  
  Solo founders and early-stage startups
&lt;/h3&gt;

&lt;p&gt;I once spent two weeks setting up a “proper” microservices architecture for a side project… that never got a single paying user. I would have been better off with a simple monolith and a Stripe button.&lt;/p&gt;

&lt;p&gt;Lesson learned: Don't be one of those startups that build “enterprise-grade” architecture before having a single paying customer — and collapse under the weight of their own complexity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Small Engineering Teams
&lt;/h3&gt;

&lt;p&gt;A company with fewer than 10 engineers rarely needs microservices. Why? The complexity will slow you down. A cleanly structured monolith can support years of growth before you hit real scaling limits.&lt;/p&gt;

&lt;p&gt;Don’t treat microservices as a badge of “serious engineering.” Treat them as a tool — one you reach for only when your monolith truly starts holding you back. Until then, keep it simple.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Learning About Microservices is Important for Developers
&lt;/h2&gt;

&lt;p&gt;If you’re aiming for a serious career in tech, understanding microservices is no longer optional — it’s a core skill that will set you apart in the job market.&lt;/p&gt;

&lt;p&gt;When I started interviewing for senior roles, I noticed a pattern: nobody asked if I could build a CRUD app. They asked: “How would you handle failures between services?” or “How would you design payments to be reliable?” Understanding microservices thinking gave me an edge.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://buildmicroservicesingo.com" rel="noopener noreferrer"&gt;my course&lt;/a&gt; because I couldn’t find anything that resembled what I saw in production environments. Most tutorials stop at “hello world” — I wanted to show how to wire up REST, gRPC, and events into something you’d actually see in a tech company.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Microservices aren’t dead. They’ve simply matured. Just like cloud computing or containerization, they’ve moved past hype and into the “boring but essential” stage.&lt;/p&gt;

&lt;p&gt;As a developer, your job isn’t to chase buzzwords.&lt;/p&gt;

&lt;p&gt;It’s to understand the trade-offs — when to use microservices, when to avoid them, and how to keep them from becoming a tangled mess.&lt;/p&gt;

&lt;p&gt;And don't worry, you'll still see plenty of "microservices are bad" articles and rants, but guess what? They aren't going anywhere.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>microservices</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Golang API Structure for Beginners</title>
      <dc:creator>Rob Myers</dc:creator>
      <pubDate>Mon, 11 Aug 2025 12:35:04 +0000</pubDate>
      <link>https://forem.com/b_myers/golang-api-structure-for-beginners-1of6</link>
      <guid>https://forem.com/b_myers/golang-api-structure-for-beginners-1of6</guid>
      <description>&lt;p&gt;If you are new to Go, or just want to get started with Go, I am sure you have asked yourself this at least once. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How do I structure my go project?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That question brings nightmares to new go devs or ones that have lots of experience with other languages like Java. Go likes to do things its way, so your previous experience is not helpful. Hell, they probably are an antipattern in Go world.  &lt;/p&gt;

&lt;p&gt;So what do you do? You go online and type "how to structure web app project in go" and then you get 100s of different opinions. The confusion never ends... &lt;/p&gt;

&lt;p&gt;Don't worry, my friend, the rescue is here. In this guide, I'll show you a battle-tested Go API structure that combines Clean Architecture principles, Domain-Driven Design, and real-world maintainability.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's a good project structure?
&lt;/h2&gt;

&lt;p&gt;The key elements of a good project structure are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separates core business logic from external concerns (databases, APIs, frameworks).&lt;/li&gt;
&lt;li&gt;Groups related features together so you’re not hunting through unrelated folders.&lt;/li&gt;
&lt;li&gt;Enforces a logical flow — from incoming HTTP request to business logic to data persistence.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Context switching is expensive. That's why if your services follow the same logical structure, you'll be able to work on any of them and be productive in no time. &lt;/p&gt;

&lt;h2&gt;
  
  
  Step-by-Step: Beginner-Friendly Golang API Folder Layout
&lt;/h2&gt;

&lt;p&gt;Let’s walk through the layout piece by piece so you know exactly how it works and why it exists.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user-service/
├── cmd/                 # Entry point(s)
├── internal/            # Core application logic
├── infrastructure/      # External systems
├── Makefile             # Simple build/run commands
└── openapi.yaml         # API contract documentation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looks simple enough, right?&lt;/p&gt;

&lt;p&gt;Let's see whats going on here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;cmd/&lt;/strong&gt; — Your app’s front door. This is where your HTTP server (or other apps like workers/CLI tools) live.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;internal/&lt;/strong&gt; - Your private workspace. Anything in here is for this project only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;infrastructure/&lt;/strong&gt; - Where external systems (like databases or third-party APIs) live—kept separate so swapping or upgrading is smooth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Makefile&lt;/strong&gt; — One command to make run or make test. Way more satisfying than long go commands.
openapi.yaml — Your API’s contract. Great for docs, client SDKs, or keeping consistent behavior when working with others.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. cmd/ – Your Application Entry Points
&lt;/h3&gt;

&lt;p&gt;The cmd/ directory is the front door to your application. Each subfolder here starts an independent instance of your app. The app will share its internal logic, but it'll be accessed in a different way.&lt;/p&gt;

&lt;p&gt;This is where you keep entry points—thin layers that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Load configuration.&lt;/li&gt;
&lt;li&gt;Initialize dependencies.&lt;/li&gt;
&lt;li&gt;Start a specific type of application (HTTP server, gRPC server, event consumer, cron job, etc.)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cmd/
├── http/               # Main REST/HTTP API
│   └── main.go
├── grpc/               # gRPC API server
│   └── main.go
├── events/             # Event consumer (Kafka, NATS, RabbitMQ)
│   └── main.go
└── worker/             # Background jobs/cron tasks
    └── main.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You want to keep the entry points as simple as possible, example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Load&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;deps&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;dependencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;deps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Load the config, intitalize dependencies, and start the transport layer, that's it. &lt;strong&gt;KISS (Keep It Stupid Simple)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Many new Go developers start with one main.go and then try to fit everything together: HTTP, gRPC, background jobs, and event processing all into the same process. This leads to bloated code and makes scaling harder.&lt;/p&gt;

&lt;p&gt;But if you work on a solo project, and crazy scaling is none of your concerns, then that's fine. &lt;/p&gt;

&lt;h3&gt;
  
  
  infrastructure/ – Where External Worlds Live
&lt;/h3&gt;

&lt;p&gt;If &lt;strong&gt;internal/&lt;/strong&gt; is your private home, then &lt;strong&gt;infrastructure/&lt;/strong&gt; is the garage, driveway, and cables connecting you to the outside world.&lt;/p&gt;

&lt;p&gt;Here we'll stuff all the code that interacts with external parts of our system. DB, Cache, Event Brokers, External APIs and anything else you can think of.&lt;br&gt;
If you have to call somebody else to handle the job, it goes here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;infrastructure/
├── db/                 # Database layer
│   ├── migrations/     # SQL schema changes
│   ├── models/         # DB-specific structs with tags
│   └── repos/          # Repository implementations
├── cache/              # Caching layer (Redis, Memcached)
│   └── redis.go
├── events/             # Event broker clients (Kafka, NATS, RabbitMQ)
│   ├── publisher.go
│   └── consumer.go
├── externalapi/        # Third-party API integrations
│   └── payment_client.go
└── storage/            # File/object storage (S3, GCS)
    └── s3_client.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why do you want to do that?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Isolation from your business logic – Your core modules shouldn’t know if data comes from Postgres or Mongo, Redis or Memcached, Kafka or NATS.&lt;/li&gt;
&lt;li&gt;Easy swaps – Change providers or services without rewriting your whole codebase.&lt;/li&gt;
&lt;li&gt;Testability – Replace real implementations with in-memory mocks during tests.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  internal/ – Where your app lives
&lt;/h3&gt;

&lt;p&gt;It’s the main home for your application logic, and Go’s compiler makes it private, so no one outside your repo can import it.&lt;/p&gt;

&lt;p&gt;This is exactly the structure we use in one of the microservices in the &lt;a href="https://buildmicroserviceingo.com/?utm_source=dev&amp;amp;utm_medium=article&amp;amp;utm_campaign=robmyers" rel="noopener noreferrer"&gt;Build Microservices in Go course&lt;/a&gt;, so you’re looking at a proven, real-world example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/internal/
  ├───config/
  │   ├───config.go
  │   └───utils.go
  ├───dependencies/
  │   └───dependencies.go
  ├───http/
  │   ├───server.go
  │   └───health/
  │       ├───router.go
  │       └───useCases/
  │           └───healthReady/
  │               └───controller.go
  ├───models/
  │   └───user.go
  └───modules/
      ├───auth/
      │   ├───module.go
      │   └───useCases/
      │       ├───login/
      │       │   ├───controller.go
      │       │   ├───dto.go
      │       │   └───service.go
      │       └───registerUser/
      │           ├───controller.go
      │           ├───dtos.go
      │           ├───events.go
      │           └───service.go
      └───profile/
          ├───module.go
          └───useCases/
              ├───getProfile/
              │   ├───controller.go
              │   ├───dto.go
              │   └───service.go
              └───updateProfile/
                  ├───controller.go
                  ├───dto.go
                  └───service.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an example structure of &lt;strong&gt;/internal&lt;/strong&gt; folder of our user service.&lt;/p&gt;

&lt;p&gt;Now, let's break it down, what's inside each folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;config/ — Centralized Configuration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is where you define how your app loads environment variables, config files, or any setup parameters.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;config.go holds your main config structs and parsing logic.&lt;/li&gt;
&lt;li&gt;utils.go might contain helpers for validating config or converting env values.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Having a dedicated config package keeps your settings organized and easy to maintain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;dependencies/ — Dependency Injection Hub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dependency injection can feel complex at first, but having a single place to wire all your dependencies makes your app easier to manage and test.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;dependencies.go is where you create and inject instances for DB connections, external clients, validators, and repositories.&lt;/li&gt;
&lt;li&gt;This means your main.go stays clean — it just calls into this package to get a ready-to-go app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;http/ — HTTP Server Setup &amp;amp; Routes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This folder is responsible for setting up your HTTP server and routing incoming requests to the right handlers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;server.go bootstraps the HTTP server, sets up middleware, and starts listening.&lt;/li&gt;
&lt;li&gt;The subfolder health/ is a great example of how to organize feature-specific routes (in this case, health check endpoints), including their own router and use cases.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This keeps HTTP concerns separate from your business logic inside modules/.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;models/ — Your Domain Models&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here you define your plain Go structs representing core business entities — for example, user.go holds your User model.&lt;/p&gt;

&lt;p&gt;These structs don’t know anything about the database or HTTP — they’re just pure representations of data in your domain. This separation makes your code easier to test and refactor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;modules/ — Organize by Business Features&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is where your actual business features live, grouped by domain for clarity and scalability.&lt;/p&gt;

&lt;p&gt;Each module (like auth/ or profile/) has its own:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;module.go&lt;/strong&gt; for wiring the module, registering routes, and initializing use cases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;useCases/&lt;/strong&gt; folder that contains all the individual workflows related to that feature, each with their own clear separation of concerns:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;controller.go&lt;/strong&gt; for HTTP request handling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;dto.go (or dtos.go)&lt;/strong&gt; for data transfer objects to validate and transfer data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;service.go&lt;/strong&gt; for the business logic itself.&lt;/li&gt;
&lt;li&gt;Optionally, &lt;strong&gt;events.go&lt;/strong&gt; for publishing domain events triggered by this use case.&lt;/li&gt;
&lt;li&gt;Or even their own repo if that's necessary.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;For example, the auth module’s login use case handles everything related to logging users in — controllers translate HTTP requests, services do the core work, and DTOs handle validation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this structure works so well for beginners and pros alike
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Clear boundaries: You always know where to add a new feature or fix a bug.&lt;/li&gt;
&lt;li&gt;Scalable: Adding a new domain or use case is as simple as creating a new folder inside modules/.&lt;/li&gt;
&lt;li&gt;Testable: Isolate business logic in services and DTOs, separate from HTTP handlers.&lt;/li&gt;
&lt;li&gt;Maintainable: Group related code together so your codebase doesn’t turn into a mess.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Ready to build your own scalable, maintainable Go APIs?
&lt;/h2&gt;

&lt;p&gt;This folder structure isn’t just theory — it’s the foundation of real-world microservices I teach in my &lt;a href="https://buildmicroserviceingo.com/?utm_source=dev&amp;amp;utm_medium=article&amp;amp;utm_campaign=robmyers" rel="noopener noreferrer"&gt;Build Microservices in Go course&lt;/a&gt;. If you want hands-on guidance, step-by-step project, and expert tips on building production-ready APIs and microservices, check it out.&lt;/p&gt;

&lt;p&gt;Start structuring your Go projects like a pro and take your skills to the next level today!&lt;/p&gt;

</description>
      <category>go</category>
      <category>programming</category>
      <category>microservices</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
