Live data from Hacker News

SvelteKit 1.0

svelte.dev

161–170 of 296 posts

Re: SvelteKit 1.0

#162

Earlier quoted context omitted.

Except it forces you to use node js, or do I read it wrong? Can we get a streamlined js framework that is just about the frontend and let’s you use whatever backend language you want? I know there is react, vue and angular but they seem so bloated

Svelte is a frontend framework, which you can use to build anything from a full SPA to a single button. SvelteKit is a Node backend framework that integrates tightly with Svelte.

SvelteKit is a Javascript backend framework. It only uses Node at build time (with hopes of replacing even that with e.g. Deno), the deployed serverside component will happily run outside of Node.

Re: SvelteKit 1.0

#163

Earlier quoted context omitted.

Nodejs is only needed in the development phase.

That's true if you're developing a SPA or static site with SvelteKit. However, there are APIs that involve Node being run in production, i.e. the authors of SvelteKit envision it being used to build hybrid apps that involve front-end JS and Node.js server/s.

Yes, the whole point of SvelteKit is that it's SSR+hydrate. But it doesn't need Node for that. It'll run on just about any Javascript engine, including Cloudflare Workers which is quite close to pure V8 + standard web APIs.

Re: SvelteKit 1.0

#164
post #27

This is how I move fast and break nothing. By having fullstack type-safety from database all the way to the frontend with auto-completion. My current stack: + SvelteKit (could be Next, Nuxt, Solid or any other TypeScript framework) + tRPC (typed calls between frontend and backend, https://trpc.io ) + trpc-sveltekit (glues SvelteKit and tRPC, https://github.com/icflorescu/trpc-sveltekit ) + Prisma (ORM, https://www.pr…

Curious how you handle `request.formData()` in Form Actions and ensuring type safety there.

We use and recommend Zod for that:

https://github.com/colinhacks/zod#error-handling

Re: SvelteKit 1.0

#165
post #66

There is a plethora of javascript frameworks: React, Vue, Svelte, Remix, etc. If I know nothing about front-end development, and would like to learn one that is: - Intuitive - Suitable for small projects as well as large projects. - That is here to stay, i.e. either adopted by many companies, or its adoption curve is going up. Which one should I pick? Would Svelte be a good choice?

Why do you want a framework and not just plain HTML, CSS and Javascript? I have been doing frontend dev for over a decade and I never needed a framework. When I want to template data client side, I use Handlebars.

You've never ran into DOM performance issues? You use a lot of createDocumentFragment? Please share more.

Re: SvelteKit 1.0

#166
post #26

I'm just completing a job using svelte/kit, tailwind, postgres, typescript. Actually, I was new to the entire stack, but it went smooth as butter. (Though I have plenty of experience with JS, HTML, CSS, other databases, etc.) IMO, svelte and sveltekit are well designed and have a great dev experience. LOL, as I was writing this he was apologizing on the stream for the breaking changes. That was a bit of a pain, but n…

Yes, it's easy to get confused with folders and folders of +page.svelte [slug].svelte would be better [slug]/index.svelte [slug]/[category].svelte Etc There is a vscode extension that helps a little bit, but it's still the one thing I am not fond of.

The src/routes/posts/[slug]/+page.svelte thing is pretty recent, it used to be just src/routes/posts/[slug].svelte. I'm not exactly thrilled with the new naming...

Re: SvelteKit 1.0

#167
post #150
post #94

Earlier quoted context omitted.

If it's for your career: React + (Next or Remix). Maybe Angular or Vue if the specific company you want uses it If it's for yourself: Svelte. Amazing community, very likely to be here in 5 years, but I don't think it's been proven to work at large scales yet. If you want to twist everything upside down and see the full potential of what front-end dev work could be: Qwik or Elm (imho)

Elm hasnt had the momentum for years, its gonna be a long shot for it to go anywhere from here > but I don't think it's been proven to work at large scales i basically have this saved now: notable companies now using svelte not just for internal apps but customer facing, critical stuff: - huggingface (for everything, including gradio) - alaska airlines (entire customer flow) - razorpay (payment dialogs) - schneider e…

Nice. I think the most significant one listed there is huggingface. It's very widely used but rarely "for everything". I think that shows most companies still aren't confident in it enough to bank everything on it quite yet, but it seems like we're pretty close!

Edit: and yeah you're right about Elm. Probably not a good choice for first timers. But it's a great example of what a FE that adheres to functional programming philosophies could look like. Given React's recent developments I think the skills gained from trying it out would definitely carry over to React and other emerging frameworks. Although it's famously stable and error-free, it's not been battle tested for very large and complex apps so it's likely only a good choice for sideprojects atm.

Re: SvelteKit 1.0

#168
post #137

Earlier quoted context omitted.

How are you liking Prisma compared to a pure SQL approach?

I'm not the person you ask, but we use fullstack Typescript in our dev department. We're a weird mix of a green energy company and an investment bank, so inhouse development is very small-scale, and this means you share resources. Using one language for everything helps with this, since the one person who is really good at React can take a vacation or a sickday without being glued to a laptop since everyone else can…

Duplicate code is one of the biggest near-non-problems programmers waste a ton of time trying to address.

Sure, duplication isn't a goal, but DRY shouldn't hold back work as long as it has no meaningful consequence on performance. In some cases, duplication is a good thing, but your average programmer will address duplication by making a routing more complicated and further away from where it's being used. This is often a mistake.

Worse yet is when programmers DRY up tests. Tests are the worst place to be applying DRY. The point of testing isn't to write an entirely new application on top of your actual application. If you're DRYing up your tests a lot, you're probably writing a second application and should probably stop doing that.

Re: SvelteKit 1.0

#169
post #27

This is how I move fast and break nothing. By having fullstack type-safety from database all the way to the frontend with auto-completion. My current stack: + SvelteKit (could be Next, Nuxt, Solid or any other TypeScript framework) + tRPC (typed calls between frontend and backend, https://trpc.io ) + trpc-sveltekit (glues SvelteKit and tRPC, https://github.com/icflorescu/trpc-sveltekit ) + Prisma (ORM, https://www.pr…

You should also mention Zod, which acts as the type safe glue between the different boundaries.

I have been using Google Sheets as a kind of hacky database. By defining the schemas in Zod I am able to automatically validate my sheets data and coerce the string cell values into their proper types.

Zod schemas can be used all over the stack, imported for form validation, and avoid heaps of duplication and tests.

Re: SvelteKit 1.0

#170
post #100

Earlier quoted context omitted.

I had the opposite feeling a month or so ago, especially with stores- there's so much "magic" that I kept running into confusing walls. If I `export let` a variable to be reactive over here, why isn't it reactive over there?

You seem to be conflating a few different concepts. Store are absolutely reactive across all components and pages. They are prefaced with $, and there are a bunch of native stores that you can use such as $page. You can even create variables reactive to one another by declaring a variable like so: $: y = x * 2 Using the export let x = default; option is for passing data from the parent component/page to a child. If y…

For instance I had a variable in a store.

On my page, I had a script tag pulling from the store. The variable was reactive within the script tag.

I export let that into the template via “data” props.

I changed the value of the variable within the script tag.

The template did not reflect the new value.

Post reply on HN