# Quick Start (The 5-Minute Guide)

Get up and running with Kurier in just a few minutes. This guide uses the **In-Memory** transport to demonstrate publishing and consuming messages without needing a broker.

## Table of Contents

- [1. Install Kurier](#1-install-kurier)
- [2. Define a Passenger (Message)](#2-define-a-passenger-message)
- [3. Create a Station (Handler)](#3-create-a-station-handler)
- [4. Run Kurier](#4-run-kurier)
- [Moving to Production](#moving-to-production)
- [What's Next?](#whats-next)

---

## 1. Install Kurier

```bash
pip install kurier-py
```

## 2. Define a Passenger (Message)

We recommend using **Pydantic** for typed, validated messages.

```python
from pydantic import BaseModel

class HelloMessage(BaseModel):
    name: str
    message: str
```

## 3. Create a Station (Handler)

The **Station** is where you register your handlers.

```python
from kurier.core.station import Station

@Station.add_handler()
async def handle_hello(message: HelloMessage):
    print(f"Received hello from {message.name}: {message.message}")
```

## 4. Run Kurier

Now, initialize a **Line** and publish a message.

```python
import asyncio
from kurier.transports.inmemory.bus import InMemoryLine

async def main():
    # 1. Create a Line (In-Memory for this demo)
    line = InMemoryLine(name="welcome_line")

    # 2. Publish a message (Passenger)
    passenger = HelloMessage(name="Kurier", message="Welcome aboard!")
    await line.publish_async(passenger)

    # Note: In-Memory transport dispatches immediately for demo purposes
    # For real brokers, call line.start_consumer() to begin listening.

if __name__ == "__main__":
    asyncio.run(main())
```

---

## Moving to Production

When you're ready to use a real broker (like RabbitMQ), just install the extra:

```bash
pip install "kurier-py[rabbitmq]"
```

And update your configuration:

```python
from kurier.transports.rabbitmq.rabbitmqline import RabbitMQLine
from kurier.configurations.models.rabbitmq import RabbitMQConfig

config = RabbitMQConfig(
    name="production_orders",
    host="localhost",
    port=5672,
    username="guest",
    password="guest",
    virtual_host="/",
    queue_name="orders_queue"
)

# Start your producer/consumer
line = RabbitMQLine(config=config)
RabbitMQLine.start_consumer("production_orders")
```

## What's Next?
*   [**Architecture**](Core-Architecture.md): How it all fits together.
*   [**Routing**](Message-Routing.md): More complex handler registrations.
*   [**Configuration**](Configuration-Guide.md): Setting up YAML or JSON configs.
