12 ms·
Thoughts on Svelte(Kit), one year and 3B requests later
- revskill 3y agoIf SvelteKit supports streaming Server Component, i'll move.
- yawnxyz 3y ago> Reactive declarations and statements are useful features, just remember not to abuse them, otherwise you may end up switching Svelte’s productivity by headaches and infinite debug sessions I wish they got into more of that; I've heard of stories but I've never run into this after several years of building Svelte projects, so I'd love to learn so I don't make those mistakes myself > Svelte’s lack of protagonism This doesn't look like it reflects on the system itself? I'd rather have something that works well and doesn't focus on flashy-ness. I guess the real downside is that there are such few plugins / tools for Svelte compared to React, but with Rich Harris working with Vercel on Svelte, I can only see things go up from here — like Vercel AI having out of the box Svelte support.
- spyke112 3y agoLost me at building a custom CMS for the MVP, or did I misunderstand?
- coolgoose 3y agoNope, that's my feeling too. Somehow for a news site mvp in 2023 we still reinvent the wheel.
- loktarogar 3y agoIt was a replacement for an existing website (requirements are well known), so a custom CMS being part of what they were hired to build and an MVP of that CMS being what they're talking about isn't so irrational.
- foota 3y agoIt's a storied tradition. (I know that at least Django was written for a news site)
- deleted 3y ago[deleted]
- jer0me 3y agoSvelte was written for a news site!
- rizky05 3y ago[dead]
- wg0 3y agoWhat other off the self solutions you'd recommend for such a news website?
- hbbio 3y agoAs the author states, ... Svelte Stores are rough. Beyond just missing usage patterns and documentation, we found that several features are lacking, especially when used with native reactivity (`$:`). Another area lacking is TypeScript support. Our frontend codebase at OKcontract is implemented with Svelte, but we had to build some low-level libraries (including a wholly new implementation of Stores) to make it worthwhile. We're very busy with our main launch now, but plan to open source these libs asap. PS: We're not using SvelteKit
- tomgp 3y agostores are nice (i’ve found the transitions especially useful) but very much optional. i’ve used redux with svelte with good results and as the article says, it’s easy to get svelte to work with any pure js libraries
- pcthrowaway 3y agoI find this a bit confusing, because stores are one of Svelte's answers to react's state, and React's state is a hot mess once you go beyond component-local state
- hbbio 3y agoReact state is a hot mess, yes! We kept the same interface as the Svelte store, but with different semantics: - special management of undefined values - error management - promise management
- bavell 3y agoCurious - what makes react state a mess? Is it just that there's not much batteries included?
- pcthrowaway 3y agoBriefly speaking, it's because the mechanisms for dealing with complex state structures which are either global, or shared between multiple components which are not direct ancestors/ descendents of one another, are really complicated, due to how changes within that state need to be managed and propagated through the component dependency graph. Spend an hour, a day, or a year (depending on how broad you want your "introduction" to this topic to be) reading the various blogs and docs on state management systems if you want to see how crazy this gets.
- cetra3 3y agoI've moved my little hobby website to SvelteKit[1] from react and I am not regretting it.. yet. The only main frustrations I have are: - Library support is pretty lousy. You need to fudge things around to get working. I.e, with leaflet and others I have vendored in the libs and redone them. - Incremental static refresh with svelte kit is not really there. I'd like a web hook or api callback that allows me to refresh certain static pages as I know that changes are made. Right now I'm doing a janky refresh using a file lock notifier & it's a blemish on an otherwise great framework. - The URL routing in svelte kit is... a little ugly. It's really hard when you have an editor open with 5 `+page.svelte` files. I wish they re-introduced file name routes, rather than folder name routes. It is entirely a personal preference I know, but I have seen a lot of negative things around it. [1] - https://github.com/cetra3/divedb https://github.com/cetra3/divedb - deployed at https://divedb.net/ https://divedb.net/
- onion2k 3y agoLibrary support is pretty lousy. Next 13's app directory and React Server Components is killing library support in React, so that's not such a big problem.
- Kiro 3y agoWhat does that mean?
- onion2k 3y agoIt means that library maintainers are having to make changes to their libraries to get them to work on the serverside, and a lot of them aren't not really doing that very quickly.Consequently moving to RSC reduces the number of libraries that work with your React code. It's a short term problem because most popular libraries will get updated eventually, but some won't and they'll only ever work on the client side. In the case of Next, maintainers need to package their libraries differently to support ESM modules, or you need to configure your project to use the experimental.esmModules=false flag. Again, it's not a particularly big problem but it does reduce the size of the available ecosystem a bit.
- andrewstuart 3y agoThis is the vaguest argument against react I’ve heard. Not the basis for any rational decision making: >>> But once you leave this path you may (and more likely will) get into trouble at some point. And sometimes there are projects where you don’t want (or can’t) risk getting in trouble because of the tool you’ve chosen for your UI development. There simply isn’t any room for that.
- swyx 3y agoas someone close to the Svelte community, i think the "lack of protagonism" comment is due to the relatively loud voices of those mentioned names. however the activity in svelte genuinely has picked up year to year. you can follow Svelte Society on Twitter and YouTube to see the many projects going on, in particular https://twitter.com/SvelteSociety/lists https://twitter.com/SvelteSociety/lists for people building and teaching and evangelising Svelte. they're out there! just necessarily smaller because they got started later + have less funding from Facebook.
- andrewstuart 3y agoYou need very strong argument not to take the most popular technologies these days. I don’t hear any arguments against react here strong enough to justify not choosing VueJS or React. It’s not in the interests of your client.
- bunga-bunga 3y agoThere are plenty other articles for them. Not every alternative article has to denigrate the incumbent.
- colordrops 3y agoStandards-based is really the only thing that challenges react these days, i.e. raw JS with es modules, web components, and no build step/bundling. It only works in certain situations though, but when it does work, it's so much better than the giant web of black boxes and indirection that is the React universe.
- KronisLV 3y ago> Standards-based is really the only thing that challenges react these days I feel like Vue would be a better fit for this role, especially since now they have a Composition API that's as pleasant to use as React, except that they do lifecycle hooks better than React (no messing about with dependency arrays): https://vuejs.org/guide/extras/composition-api-faq.html https://vuejs.org/guide/extras/composition-api-faq.html There's also Pinia which is a lot simpler than trying to use Redux, it's closer to MobX: https://pinia.vuejs.org/ https://pinia.vuejs.org/ There are also plenty of component libraries, like PrimeVue: https://primevue.org/ https://primevue.org/ Seriously, the only actual complaint I have about Vue is that the 2 to 3 migration wasn't all that pleasant (albeit not as painful as what Python dealt with hah). Oh and for more complex use cases (like what Next provides), there is Nuxt: https://nuxt.com/ https://nuxt.com/
- 9dev 3y agoI like Vue as much as the next guy, but comparing Nuxt to Next doesn't really do Next justice. Nuxt is pretty much a glorified blog engine, a conceptually broken tech demo. Its performance is abysmal, the developer experience frustrating, and many things that seem convenient when you read the docs turn out to be a hassle in production. Next is so much more refined compared to that.
- mozey 3y ago> by wrapping a vanilla lib to a component or an action, you’ve essentially created basic Svelte version of that lib This is the key to making framework churn go away. The DX of using vanilla JavaScript is getting better every day. And is a much better experience than it was a decade ago. > Islands architecture and partial hydration can help you render static HTML with just a small portion of JavaScript for those components who need it I'm doing this with Hugo for rendering the static parts, and htmx for loading hydrated partials. The HATEOAS approach simplifies state management in the application. There is no client side "routing", just links and the back button. In addition to vanilla libs, I include one "app.js" bundle. This file is created with esbuild and linted with deno. My "business logic" can be written in TypeScript in VSCode with the Deno extension and LSP server.
- graftak 3y agoThis is all fun and games until you work on a platform that requires dynamically loaded modules, error boundaries and suspense (or another form of components loading their own data) and then the no-nonsense approach falls flat. It is easy to put your nose up towards bloated frameworks when you’re doing small (static) stuff but as soon as you need the bloat you’re just reinventing a wobbly wheel without one. There’s always an air of disdain against front end frameworks on HN but people often project their own not-needing-a-framework on the tool itself.
- white_dragon88 3y agoI work on a huge angular project and I can’t help but see svelte as a toy in comparison. Must be nice when everything just falls into place.
- continuational 3y agoWhat are you missing in Svelte?
- junon 3y agoMaybe it's because angular is like dropping a nuke to kill a spider?
- chrisjayden 3y agoI've used Next.js quite a bit, but once I tried SvelteKit, I never looked back. One of the things I built with it is https://landing.gallery/ https://landing.gallery/
- jwmoz 3y agoNice, I need a site like this for inspiration. Is it ranking for any seo?
- chrisjayden 3y agoA bit, it's starting to pick up :)!
- game_the0ry 3y agoWell done! From inspecting the html: - sanity for cms - tailwind for css - partytown for running script in web worker - most of the icons on the footer are just unicode emojis, no separate library just for icons....nice! Only feedback I have: - the sticky footer looks like what you would see in a mobile view and looks a little odd in desktop (I am not on a phone atm) - Home page drop down in top left and some footer items are redundant, I would nix one (if I had to choose, nix the footer links, keep drop down) - Super minor, but for the nav drop downs, implement animation for the up/down arrow icons to indicate open state Overall, very clean. I'm going to follow your twitter and steal the styles from your html to apply to my own projects (bc I am bad at design, so thank you).
- chrisjayden 3y agoAppreciate you! I'll take the feedback into account. The footer items are redundant yeah, but from an SEO standpoint it works pretty well.
- Dowwie 3y agoregarding the font issue -- it is very disorienting: https://imgur.com/a/MCG3VZl https://imgur.com/a/MCG3VZl
- abhishekjha 3y agoHow is this[1] diagram built? I have seen this font in quite a few places. [1]https://claudioholanda.ch/assets/blog/en/0003/1.svg https://claudioholanda.ch/assets/blog/en/0003/1.svg
- Arcanum-XIII 3y agodraw.io if I'm not mistaken !
- swan_escape 3y agoexcalidraw
- topnde 3y agodrawcharts.xyz
- mr90210 3y agoI gave up the Javscript rat chase, for now I am sticking with React.js. Svelte has been around for years, and in my opinion it won’t really gain that much traction anymore. (It’s just an opinion, let’s not be religious)
- synergy20 3y agosame here for my SPA. even react is shifting more from CSR to SSR,I wonder when I will just switch back to Django with htmx and leave react all together if SSR is what I need.
- thomasfromcdnjs 3y agoHow to build a custom CMS and new frontend codebase in 2 months that can handle 3 billion hits per year in a corporate setting. Would be more interested in how your work flow was managed.
- sametmax 3y agoI like the fact minimalist approaches, like svelte, htmx and alpine.js are getting more and more traction. I felt like fighting this fight alone for years in the golden years of node, webpack and react where everybody was creating crazy stacks and adding GraphQL and so on, to basically get what Django + jquery did 10 years ago in a tenth of the time and code. So far I also survived: - xml is the future - let's use nosql for all the things - you must use the same language at the back and front - yes, you site must have an AMP version (ah, you forgot this one, didn't you? It was sooo imporant, and then pouf, it was gone like tear in the rain) - yes, your home page must be an SPA - you can't code anything without async - you can't live without a message queue - everything must become a micro service - of course you need a container for that - of course you need a orchestrator to organize those containers - of course you need the cloud, it would be crazy to deal with those containers and orchestrators yourself - dude, why do you have a server? Use a serveless backend! - dude, why do you have a backend? Just call saas from the edge! Every year, some generation of engineers have to learn the concepts of "there is no silver bullet", "use the right tech for the right problem", "your are not google", "rewriting a codebase every 2 years is not a good business decision", "things cost money".
- hardwaregeek 3y agoHonest question: how is htmx/svelte/alpine any different than other trends? Could it just be that you prefer this particular spot in the trend cycle?
- comte7092 3y agoI think that’s parent comments point. They like that the trends are swinging from complexity to simplicity.
- lolinder 3y agoBut that was the line that noSQL advocates were pushing. You don't need this big complex relational database, just make everything simple JSON and call it good. Then it turned out that data actually is just complicated, and managing that complexity is off and easier with a relational database. Sometimes simplicity can be an illusion.
- davej 3y agoWe have recently moved our website[1] to SvelteKit. Previously we were on Sapper. Previous to that we used a custom Webpack + React setup to output a static site. Our desktop app builder is also built on Svelte (not SvelteKit). I agree with pretty much everything in this article. I wouldn't put "Reactive declarations and statements" in the "Ugly" section though. They are definitely a bit tougher to fully grok than the rest of Svelte (Svelte is incredibly easy to learn compared to other frameworks) but once you learn how they work they are incredibly powerful and concise. I also feel like "Svelte’s lack of protagonism" is a bit off the mark. Rich Harris is a great communicator and tends to be pretty public but the focus is more on community. Svelte Society's Youtube channel [2] does a 1 hour long "This week in Svelte" video every week and it is all killer content with no filler. [1] https://www.todesktop.com https://www.todesktop.com [2] https://www.youtube.com/@SvelteSociety/videos https://www.youtube.com/@SvelteSociety/videos
- wg0 3y agoI don't want people preaching hooks as the greatest invention since fire talks anyways. Such code if spotted anywhere in a backend would be slammed for being horrendous and violating almost any intuition definition of maintainable code. The svelte documentation is already great. This evengleism is good for commercial products. For technical open source, subjective evaluation is all that is needed. You evaluate whether it fits for your needs, you adopt or not. Not everybody is walking into conferences and sticking swag on back of their notebook lids. Rich Haris seems a humble great guy and he's doing good enough IMHO.
- Capricorn2481 3y agoRich Harris is definitely not a humble guy. He pretty much can't talk about Svelte without framing it as the savior to modern web. And I would say some of the things he pushes are blatantly false
- FractalHQ 3y agoHe’s usually right though. And when he is not, he’s one of the fastest to admit it.
- impulser_ 3y agoI never built a web app in my life. I have always been on the server side. Recently I spent a couple days building the same web app in Next, Nuxt, and SvelteKit just to get a feel of how to build a web app today. The web app was pretty basic. A couple of pages showing data from different apis and auth with user setting page. My favorite by far was SvelteKit despite being the one with the smaller community. It was actually enjoyable compared to the others. It was very easy to feel like I was actually building something. You feel productive right away. The app automatically felt well organized with how the file layout was. Everything belong in a specific place. Layout goes here, Server stuff goes there, pages go here. Even form processing with nice. Building components was like building components in regular JS. Next was my least favorite mostly due to the syntax and how you had to build the application. I really didn't like the whole style of Next and React. Just felt dirty. I would highly suggest people to try SvelteKit. The file names might be a bit weird but it will teach you to use file finder in your IDE.
- deleted 3y ago[deleted]
- Graffur 3y ago> I never built a web app in my life. > I would highly suggest people to try SvelteKit. I feel like this is a good summary of tech trends these days.
- Buttons840 3y agoA beginner suggesting something to try seems fine to me. They have something no amount of study can give, a fresh perspective.
- efdee 3y agoFresh perspective, or lack of perspective?
- andsoitis 3y ago> A beginner suggesting something to try seems fine to me. They have something no amount of study can give, a fresh perspective. When the beginner's critique of the competition is that it felt dirty: Next was my least favorite mostly due to the syntax and how you had to build the application. I really didn't like the whole style of Next and React. Just felt dirty. .... then I don't know that I trust their suggestion. More importantly, technologies like programming languages and frameworks tend to shine at different levels of app size and complexity. Novice building a demo app says nothing about how the developer experience and code complexity will scale as you evolve your app or add more developers to the team.
- slimebot80 3y agoCan we see the news site? (also wouldn't mind a follow up article on hosting such a busy site!)
- siquick 3y ago– “hmm, I’ll try this crazy approach, but will the framework even accept that?” – ”…” – “whoa, oddly enough it did… Alright then, next task…” This sounds like the opposite of a nice DX for anyone but the engineer who wrote the original code.
- aitchnyu 3y agoTangential but is anybody doing SSR using Django or any non-js framework? What is your setup? Wish Django had a library that allows `return SSRResponse(bundlename, context=['foo', 'bar'])`.
- _hl_ 3y agoIsn’t that what django’s html templating is designed for? It’s not interactive using js in the client, but it is rendered on the server.
- Tade0 3y ago> Reactive declarations and statements feel like powerful magic, and they are, but it’s very easy to hurt yourself by writing code that is almost impossible to debug, That's interesting, because one thing I'd discovered in Svelte, which I didn't even dream of seeing ever again was a legible stack trace. It literally goes all the way down to the very change that caused all the mayhem. > Svelte’s lack of protagonism I see this as a good thing. My main gripe with React isn't even its design(which I also dislike, but acknowledge the fact that the market decided on a solution), but the social aspect of being a React developer. You have to accept everything Dan Abramov says as gospel, or else you'll be ostracized. The frontend space would use less celebrities and more focused problem solving. I remember when hooks came out - everyone jumped on the bandwagon and started rewriting normal, working components to this new paradigm. Net effect of course was unpredictable performance, because hooks are only simple on the surface.
- bavell 3y agoFull stack dev going on a decade here. Stack traces and errors in React are pretty awful, fully agree there. I've never even thought about the social aspect of being a react dev - is there one? Frontend sure, but react specifically? It's just a tool, nothing to get ideological or bent out of shape over. Couldn't give a shit what Abramov says beyond what is useful in my day-to-day. There are probably a lot of junior devs who are starstruck but I've never seen any hint of ostracization (lol). There are tons of junior web devs (and more everyday) though so I can understand how one could form that perception. Yes to less celebrities and more problem solving. Hooks are fantastic and so much more composable than the class methods. I use 100% hooks and functional components in my code nowadays and it has never been easier to build and understand my UIs - especially those with non-trivial logic and state. Never had a problem with them being "simple on the surface" but ymmv I guess.
- Capricorn2481 3y agoI feel like there is much more hate towards people using React than hype for React itself. I agree that hooks are great, but a lot of people disagree and claim it's overly complex.
- 3y ago
- zygo 3y agoI have used both SvelteKit and React. Dev velocity was great in the beginning with SvelteKit when everything was super simple but decreased drastically as the project grew. Went back to Next. Apart from devs, none really cares if you wrote it in Svelte, React or bare HTML/CSS or if your site loads double digit milliseconds slower.
- wg0 3y agoCould you please give a heads up what makes Seveltkit difficult in a larger code base?
- maxboone 3y agoPersonally, I really missed the larger state management libraries that are well-available for react. Layouts, passing difficult props to components, passing state up and down in the tree (i.e. refs) Feels like SvelteKit has a major - just use whatever SvelteKit offers, which is generally enough for smaller projects.
- FractalHQ 3y agoSvelte Stores and connect api are a simpler and more powerful solution to this than any library I’ve ever used. I’m curious what you would recommend.
- NorwegianDude 3y agoI have tried to use sveltekit once and turned around in 20 minutes as routing is severely limited. All I wanted to do was to route based on domain, with a different set of routes for one of the domains. Not exactly complicated or uncommon, but not something you can do with the sveltekit router.
- wg0 3y agoAs for routing, I guess that gets unmanageable pretty fast. Just in the sample blog tutorial here [0], you get confused with the number of files and nested folders that has same file names as level above. [0] https://learn.svelte.dev/tutorial/params https://learn.svelte.dev/tutorial/params
- katzgrau 3y ago> After several meetings, we came to the conclusion that the best approach was to simply halt the old website development and build a new one from scratch using the best technologies and practices. Spoken like a true developer. Trash the old system, reinvent the wheel, prioritize the delight of the devs, leave the client with something that is totally obsolete and nobody else knows how to work on in a couple of years. If that's not contract development in a nutshell I don't know what is.
- bsaul 3y agoI usually never post those kind of comments on HN because they don’t add any value, but : your comment made me laugh out loud, thanks a lot :))) Maybe i’m dreaming but i’m starting to feel a new « let’s stop with the fashion addict attitude to tech » vibe on HN, which i really really like :)
- ozten 3y agoThey mention that the legacy system was scaled vertically and expensive. Sometimes a complete re-write makes sense. Some companies spend hundreds of thousands of dollars a year for terrible CMS websites. I've seen this situation 3 times in my career and for all three a re-write was the best long term option when balancing all the pros and cons.
- efields 3y agoI really appreciated this article. No framework is perfect. Svelte always looked like the right approach for a modern component framework, but modern Vue borrowed a lot of its better ideas and ran with it.
- ralphc 3y agoCould you give an example of this or point to an article that does so? I feel the pull between "framework I'd most want to use (svelte)" vs "framework that is more popular, more docs, more devs (vue)". If Vue is getting more Svelte goodness that's a consideration.
- efields 3y agoNot really, but the single file component (SFC) patterns I liked so much in Svelte when I first looked at it are now in Vue: https://vuejs.org/api/sfc-css-features.html#scoped-css https://vuejs.org/api/sfc-css-features.html#scoped-css If it's a couple folks and you work well together and you want to use Svelte, I'd use svelte. If it's a larger team or a large project that will be iterated on for quite a while, probably Vue. I like Vue quite a lot more than React at this point.
- deleted 3y ago[deleted]
- tgtweak 3y agoI don't agree at all with the fact that productivity is that far ahead on svelte - much of the react productivity lift is with the extensive support from other libraries and platforms. The point about it being more efficient in terms of performance certainly rings true but to claim that it's 2x as productive (twice as fast to get something out in svelte) than react, to the extent you've graphed it in the introduction, is a fabrication. I've seen 2 year old actively-developed svelte projects with so much shimming baked in to support common components that the dev teams essentially have their own toolkits just to work with it. That is not what I would consider 2x as productive. It is an age-old paradigm of "less features = quicker" that at some level of required complexity does invert. It's not a static "this is universally faster" equation.
- XCSme 3y agoWill Web Components ever replace those front-end libraries? What are they lacking?