# @node-ts/bus > A TypeScript service bus for message-driven Node.js applications: handlers, workflows, retries and pluggable transports. Send commands, publish events and run workflows over RabbitMQ or Amazon SQS. Failed messages are retried, nothing is lost, and your handlers stay plain functions. ## Table of Contents ### Getting started - [Installation](https://node-ts.github.io/bus/getting-started/installation.md): Install @node-ts/bus, generate the message types of your messages, and start a bus. - [Handling messages](https://node-ts.github.io/bus/getting-started/handling-messages.md): Declare a message, handle it with a function, send it, and test the handler. - [Shutting down cleanly](https://node-ts.github.io/bus/getting-started/shutting-down.md): Let the bus finish the messages it's handling before your application exits. ### Messages - [Messages](https://node-ts.github.io/bus/guide/messages.md): Commands, events and system messages, and how to declare them as classes or plain definitions. - [Events](https://node-ts.github.io/bus/guide/messages/events.md): Declare, publish and handle events, which tell every subscriber that something happened. - [Commands](https://node-ts.github.io/bus/guide/messages/commands.md): Declare, send and handle commands, which instruct a single service to do some work. - [System messages](https://node-ts.github.io/bus/guide/messages/system-messages.md): Handle messages from other systems, such as S3 notifications, that don't follow the bus' message conventions. ### Message attributes - [Message attributes](https://node-ts.github.io/bus/guide/message-attributes.md): Metadata that travels with a message, separately from its body. - [Correlation id](https://node-ts.github.io/bus/guide/message-attributes/correlation-id.md): Relate messages to each other with a correlation id that follows a message flow through the system. - [Attributes](https://node-ts.github.io/bus/guide/message-attributes/attributes.md): Send values with a message for its receiver, and type them in the handler. - [Sticky attributes](https://node-ts.github.io/bus/guide/message-attributes/sticky-attributes.md): Attributes that are copied to every message sent while handling a message, and to the messages after them. ### Workflows - [Workflows](https://node-ts.github.io/bus/guide/workflows.md): Coordinate long running business processes across messages and services, with state that's persisted between steps. - [Creating a workflow](https://node-ts.github.io/bus/guide/workflows/creating-a-workflow.md): Declare a workflow's state, declare the workflow with functions or a class, and register it with the bus. - [Starting](https://node-ts.github.io/bus/guide/workflows/starting.md): Start a new instance of a workflow when a message arrives. - [Handling](https://node-ts.github.io/bus/guide/workflows/handling.md): Handle the messages that drive a running workflow, and find the workflow instance each one is for. - [State](https://node-ts.github.io/bus/guide/workflows/state.md): Read and update a workflow's state from its handlers, discard changes, and test handlers with a fake context. - [Completing](https://node-ts.github.io/bus/guide/workflows/completing.md): Mark a workflow as complete so it handles no more messages. - [Example](https://node-ts.github.io/bus/guide/workflows/example.md): A complete workflow that fulfils an online purchase by shipping the item and emailing a receipt. ### Running in production - [Retry strategies](https://node-ts.github.io/bus/guide/retry-strategies.md): Control how long the bus waits before retrying a message that failed. - [Middleware](https://node-ts.github.io/bus/guide/middleware.md): Run code around every message the bus reads, before and after it's dispatched to handlers. - [Lifecycle hooks](https://node-ts.github.io/bus/guide/lifecycle-hooks.md): Listen for messages being sent, published, received, dispatched and failing. - [Dependency injection](https://node-ts.github.io/bus/guide/dependency-injection.md): Give handlers their dependencies with closures, or resolve class handlers and workflows from your IoC container. - [Long running processes](https://node-ts.github.io/bus/guide/long-running-processes.md): Run tasks that take longer than a message can be held for, such as encoding a video, without blocking handlers. ### Serializers - [Serializers](https://node-ts.github.io/bus/guide/serializers.md): How messages are written as JSON, and how generated message types restore their Dates, Maps, Sets, bigints and classes. - [Class serializer](https://node-ts.github.io/bus/guide/serializers/class-serializer.md): @node-ts/bus-class-serializer was removed in 2.0. Generated message types restore Dates and classes without decorators. ### Loggers - [Loggers](https://node-ts.github.io/bus/guide/loggers.md): See what the bus is doing with the default debug logger, or send its logs to your own logger. - [Custom loggers](https://node-ts.github.io/bus/guide/loggers/custom-loggers.md): Send the bus' logs to your own logger, such as winston or pino, with an adapter. ### Transports - [Transports](https://node-ts.github.io/bus/transports.md): The message brokers that @node-ts/bus can run on, and how to choose one. - [RabbitMQ](https://node-ts.github.io/bus/transports/rabbitmq.md): Run @node-ts/bus on RabbitMQ with @node-ts/bus-rabbitmq. - [Amazon SQS](https://node-ts.github.io/bus/transports/amazon-sqs.md): Run @node-ts/bus on Amazon SQS and SNS with @node-ts/bus-sqs. - [SQS and Lambda](https://node-ts.github.io/bus/transports/sqs-lambda.md): Handle Amazon SQS messages in AWS Lambda with @node-ts/bus-sqs-lambda. - [Custom transports](https://node-ts.github.io/bus/transports/custom.md): Adapt another message broker by implementing the Transport interface, and check it with the @node-ts/bus-test conformance suite. ### Persistence - [Persistence](https://node-ts.github.io/bus/persistence.md): Where workflow state is stored, and the persistence adapters maintained with the bus. - [Postgres](https://node-ts.github.io/bus/persistence/postgres.md): Store workflow state in Postgres with @node-ts/bus-postgres. - [MongoDB](https://node-ts.github.io/bus/persistence/mongodb.md): Store workflow state in MongoDB with @node-ts/bus-mongodb. - [Custom persistence](https://node-ts.github.io/bus/persistence/custom.md): Store workflow state in another database by implementing the Persistence interface, and check it with the round trip suite. ### Reference - [API reference](https://node-ts.github.io/bus/api.md) - [Upgrading to 2.0](https://node-ts.github.io/bus/upgrading/v2.md): What changed in @node-ts/bus 2.0, and how to upgrade from 1.x.