Deno 1.35: A fast and convenient way to build web servers
deno.com
deno.com
This gave us solid support for HTTP/2 in Deno itself -- you can start a full webserver on a TLS socket and start talking fully-compliant HTTP/2 in just a couple of lines.
It's an interesting challenge to get this to cooperate with V8 in a performance way and we're continuing to work on it while keeping the code as maintainable as possible. The implementation will continue to evolve as we design better and faster interfaces between Rust and V8. The cool thing is that this is all going into open-source projects, either in Deno itself, rusty_v8 or V8 itself.
Happy to answer any questions.
Edit: I really am. Why downvote?
Deno feels like Node from 10 years ago, in both good and bad ways: every Deno native community library I've pulled in (redis, S3) has had significant bugs. Fixing them has been fun but distracting. Looking under the covers, I've found the code to be really clean as a result of Deno's abstractions. The improving npm support helps to make mature libraries accessible, but the Deno native libs also have a bright future.
[1] https://github.com/chromakode/coalesce/tree/main/project-ser...
I may give it a try on some personal projects now that I know this.
Deno is effectively a language and runtime, webserver, package ecosystem, and arguably infrastructure and database. When choosing the technology to use for something that feels like a lot of eggs to put in one basket. Sure there are benefits to bundling like this, but the downside is that you're more exposed to bits of that bundle being insufficient.
Maybe this criticism doesn't play out in practice, but Deno and some other things trying to re-invent Javascript again, seem to be trying to do too much at once, and are risking ending up too far away from the original ecosystem to be able to return. Now maybe the only way to re-invent JS in a convincing way is to do these wholesale rewrites making big divergences, but then again, perhaps that just indicates that JS is not the foundation that it needs to be for some kinds of development.
Note, I've said JS as a grouping of the JS/TS ecosystem and existing packages. I don't think TS changes things that much as it's still the same ecosystem of tooling for the most part.
Deno’s pitch to me is to take everything that makes Golang work so well, and apply it to JS/Typescript. I can’t switch yet but I sure would like to!
Typescript gets the pass, because it basically a JavaScript linter, with an easier way to get modern JavaScript features, without wrestling with babel and friends.
Projects dictate language toolchains, not the other way around, and so far I haven't seen any project or product SDK placing Deno on the tooling requirements.
It will be more compelling when the FoundationDB-based KV store is finished. At that point there will be enough to write full web apps without any external API’s, so I can use it to build the simple hobby websites that I used to use AppEngine for. (For now I’m trying it out using Neon for Postgres.)
It’s still for developers rather than nontechnical users, but this may be simple enough to deal with that it does some of what Sandstorm promised to do for things like blogging. Or maybe a personal Fediverse server?
It would be nice to have a second source for Deno-based hosting, but in a pinch I could put Deno and my apps in a Docker container and run it anywhere, though probably not for free.
Some gentle pushbacks:
Runtime and webserver yes (though not web framework), language sorta, though Node is already just as much all of these things
Package ecosystem also sorta. Any Deno module that doesn't use the Deno APIs is isomorphically runnable in the browser and most other JS contexts. This is actually more true than with Node, because idiomatic Node code uses CommonJS imports which are incompatible with the browser without transpilation
Infrastructure I don't think is really true; obviously there's Deno Deploy, but I don't use that for any of my Deno projects. If anything, the fact that it's so self-contained makes it more flexible to different kinds of infrastructure. All you need installed is the runtime, and then you run a single command and you're off to the races (with dependencies downloaded automatically as needed)
I think it strikes a great balance between batteries-included and compatibility. It's become my favorite default way to write a CLI or a web server
I got a little confused about importing packages properly but it might be down to how my IDE handles stuff and not really deno-specific.
I also love it for CLI work. I was using Go pretty much exclusively for years, but I’ve used Deno twice for real work and a bit for experimentation. Go offers some features I prefer, but Deno offers TypeScript which — for better or worse — is where I think best in code. I like to maintain it more, which means a lot for something I have to deal with next year.
A language that is designed from the ground up to compile into standalone binaries seems so much more apt for CLI tools... Deno/Node, on the other side of the spectrum, requires a whole environment and runtime, which seems like a hassle. I know of vercel/pkg but that's not a first-class citizen of the ecosystem and has its shortcomings.
Have you used it, to know what is the baseline size of the file it generates? e.g. the size of a "hello-world" command, which would be basically 99.9% composed of the runtime and core libraries.
(Disclaimer, I work for Square, a sister org within Block of CashApp, where the folks that created Hermit work.)
I've started using Hermit for all my personal projects... one too many times I've cloned one of my own github projects I haven't touched for a couple of years and taken half an hour to remember/decipher how to get everything installed and running. Now I just use Hermit, and possibly a `bootstrap.sh` file that will `pip install -f requirements.txt` or suchlike, and I'm off to the races.
Yet I can model solutions better in TypeScript, I work faster most of the time, I find the people I work with tend to understand complex TypeScript projects far more readily than complex Go projects, and some tooling (certainly not all) can be nicer in TypeScript land. There are definitely trade-offs. There are some go-to packages I love to use and fit my habits extremely well in that ecosystem though, so that's a welcome benefit for me personally.
If I had to build something very fast, reliable, more readily portable, and well-suited to Go's strengths, I wouldn't hesitate to use it. For something smaller or far nicer to model with TypeScript's type system, or with a team that isn't up to speed with Go, I'll seriously consider Deno without feeling like it's a major compromise.
The more I think about this the more I realize how spoiled we are these days. These are both awesome tools in their own right that didn’t even exist when I got started. It’s a real joy to have such great tools to work with.
Allow JSON.parse to use typescript types.
So I can parse JSON with supplied type and engine would validate JSON against that type. Simple as that.
Also might be useful for JSON.serialize to have an output control (because TypeScript could be abused and actual value might differ from its type).
This simple feature would bring tremendous value to application stability IMO.
I think you either:
(1) start with the runtime code and derive the types (what TS does by default).
or (2) start with the types and derive the runtime code (like "macros" in some languages).
Does anyone have any suggestions for the best way to do this in a Node runtime?
I kind of like deno when it came to its package management. I hate npm and I liked that deno tried to disrupt ecosystem.
Now when deno bent over and accepted npm reality, is it possible that few years later they'll just switch over to it entirely and abandon their old ways of packaging?
I understand that it's easier to sell deno to developers when they can import npm package. And deno wants to make money, so taking a hard stance is a bad financial option in the short term.
Still I'd love to take a bet on deno. But if deno is just another npm... Well, setting up node + typescript + eslint + prettier sucks, but not so much.
The Deno ecosystem itself needs some work for sure. I think alot of other comments already said everything better regarding that but it's still nice to know that we have something to write typescript in that doesn't just target nodejs.
I'm new to the deno world but will be testing it out this week.
I'm curious though the decision not to have a dedicated package manager on the first place? Maybe someone knows the reasons for this?
There are server side WASM runtimes for other languages, though. Including ones that let you write endpoints entirely with WASM (and its languages like Rust and Go*), like Fermyon and Dapr.
Now served with tons of YAML configuration files instead of XML, and being told to configure our own Kubernetes infrastructure on top of it.
Some annoyances, mostly around the Deno Deploy side of things, but otherwise I'm a huge fan.
Deno is not a drop in replacement for nodejs, which is a pity.
I like Deno specifically because of how different it is from node.
I'd love to hear what problems did you hit and look into solving them.
Is there a written guide for how to convert a nodejs project to Deno?
I'd really prefer to be using deno instead of node. If it was a seamless experience I would definitely drop nodejs.
Eg. if you have a Vite app (or any other app really) with "package.json" and some "scripts" defined there, just try running "deno task <script_name>". Deno will automatically pick up "package.json" and try its best to run the that script.
It's not fully done, but in our testing we got a lot of non-trivial projects running that way. If something doesn't work in your case, I would greatly appreciate a bug report to help us fix this.
As for the written guide - there's not a single one at the moment - it's something we'll be looking into in the coming months.
With CF Workers and Lambda you have to export a function
"The single executable application feature currently only supports running a single embedded script using the CommonJS module system."
https://nodejs.org/api/single-executable-applications.html
Should be an awesome game changer for node.js when the feature gets rounded out.
Also check out vercel's `pkg`: https://github.com/vercel/pkg/issues/1291
I think if you've used Deno before convenient definitely fits, you can build quite a bit without needing external libraries, typescript by default, you kinda just start working on your problem - just a much cleaner version of what node could have been in my experience.
We're constantly working on improving the performance of Deno from top to bottom and it's a marathon.
We don't want to be fastest at the expense of security or maintainability and the results from the last couple of months have been pretty awesome.
I can't necessarily speak for priorities at any point in time, but I can say that performance is very important and literally what I'm working on most of the time.