10 ms·
I'm looking at https://docs.astro.build/en/concepts/why-astro/ https://docs.astro.build/en/concepts/why-astro/ and I still can't tell what's interesting and uni
by CharlesW 4y ago
I'm looking at https://docs.astro.build/en/concepts/why-astro/ https://docs.astro.build/en/concepts/why-astro/ and I still can't tell what's interesting and unique about this as compared to other options in this space.
I acknowledge that this might be a PEBKAC situation, but I'd love to hear thoughts from people who used Next.js, Remix, or whatever and found Astro to be a revelation.
It seems like Astro's creators believe "content-focused" is a differentiator, but I find that confusing since content-focused sites are a popular use case for web frameworks that are also suitable for more complex apps.
- azangru 4y agoAs far as I can tell, Astro is zero-js on the client by default, while both Next and Remix are very much the opposite. Plus, both Next and Remix are tightly coupled with React, whereas Astro is trying to be more agnostic in that regard.
- dirheist 4y agoThe one thing I like about Astro is the component island UI. With react you would need to re-render the entire UI on a UI change while in Astro you can signify which portions of your website are static and which dynamically should re-render upon data fetching or whatever. It's just a faster way to build UI's that don't need the full complexity of a SPA and also don't need to come bundled with the entirety of react from what I've seen and used it for.
- GrahamL 4y agoIt's interesting their blog post doesn't mention some of the benefits. Neither does the doc page you linked—at least it doesn't do it succinctly. Essentially Astro lets you build sites using a JS framework like React or Vue without requiring that framework to be loaded on the frontend. By default, components are just HTML content. Super nice for building very fast static sites using a technology you may already be fluent in. You can still add interactivity to components if you'd like—just tag components that require interactivity and Astro will bundle the requisite JS for the client.
- reilly3000 4y agoTheir homepage https://astro.build https://astro.build has a nice summary of its approach and benefits.
- ksec 4y agoSo they have moved all the previously frontend stuff to backend and output Hot-wired / Liveview / Livewire instead?
- mwcampbell 4y agoI wish. AFAIK it's just classic server-side rendering with full-page navigation. Mind you, that's the optimal solution in many cases. But a full-stack JavaScript web framework with something like Phoenix's channels and LiveView built in would be a killer combination.
- cercatrova 4y agoIsn't that what Hotwire and StimulusJS is?
- quechimba 4y agoI just started working on something like this. It's a VDOM implemented in Ruby and it streams updates to the browser via Server-Sent Events which are then applied by a tiny bit of JavaScript. A basic counter component would look something like this: initial_state do |props| { count: 0 } end handler(:increment) do |e| update do |count:| { count: count + 1 } end end render do <div> <p>Count: {state[:count]}</p> <button on-click={handler(:increment)}>Increment</button> </div> end There are some things I'm used to in the JavaScript world that I'm trying to introduce here. I got hot reloading which is pretty cool. And CSS modules... and static typing with Sorbet. Events are handled on the server, so there's no need for an API... You could just talk to your database directly in your onsubmit-handler. I think that might be the largest benefit from using something like this. If the app is deployed in a region close to you, you won't barely notice the latency.
- 4y ago
- qbasic_forever 4y agoIf you look at the project structure it uses that might help make it more clear the capabilities: https://docs.astro.build/en/core-concepts/project-structure/ https://docs.astro.build/en/core-concepts/project-structure/ Content-focused seems to highlight that you can just dump markdown files into it and spit out rendered pages, very much like content focused static site generators (hugo, jekyll, etc.). But in addition to that static content it has all kinds of hooks and capabilities to add dynamic components or even pages, kind of like more modern web application platforms like next.js.
- jackconsidine 4y agoFor me it's the pre-rendering. I've used Next.js, Nuxt.js, Remix etc and they all server-render great. But for deploying SPAs to file-hosting (S3 + Cloud Front or Firebase Hosting) without a server runtime, you end up with empty HTML on request which is worse for SEO, social previews etc. There are solutions to pre-rendering for these stacks but they're more focused on deploying to Vercel or Netlify functions, or having a post-build script which opens the site in Puppeteer and saves the HTML into your build file! With Astro, all this is out of the box immediately. Try putting together an Astro site and look in your build directory; you'll see even for React components the HTML is already there
- ta-run 4y agoI can just do a `nuxt generate` and put it on CF+S3 as well, right? how is that any different to what Astro does?
- nawgz 4y agoLooks the same to me after a quick read as someone who has never used an SSG BEFORE
- jackconsidine 4y agoYeah you can, but there's more configuration involved. The default `nuxt generate` output is an HTML page that just has a loading element and a bunch of JavaScript tags*. On my Astro apps all of components that don't explicitly have a "client" attribute are prerendered * unless something changed since my last Nuxt project
- usrusr 4y agoThat's what I find confusing in Astro's self-presentation: they talk a lot about MPA vs SPA and how nicely they blend, making it abundantly clear that by MPA, they mean server-rendered. But then there's all the talk about static file hosting and I think the project even started as a static site generator ("dev-machine rendered")? It would be super awesome if they tackled what might be called "three level partial hydration" (build time, server side, client side). Might even sneak in a fourth level, "server side, but cached until marked dirty". For when you are set up for static rendering, but want to reduce backend load for rarely changing stuff. I'd expect that it would be quite powerful to have that capability inside the engine that handles rendering, on component level if necessary,and not just on some internal microservice boundary (where I think it's quite common?).
- ggregoire 4y agoThe core concept and main difference is described here I think: https://docs.astro.build/en/concepts/islands https://docs.astro.build/en/concepts/islands There is also this page comparing it with other tools: https://docs.astro.build/en/comparing-astro-vs-other-tools https://docs.astro.build/en/comparing-astro-vs-other-tools
- sesm 4y agoComparison with alternative solutions is the first thing I look for in the docs. Great that they have it!
- eKIK 4y agoWhile Astro has a lot of impressive features I found that it was the "developer experience" (god I hate that term) that was superior compared to everything I've tried before. With Hugo and Jekyll I always needed to go revisit the docs whenever I hadn't worked with it for a while. I never got to the "oh, I get this tool now" phase, where the content generation could just flow without issues. Publii was cool, but trying to shoehorn everything into fitting in the "Blog" model never quite worked out for me. Also being forced to work in a new IDE wasn't to my liking either. Here are some of the things I love about Astro: - The docs are great. You can read through them all really quickly. I tend to prefer systems that are simple to grok, and Astro is just that. - The lightweight Astro components (https://docs.astro.build/en/core-concepts/astro-components/ https://docs.astro.build/en/core-concepts/astro-components/) were great for me, because they delivered on being able to create reusable pieces of code very easily (without having to touch React). - Being able to generate part of your site from markdown and part of it from precisely crafted HTML is a great way to be able to handle both repetitive and unique content. - The Astro themes (https://astro.build/themes/ https://astro.build/themes/) are a great way to start. Find something that's somewhat similar to what you want to build and study how they did it. This is obviously very subjective, but for me Astro was the first SSG that I really enjoy using, and that I didn't feel like I had to fight against.
- vosper 4y ago> "developer experience" (god I hate that term) Why do you hate it? It's useful to have a term to differentiate between the experience of the person using the output of the tool (user experience) versus that of the people developing with the tool (developer experience). Honestly we need more DX improvements in this industry. Especially look at DevOps - the user experience of Chef's output (I'm picking on Chef here, it's hardly the only offender) is servers and services, and the users (other engineers) consuming those outputs can have a nice time. The DX of using Chef, though, can be ughh....
- swyx 4y agoit is subjective and overused - perfect storm for industry jargon that takes up a lot of space without saying anything more than "this thing sparks joy"
- robertwt7 4y agoI feel you, tbh as someone who has NextJS as my main tools, it's hard enough to choose Remix or Redwood as a starter project, when I needed backend it's either Django or Spring boot from time to time. Not really sure when to play around with these new frameworks if it's not giving me enough reason to switch, especially since they're not adopted in big tech companies it makes it harder to justify the usage when I want to build somethjing
- quickthrower2 4y agoI think it makes the tradeoffs that are ideal for content-oriented sites rather than web apps. > Next.js uses React to render your website. Astro is more flexible: you are free to build UI with any popular component library (React, Preact, Vue, Svelte, Solid and others) or Astro’s HTML-like component syntax which is similar to HTML + JSX. > Both Next.js and Astro are frameworks for building websites. Next.js does best with highly dynamic websites (like dashboards and inboxes) while Astro does best with highly static websites (like content and eCommerce websites). https://docs.astro.build/en/comparing-astro-vs-other-tools/#nextjs-vs-astro https://docs.astro.build/en/comparing-astro-vs-other-tools/#...
- antihero 4y agoAlso Astro sites can be hosted on CloudFront or any another static CDN. Next you’re kind of tied to Vercel no?
- crucialfelix 4y agoYou can upload the Next.js build to anything you like. netlify, S3 bucket, Apache or Nginx server running on solar powered bare metal. If you need backend api functions - https://github.com/serverless-nextjs/serverless-next.js/ https://github.com/serverless-nextjs/serverless-next.js/ AWS Lambda etc. Probably slightly more work I grant you.
- antihero 4y agoI tried this and the output HTML seemed pretty awful, but perhaps I was doing it wrong.
- demarq 4y agoThat page is almost like the product is shrouded in secrecy of some sort. I feel that this is what I was looking for https://docs.astro.build/en/concepts/why-astro/ https://docs.astro.build/en/concepts/why-astro/
- bl4ckm0r3 4y agoThe winning point over other frameworks is the implementation of island architectures (streaming ssr static content + only load required js to run dynamic components) https://www.patterns.dev/posts/islands-architecture/ https://www.patterns.dev/posts/islands-architecture/ This gives some more examples of what Astro offers https://twitter.com/matthewcp/status/1557103499724333057?t=8VM5pao9kO42OLH1cymoGQ&s=19 https://twitter.com/matthewcp/status/1557103499724333057?t=8...
- aliswe 4y agoforgive my ignorance but these front end based, non server rendering frameworks, how are they getting indexed by Google?