Migrating from Express.js
If you have an existing app using Express.js and want to migrate it to Encore.ts, this guide is for you. This guide can also serve as a comparison between the two frameworks.
Why migrate to Encore.ts?
Express.js is a great choice for building simple APIs, but as your application grows you will likely run into limitations. There is a large community around Express.js, providing many plugins and middleware to work around these limitations. However relying heavily on plugins can make it hard to find the right tools for your use case. It also means that you will need to maintain a lot of dependencies.
Encore.ts is a framework that aims to make it easier to build robust and type-safe backends with TypeScript. Encore.ts has 0 npm dependencies, is built with performance in mind, and has a lot of built-in features for building production ready backends. You can deploy an Encore.ts app to any hosting service that accepts Docker containers, or use the Encore platform to fully automate your DevOps and infrastructure.
Performance
Unlike a lot of other Node.js frameworks, Encore.ts is not built on top of Express.js. Instead, Encore.ts has its own high-performance runtime, with a multi-threaded, asynchronous event loop written in Rust. The Encore Runtime handles all I/O like accepting and processing incoming HTTP requests. This runs as a completely independent event loop that utilizes as many threads as the underlying hardware supports. The result of this is that Encore.ts performs 9x faster than Express.js. Learn more about the Encore.ts Runtime.
Built-in benefits
When using Encore.ts you get a lot of built-in features without having to install any additional dependencies:
Migration guide
Below we've outlined two main strategies you can use to migrate your existing Express.js application to Encore.ts. Pick the strategy that best suits your situation and application.
Code examples for migrating an Express.js app to Encore.ts
$ encore app create --example=ts/expressjs-migrationFeature-by-feature migration
Check out our Express.js compared to Encore.ts example on GitHub for all of the code snippets in this feature comparison.