> For the complete documentation index, see [llms.txt](https://docs.rumi.systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rumi.systems/rumi-core/guides/developing-applications/microservice-template.md).

# Microservice Template

Rumi provides two built-in microservice templates that implement different consensus models for maintaining state consistency across clustered microservice instances.

## Available Templates

### [State Replication Template](/rumi-core/guides/developing-applications/microservice-template/state-replication-template.md)

Uses Rumi's State Replication consensus model where state changes are automatically replicated across all instances by the runtime. State is modeled using ADM (Application Data Model) and is transparent to the Rumi runtime.

**Best for:** Applications requiring automatic state synchronization with minimal coding effort.

### [Event Sourcing Template](/rumi-core/guides/developing-applications/microservice-template/event-sourcing-template.md)

Uses Rumi's Event Sourcing consensus model where state is maintained by replaying a deterministic sequence of events. State is opaque to the Rumi runtime and maintained in your POJO objects.

**Best for:** Applications requiring full control over state management and complex business logic.

## Choosing a Template

Both templates provide high-availability and fault tolerance but differ in how they achieve consistency:

* **State Replication**: Runtime manages state synchronization automatically
* **Event Sourcing**: Application code replays events to rebuild state

For a detailed comparison, see [Consensus Models](/rumi-core/concepts/consensus-models.md).

{% hint style="info" %}
**Documentation Status**: This section is currently being migrated from our legacy documentation site. For complete content, please visit:

* [Working with State Replication](https://docs.neeveresearch.com/display/TALONDOC/Working+with+State+Replication) (legacy docs)
* [Working with Event Sourcing](https://docs.neeveresearch.com/display/TALONDOC/Working+with+Event+Sourcing) (legacy docs)

Complete documentation will be available here soon.
{% endhint %}

## Next Steps

* Review [Consensus Models](/rumi-core/concepts/consensus-models.md) to understand the differences
* Choose the template that fits your application requirements
* Follow the template-specific guide for implementation details
