Encore.ts is Open Source backend framework for TypeScript. This guide walks you through how to migrate an Express.js app to Encore.ts to gain type-...
For further actions, you may consider blocking this person and/or reporting abuse
To make your Express.js APIs 9x faster, migrate to Encore.ts, an open-source TypeScript framework built for high performance. Encore.ts uses a multi-threaded, asynchronous runtime in Rust, handling I/O efficiently. It has no external npm dependencies and includes built-in features for production-ready backends, ensuring a smoother and faster API experience. Fore information Discover it
Great article, thank you for sharing it. Looks like an awesome solution. Will definitely try it out.
π
Thanks for sharing
comprehensive guide! thanks!
Glad you liked it π
Encore.ts looks great.
Few questions :
If it has a separate runtime written in Rust with multi-threading approach,
then it is not using Nodejs.
Isn't it like comparing server written in Rust/C/Go with Nodejs ?
Does it also uses it own thing to transpile JavaScript other than JIT used by Nodejs ( Ignition & Turbofan ) ?
Thanks for the questions!
Well, its a bit of both. 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 (written in Rust).
Once the request has been fully processed and decoded, it gets handed over to the Node.js event-loop, and then takes the response from the API handler and writes it back to the client.
So you can write your business logic in TypeScript but you get a lot of the performance benefits from Rust.
I think the comparison is fair because you still write TypeScript as usual, using the NPM libs that you are use to. The Rust performance boost happens under the hood and is not affecting the business logic of your app.
Encore leverages static code analysis to parse your TypeScript code and picks up the API schemas and infrastructure you have defined. For the actual transpiling, Encore relies on Node for that. Transpiling TypeScript to JavaScript is currently done with esbuild.
Honestly, the API does not look really good. Putting everything in an api(...) function :/
Plus there are no repo on npm to download it, it looks like an Desktop application installation.
The API does not look really scalable too (see file upload exemple)
What about server resources consumption like CPU and memory?
Hey that's a great question. Since Encore.ts enables higher throughput, it means you can serve the same number of users with fewer servers or, conversely, you can serve more users with the same number of servers... which directly corresponds to lower costs.
Because it is not been highlighted in anywhere in website or any thread.
Thanks for your reply and expecting more proof in upcoming articles.
Very interesting, the requests/sec diagram caught my attention. Do you have any example repositories that use encore.ts? I'd love to check them out
Cool! Here is our example repo with a bunch of different examples:
github.com/encoredev/examples/tree...
I want to ask how to implement middleware in Encore.ts. I created a small app in Express, but when I tried to implement it in Encore.ts, I couldn't figure out where to write the middleware.
Use Encore.ts to reduce the overhead of middleware and routing logic by optimizing spotify code execution.
I delved into it, and I found it interesting. However stuck on finding information on how to connect other Database(MongoDB). I also couldn't find a central place to initialize my DB globally once.