service-structure

Explain dual-binary microservice architecture with main and worker services.

Updated Feb 10, 2026
One-click install
npx skills add https://github.com/vesviet/microservices-agent-skills --skill service-structure
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: service-structure
Source: https://github.com/vesviet/microservices-agent-skills/tree/main/skills/service-structure
Command: npx skills add https://github.com/vesviet/microservices-agent-skills --skill service-structure

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill clarifies the standard dual-binary architecture (main service and worker) used in microservices, helping developers understand where to place different types of logic and how services are deployed.

Core Features & Use Cases

  • Architecture Explanation: Details the purpose and separation of concerns between the main service (API requests) and the worker service (background tasks).
  • Directory Structure: Provides a clear visual breakdown of the project's directory layout for both binaries.
  • Deployment Guidance: Explains how the main and worker services are deployed separately in Kubernetes using the same Docker image.
  • Use Case: When starting a new microservice, use this Skill to ensure you correctly set up the main API binary and the background worker binary, placing event consumers, cron jobs, and outbox processors in the appropriate worker components.

Quick Start

Explain the dual-binary architecture for a microservice, detailing the main service and worker components.

Frequently Asked Questions about service-structure

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is dual-binary microservice architecture and when should I use it?

Dual-binary microservice architecture splits logic into a main service handling API requests and a worker service managing background tasks like cron jobs and event consumption. Use it to separate synchronous API traffic from asynchronous processing workloads.

How do I structure a microservice project with separate API and worker binaries?

Structure a dual-binary microservice project by maintaining a shared directory layout for both binaries, placing event consumers and outbox processors in the worker component while keeping API request handlers in the main service binary.

How do I deploy a dual-binary microservice in Kubernetes using the same Docker image?

Deploy dual-binary microservices in Kubernetes by running the same Docker image with different entrypoint commands, launching the main service and worker service as separate deployments to scale API requests and background tasks independently.

Does the Kratos framework support a dual-binary worker pattern for background tasks?

The Kratos framework supports a dual-binary worker pattern by implementing the ContinuousWorker interface, which manages background processes like cron jobs and event consumption within the dedicated worker service binary.

Where should I place event consumers and cron jobs in a microservice architecture?

Place event consumers, cron jobs, and outbox processors in the worker service binary of a dual-binary microservice architecture, keeping the main service binary dedicated to handling synchronous API requests for optimal resource allocation.