docs/ts/concepts/benefits.md
To enable Encore's functionality in TypeScript, we’ve created a high-performance distributed systems runtime in Rust. It integrates with the standard Node.js runtime for executing JavaScript code, ensuring 100% compatibility with the Node.js ecosystem.
It provides a number of benefits over standard Node.js:
Encore.ts is designed to let the Node.js event loop — which is single-threaded — focus on executing your business logic, while everything else happens in Encore’s multi-threaded Rust runtime. Here's a high-level overview of how this works:
1. Node.js starts up and initializes the Encore Rust runtime. The Rust runtime then:
2. For each request, the Encore Runtime:
3. When your application needs to interact with infrastructure (like databases or PubSub):
Encore leverages static code analysis to parse the API schema and TypeScript types you define. This enables a number of features:
Encore provides open source tools to help you integrate with your cloud infrastructure, enabling you to self-host your application anywhere that supports Docker containers. Learn more in the self-host documentation.
You can also use Encore Cloud, which fully automates provisioning and managing infrastructure in your own cloud on AWS and GCP.
This approach dramatically reduces the level of DevOps expertise required to use scalable, production-ready, cloud services like Kubernetes and Pub/Sub. And because your application code is the source of truth for infrastructure requirements, it ensures the infrastructure in all environments is always in sync with the application's current requirements.
Encore.ts provides integrations for common infrastructure primitives, but also allows for flexibility.
For example, you can always use any cloud infrastructure, even if it's not built into the Encore.ts framework. You can use any database, message broker, or other service that your application needs, just set up the infrastructure and then reference it in your code as you would do traditionally.
If you use Encore Cloud, it will automate infrastructure using your own cloud account, so you always have full access to your services from the cloud provider's console.