RFC: Motia Docker (Self Host)
Status
- RFC Date: 2025-07-14
- Status: Draft
- Authors: Rodrigo
- Reviewers: Sergio, Ytallo, Filipe, Mike
Summary
This RFC proposes a solution to enable users to self-host Motia through docker.
Background
Currently Motia is only available to be deployed to the Motia Cloud. This is great but some users have been reaching out asking for self-hosting options. Some users have been using docker to run Motia's cli dev command. This is a quick viable solution, and we can improve it by providing a start command that can simplify the tasks executed to run Motia (hot reloading, type generation, etc...) and eventually focus on performance over time (improved runtime using Go, less memory usage, middleware to configure event queue and storage, etc).
The main challenges are around self-hosting limitations:
- Missing a Motia provided self hosting solution
- Missing documentation for self-hosting options
- Missing a self-hosting example
- Lack of self-hosting options creates a barrier for first entry users to try Motia in a production environment
Goals
Primary Goals
- Motia provided self-hosting solution using docker and a new
startcommand from the CLI focused on removing unnecessary features from thedevcommand (hot reloading, type generation, mermaid, workbench, etc...) - Documentation for self-hosting option
- Provide a self-hosting example through a video tutorial, this example will demonstrate how to deploy Motia to a cloud provider (AWS, GCP, Azure, etc...)
Secondary Goals
- Configurable event queue and storage system
- Improved runtime using Go
Non-Goals
- Bring your own infrastructure (BYOI) solution, folks will need to figure out how to deploy the containerized Motia application into their own infrastructure and apply the necessary protections (api gateway, load balancer, etc...)
Architecture Overview
High-Level System Architecture
⚠️ The references to cloud providers are just examples, we won't be providing any deployment solutions for self-hosting Motia in any of the cloud providers. As part of the validation of this RFC we will be providing a video tutorial on how to deploy Motia in a cloud provider, but each user will be responsible for deploying Motia to their own infrastructure.
Technical Considerations
For this RFC there are no technical considerations regarding the deployment to an infrastructure provider, since we won't be providing a BYOI solution. Users will have to figure out on their own how to host the containerized Motia application into their own infrastructure and apply the necessary protections (api gateway, load balancer, etc...)
Some technical considerations using docker are:
- Provide a docker image for the Motia application, this can help us control maintainability and support for the environment where the Motia application runs. It can also help us narrow edge cases in which folks use deprecated or legacy images.
- We need to be clear about the limitations of running Motia in a docker container through the express server (which is what is used to run Motia in the
devcommand). - We need to provide users a solution to lock the express server, i.e.: authenticated access
Success Metrics
- Enforce an analytics metric through an env variable, injected as part of the docker image used to containerize motia. This will allow us to track the number of users using self-hosting motia.
- This project will live in its own repository, we can also track the number of stars and forks on the repo.
Future Considerations
- Add support for configurable event queue and storage system, i.e.: setup RabbitMQ and Redis or MongoDB for event queue and storage
- Improve the runtime, explore using Go to improve performance
- Expose a health check for the Motia application, i.e.: checks for event queue, storage, server, etc...
Questions and Considerations
- Should we provide a motia-docker image to containerize motia?
- Are these the only features that need to be disabled for the
startcommand?- Hot reloading
- Type generation
- Mermaid generator
- Workbench, we might want to give users the option to conditionally disable Workbench
Conclusion
Providing a self-hosting option for Motia will allow users to evaluate a Motia application in a "production" like environment.