Fresh is a new full stack web framework for Deno
deno.com
deno.com
- their module/packaging systems are totally different
- their APIs for interacting with the system are different
Deno -> Node: https://github.com/denoland/dnt
I remember writing at the time that moving everything to the client was solving one problem (poor encapsulation of JavaScript-powered front-end components) with another (needlessly rendering everything on the client)
The industry moved toward CSR anyway, and I had to learn it to continue having a job. And now, here we are.
Why do we do this to ourselves as an industry?
With time, of course, it is likely that we end up in an equilibrium at the middle. In reality, we don't know what we like and what we don't like until we experience it.
AWS et al had not yet turned web servers into a commodity, so it wasn't feasible to "just deploy the software to multiple regions" to improve latency.
An idea comes up. It solves problems, but it also has shortcomings. An antithesis that deals fixed the shortcomings comes up and is adopted. Turns out it also has shortcomings of its own. The synthesis merged them together.
And repeat.
(these are the ideas from some thinker whose name I forget)
So we're giving up on "it's more secure"?
EDIT: I'm actually a real fan of Deno, but that was never because of its security promises. Security is both technical and cultural, and I think cases like this suggest that while the technical side was always shaky, the cultural side is just as weak. If first-party material promotes the idea of running scripts with `-A`, then that's the direction the community will be led.
server-side rendering for each request in V8 might be more expensive to host than client side rendering in V8?
for a properly-chunked app, hopefully most requests for the larger vendor bundles are cached/JITed, and each request doesnt actually download much extra JS.
there are also many frameworks faster than React (Solid, Marko, etc)
Expensive not in money terms, but in user experience.
Also: if you are doing e-commerce, 100ms added latency can cost you 7-8% in conversions. Spending 5% more on hosting to do SSR just makes economic sense.
i hear this metric (or something equally absurd) cited frequently and have never seen it to be true in my own experience.
i guess if you have to load a product page with 100 images (or assets) and each has 100ms network latency, then it will add up to much more than that. but 100ms for a single interaction or network request (e.g. process payment POST) is not going to move the needle on conversions. 100ms will feel instantaneous to 97% of users, and more than satisfactory for the remaining 3%.
(i say this as someone who profiles aggressively and strives to optimize every stray 5ms in JS and every 1kb over the wire)
So, y’know, maybe a slightly different ballgame.
Agreed that in the general case 100ms to full paint (with interactivity not far behind) is really good.
Just averaging out those numbers could result in engineering time being wasted chasing rapidly diminishing returns, if the site is already below one of those thresholds.
At lower latencies no one is going to leave your site because it takes 1200ms instead of 1000ms to fully load a page. But at some point almost everyone is going to leave your site rather than wait.
I also find these stats really confusing because whenever someone talks to me about site performance they're always talking about a different metric (server response time, first paint, time to interactive, etc). If you're first paint is quick then users aren't going to care if content half way off the page doesn't load instantly.
I've always tried to focus on how fast things feel rather than worrying too much about specific metrics. If you can just get something (ideally the important bit(s)) to load really fast a site can feel extremely fast even if it's mostly just an illusion. Users like to click things and see stuff happening. It's things like reloading the page when adding items to cart then making them wait on a white screen for multiple that increases bounce times as abandoned carts in my experience. Making add to cart buttons an ajax request probably helps far more than making the page load 200ms faster.
On payment failures, an interesting solution an ecommerce I used to work for came up with was just to place the order on payment failure. They figured it was better just to send out an email after the fact asking them to try again and if that failed they could call and take the payment over the phone if need be. We targeted an older demographic and sold fairly pricey products though. I guess that model wouldn't work so well if you're selling $10 tshirts. I believe Amazon does something similar. I know they've sent me emails in the past letting me know my payment failed after placing an order.
Makes less sense the smaller an e-shop gets since the consumer already needed intent to shop there. If I know I already want product X on Shop Y today, 10 second load times are rather inconsequential.
It's sort of true but also a massive over simplification. The relationship between conversion and speed is not linear. Some people are beyond help, and others already have it so good they only notice the most extreme degradation in performance.
It's also hard to isolate confounding factors like users who have fast infrastructure tend to be rich and rich people buy more stuff. Making pages load faster doesn't give them more money to buy stuff.
Overall faster is definitely better but the specific magnitude will depend on your customer demographics. In our case the Amazon 100ms saved = 1% more sales was close enough for a rule of thumb.
In isolation, I don't think that 100ms in delay before paint really causes enough impatience in people that you'd lose 7-8% as a direct result. Humans don't really make that kind of decision within such a minuscule window of time; to a degree, we expect our devices to have delays.
More likely, that loss of conversion is correlated because sites that have longer than 100ms latency have latency that's extreme enough to reach the "I give up" threshold. A site where its pages take 3 or more seconds to load would see a big difference, but that doesn't mean that a site with exactly 100ms latency will see any meaningful loss of conversions outside a margin of error.
People will also be much more patient with a high-value site. For instance, I'm willing to wait a few seconds for each page to load on the McMaster-Carr website because it's an otherwise good experience and a high-value store. But I'm far less willing to tolerate delays on some horseshit Shopify page plastered with ads and reselling crap from Alibaba. And if you've got a blog that's poorly formatted and overall signals low value content, I'll dip out the moment I detect the slightest monkey business slowing things down.
It can even output static, precompiled, pages with the adapter-static so no heavy backend processing involved and response times are best-in-class: https://github.com/sveltejs/kit/tree/master/packages/adapter...
Fly.io will sell you a 256MB of RAM container for $1.94/month, which is perfectly capable of server-side rendering dozens (maybe even hundreds if you write efficient code) of requests per second.
I'm sure you can get even better deals if you shop around.
A server is not 'rendering' a website the same way a client does.
A couple of dozen requests a second? In drupal in dev mode maybe but even then... I feel like we need to have a bit of a knowledge reset before spouting supposed info about csr v ssr
While this is technically true, there is still "rendering" happening on the server when you JIT-compile JSX/TSX templates and transpile everything from your ES6 modules and includes to HTML/CSS/JS that a browser can parse.
In a sense you're splitting the load between client and server because you're right some stuff always has to run client side (like the actual layout engine work).
Most server-side frameworks I've worked with will perform just fine in 256MB of RAM though. These days I'd expect people to get the best results from Go or Rust, if they want to be able to run on as little RAM or CPU as possible.
I'll keep on sticking with Python!
I must be too old to enjoy recent resume building architectures....
they just use docker api, hence why I don't think there is the resource waste typical of k8s
I haven't run benchmarks but speed wise containers shouldn't slow down app requests (except in a few cases with very specific kernels, which I unfortunately experienced in production - but I was told it was just bugs)
SSR definitely has drawbacks in the old "run your app from a single VPS somewhere" model, but in a globally distributed edge computing model, you remove a lot (but not all) of those drawbacks.
https://betterprogramming.pub/creating-a-web-performance-cul...
The other is that those API requests need to be rendered with JS which means downloading the JS upfront + rendering time. JS rendering will always be slower than pure HTML rendering.
I will agree for small apps this is negligible, but for bigger apps this means downloading, parsing, and executing MBs of JS. See the Google Cloud console for example or the Spotify web app.
And yet there is another point which is that with SPAs, ignorant developers can cause more "damage". The other day I opened a simple password recovery form, and it rendered dozens and dozens of divs and downloaded (I shit you not) 2MBs of JS.
It's not the same because on the server you usually have some form of caching, and the V8 engine will have already JIT'd that code as well.
Nowadays i prefer static site generation and if interactivity is needed, additional client hydration. The only scenario, which i can think of, which does not match this model are highly frequently updated dynamic content sites. Am i wrong?
Even for moderately frequently updated dynamic content sites, statically rendering say 10 times a day might suffice. When the hydration kicks in, you can always fetch the info, which changed between the 10x/day updates and still have a low time to interactive.
SSR with caching maybe comparable in terms of time to interactive, but does feel less elegant imo.
Considering mobile, embedded or even considering that my grandmother still owns a i3 4th gen, maybe would be better SSR, but for modern machines i'm not in for SSR, still feels a little bit clunky to me.
> for a properly-chunked app, hopefully most requests for the larger vendor bundles are cached/JITed, and each request doesnt actually download much extra JS. Yes, cache here helps alot, but saving mobile data still be pretty good, considering some SPAs doesn't chunk it's script files very well.
If you’re interested in something similar for the Node.JS ecosystem, check out Astro (https://astro.build).
Fresh’s Zero-JS island architecture approach was largely inspired by it.
- Marko, made and used by eBay, which had been doing islands/partial hydration for years
- Qwik, made (and I’m pretty sure used) by Builder.io (and one of the original Angular creators), which only loads/executes JS as needed for interaction. Not quite partial hydration, it resumes state serialized into the HTML (sort of conceptually similar client side to Alpine etc)
If you really are making a web app (think dropbox, cloud based enterprise software) I think you'd reach a point where there is so much interactivity that you are essentially shipping Preact, custom component JS, and just a little bit of static HTML. The latter bucket is the only one which saves the user network and parsing time (and I doubt much of it.) I'd still go with a properly chunked SPA for true web apps.
You can never really avoid it unless you only use HTML. Templates are code. I think JSX is nicer because it's fully featured and the same syntax as regular JS, not a subset limited template language
Laravel released template components in version 7, but I haven't been able to try them yet and I'm hoping they'll improve things.
I'm patiently waiting until we either discover Java or reinvent it all over again.. but this time it will be cool because it won't be called Java, it will be rather "JMocha" and really drive that productivity you're looking for when mixed with your Latte's 3.0 strong typing.
I suppose I'll be in my not-so cool corner working in my monorepo, single server and outdated Rails app on Postgresql; If only I could achieve Github scale with that..
"... and the client is only responsible for re-rendering small islands of interactivity. A model where the developer explicitly opts in to client side rendering for specific components. ..."
actually sounds more like ASP.NET (the original Web Forms, not Core) support for AJAX:
https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.up...
Or to do the opposite, for a single-player website where there aren't any server requests to cache, a client-only website can run offline.
Fresh looks good for multi-player websites that are unavoidably making database requests interactively, though.
I’m using NanoJSX with Deno to render JSX on the server and spit the result into a file, but I’m having to write a lot of SSG stuff myself, (like logic to loop over files).
But I guess static rendering would go against their mantra of “no build step”, which even currently is actually false, as they need to generate the manifest file.
I understand it from a business point of view but it's bad for users and for performance. Same thing happened to images in next. The plugins to have optimized images in next are all broken and the official one use a "free" dynamic route offered by vercel.
Sure, performance wise, it isn't the best, but performance isn't an end all be all.
What separates react from the rest of the group is the maturity of React Native.
If Discord is betting on React Native, so too can it be used for a lion's share of applications out there.
When you're a startup deciding between technologies, usually you're a 1-5 man shop.
If you have the capital to blow, you can build separate teams for native + web, and separating native even further with Kotlin/Java and Swift with your choice for the web platform.
(I'm not trying to the Dart ecosystem just to only use Flutter, in which, Flutter-Web isn't SEO friendly)
Or you can just use React + RN and essentially have one team and save you anywhere from 500k-2m in hiring.
This is why React is so strong.
It's not because it's "performant", it's because it's practical, and even for performance it's good enough.
Flutter is awesome for mobile dev. For web? Not so much.
I don't think React will ever disappear... but I seriously doubt it will ever become as popular and ubiquitous as jQuery.
Even today, React's market share is nowhere near close jQuery.
https://w3techs.com/technologies/comparison/js-jquery,js-rea...
If most things interactive on your site need a round trip BEFORE the interactivity (e.g. a Like button) then this is OK.
However if you are writing a web app which does a lot of stuff offline and there is no reason for it to not work offline then this is an issue.
Where it is a bit sucky is something like clicking an expand button, and needing a network request for basically setting a {display:'block'} style on an element.
I might be strawman-ing a bit there because you would probably chuck in a tiny JS script to do that one job and not religiously follow "no JS".
But I am sure there are good examples of wanting offline capability.
However this is not a showstopper: This model is great for some things, bad for others. It is a welcome new choice in the palette of web dev options.
I imagine it might be premature optimization for many sites though, given that it is a trade off.
If you care about minimal JS to the client, another approach might be to use https://svelte.dev/. I have not tried it, but I am curious.
1. first class styling plugins
2. synchronized island state
3. built in data persistence
But yes, I guess if I would need to pick a more mature framework with JS, Redwood would be the way to go.
For me "full stack" is something like Rails, Laravel, Django, etc.
Or is it just being able to run code on the server enough to be "full stack"?
I'm missing the translations system, the validations, the background jobs, the authentication system, authorization helpers, email sending, ORM or data access layer, testing framework, CSRF and related security protections, logging, error handling framework, etc, etc, etc.
To me that's a "full stack" framework. If just running code on the backend and on the frontend is enough, then I can make a bash script a full stack framework, right?
However... it's definitely closer to what I want "full stack" to mean than... this. Or a pile of bash scripts.
To me, "full stack" would entail having responsibility for logic on both the front-end and back-end, which Fresh does.
Personally, I would not consider Laravel a full stack framework (Although it can work well with front-end frameworks to make a full-stack application). Instead I'd consider it a back-end framework.
To me Laravels is pretty more close to a "full stack" framework than Fresh to be honest.
You need to ship at least a few MBs of JS to prove you are a real frontend engineer.
> I think that having by default a pretty awesome templating system (which even allows for components), a webpack based build system for frontend assets
Fresh literally does that "by default" without having to include any library/dependency.
> easy way to serve, cache and bust assets, and a trivially easy way to submit forms and validate user input.
It's almost the same effort in Fresh.
> makes it pretty full stack
Define fullstack, but even defining it, Fresh totally covers what you said.
To be "fullstack" to me means to be filling in all stacks, being in web? Frontend and Backend. To me, having a templating system and having things rendered in backend can be "frontend", but you saying "Laravels is pretty more close to a fullstack framework than Fresh" is not something very logic here.
Totally understand about Django, Laravel etc. but typically if I'm building in Node/JS I'm pulling all of that extra stuff in from npm piecing it together myself.
> But again, that's just me confused about what is "full stack"
Me too because it's grown into an amorphous definition =/
There term has definitely become more amorphous and ambiguous. I spent a few years mostly working with physical hardware, networking, virtualization, scripting deploys for DBs and OSs, and handling the DNS alongside some business oriented C#. Then I moved over to working with AWS and Azure.
Now I primarily work with Node, Golang and Python.
With modern tooling and a team that supports it, I've found myself mostly working on services, APIs and React front-ends. Even with Next.js, it's hard to know where the line on what "full stack" is.
It's sort of come to encompass the frontend and backend of an application, less so the architecture of it. Mentally, however, I still lump it all together when I think of what qualifies for "full stack", as I personally think the term represents an understanding of how everything works together, which definitely helps when troubleshooting the source of a problem.
[1] - https://nodewood.com
I find that having to dig to find out how things are done and trying to hack around the framework is the cause of bugs and frustrations.
I still manage two services based on Django and they're a continue cause of pain.
I'd rather spend a week at the beginning of the project and set things up the way I want them with minimal dependencies. Then evolving things is fairly easy, just a matter of skimming through the code.
Same.
The only time that I've gone away from this strategy is when I need to get other developers to buy-in to a framework (or hell just a "system of work"). In leadership roles, I've found that a highly-opinionated framework with lots of batteries included really helps keep people coloring inside the lines. For me anecdotally that's more important than having a low-dependency codebase that's very appropriately sized to the problem it's solving.
I've found it's way easier to dodge the inevitable "X way sucks" from my colleagues/subordinates by using "full framework" tools that I can pitch to non-technical management vs. a bespoke solution.
Batteries included frameworks solve people problems more than they do software problems.
---
Just want to reiterate that I absolutely agree with you and the only time I find tools like Django appropriate is when other developers need tooling that keeps them "in the lines," and/or when I'm expecting to have to pitch my solution to non-technical peers/leadership.
Me too. I don't use create-react-app or anything else to set up my Node.js/React/TypeScript/SWC projects. I install each package I need manually, and configure each item precisely how I want it (tsconfig.json, webpack.config.ts, .swcrc, even .eslintrc.json). Makes for a nice, lean project every time.
The benefits of frameworks is that there's shared knowledge on how to use it, lots of documentation and they are more battle proven.
There's a reason people are not writing assembler. Reinventing the wheel every single time has its trade offs too.
You should check out Fastify.
It does solve a lot of stuff for you. Either included in the core or with official plugins.
But, when I think of a "all in one" / "full stack" langauge, there needs to be an existing ORM inside the framework. That works across the View/Communication/Model.
These frameworks have you needing other tools to do this.
Today, I have the opposite impression. Nowadays everyone is a react tool who want to learn backend so they can call themselves full stack.
People see react, Facebook and their eyes turn into dollar signs.
Aren't those back-end frameworks? I always undestood full-stack to mean "front-end + back-end".
Normally it's used this way to describe a job, but that meaning has circled around and is now used to describe libraries/frameworks too
When I hear of a full-stack framework (in a modern setting), I think of stuff like Meteor, Redwood, and Wasp-lang (disclaimer: I am one of the authors of that one). RoR also always comes to mind, although it's more commonly used as an API server nowadays.
Rails, Laravel, or Django are completely agnostic about the frontend side of the full stack though :-) Well, maybe Rails will have an opinion about Stimulus; but this fresh thing continues the journey after the response has reached the client.
My productivity with Rails 7 and Turbo has never been higher.
I don't think Django counts as full-stack, as you don't have a default front-end framework, like Rail's Stimulus.
If you get to ignore threads/forks and number of workers as well as memory management of them because it's someone (or something) else's responsibility, then that's not full stack. The stack is OS (slightly, and can often be ignored), webserver, application, and client (HTML/JS). If you hand off responsibility of any of that then it isn't "full".
The term originally came from referring to people that handled all these things. You could be a back-end developer, dealing with the OS and webserver and maybe application, front-end developer where you dealt with HTML, JS and maybe some application code, or you could do both and be a "full stack" developer.
There's enough confusion here I suppose I'll start using the term "batteries included framework" for the technologies you listed.
Most other frameworks don’t include things like websockets and Web Push notifications, as well as support for WebRTC, payments etc. So where do you draw the line?
You could have something incredibly intensive on the front end using a bunch of modern frameworks and visualization tools. Or something incredibly intensive on the back end with some of the features you mentioned in your post. But neither is strictly required and many apps will function with just the basics on either or both ends.
Fresh, in contrast, does SSR and then hydrates the components on page load, making it much more similar to React with SSR or Next.JS.
Is it worth investing in this now? It really put me off.
[0]: https://www.youtube.com/watch?v=pBcFJmQ6UVM at 15:50
> Fresh 1.0 is a stable release and can be relied upon for production use. Much of Deno's public web services use Fresh (for example the site you are reading this blog post on now!). This does not mean we are done with Fresh. We have many more ideas to improve user and developer experience.
a lot of those innovations are over 50 years old, now. do we REALLY believe that the Unix Philosophy is the best thing in the history of computing? past and future? really? I don't. and what about in another 50 years? how about 1000 years? at some point, many much better ideas will emerge.
that's what "post-Unix" means. the things that come after this Unix thing we're hung up on.
As far as I can tell, there's a marketing term ("post-unix") but not any concrete ideas backing it. The Ryan Dahl post linked above is equally fuzzy as it seems to just be saying "use an encapsulated runtime for scripting that replaces existing Unix-level dependencies with Web Assembly code that runs on top of Unix."
Not to be rude but it really just doesn't make a lot of sense. Is there a blog post or video explaining the general thesis here?
there is always something to improve. find it. improve it.
still fuzzy?
it is our moral obligation to improve ourselves and the world around us.
I don't know how much clearer I can be.
There is a clear-ish definition (not running JavaScript in a Linux container like Docker but running it directly on top of the OS in its own containerized runtime) explained in the linked video that comment was replying to, but no, it's not just "something more modern than 70s Unix design."
The difference being it's all one isomorphic (?) React-y Deno codebase instead of the tangled PHP+jQuery mess.
Promising enough, if you ask me.
And egress fees ;)
I must say though, hashrock's illustrations for Deno are simply stupendous.
Yes, they also firmly keep the claim that fresh doesn’t have a build step. Hint: It does [^1]. They’ve just hidden it for most people by making it part of the local testing.
Deno will have this with some amazing edge render perfection figured out if you go all-in.
Vercel has Next + Svelte.
Then Cloudflare has "Adaptor" packages and then a simple functions routing folder in Pages (which is def not this...).
I wonder if Cloudflare will regret still not really providing a "Cloudflare Way" of doing things.
I think as these edge runtime things get more feature rich, it's going to pay off to be all-in on one that does it perfectly exactly optimized with an easy pathway vs expecting third party packages to figure out an implementation and stay up to date.
Joystick is full-stack (UI framework directly integrated with a Node.js back-end framework) but the UI part can be used on its own.
Sveltekit is kind of similar in style too with single file components containing a script block, HTML, styles, etc. vs. JSX style components.
[0] https://nextjs.org/blog/layouts-rfc [1] https://reactjs.org/blog/2020/12/21/data-fetching-with-react...
It would be great for a 1 visit per hour site, but so would PHP, or just an index.html file. Hard to really answer that question without knowing what your site is.
The strengths of Deno over Node are bulleted all over its homepage, but you likely already knew that.
Shopify's new store-builder thinks this way too: https://github.com/Shopify/hydrogen
Maybe if these things came with some kind of fancy "edge database" it would cover normal use cases, but they never seem to mention that so I assume it doesn't exist.
https://nextjs.org/docs/advanced-features/react-18/server-co...
You can use Deno modules in Node using https://github.com/denoland/dnt
There is, however, a Node compatibility layer for Deno: https://deno.land/manual@v1.14.1/npm_nodejs/std_node
edit: i just realized you probably meant another company... i believe Slack uses deno in prod, not sure if they're currently hiring. netlify, github, and supabase all use deno as well.
Edit:
No, it's only Netlify.
Source can be found here https://github.com/denoland/dotland