Live data from Hacker News

Reflections on Migrating My SaaS to SvelteKit

sveltekitsaas.com

21–30 of 46 posts

Re: Reflections on Migrating My SaaS to SvelteKit

#21
post #13

SvelteKit is really, really great for small to medium sized projects. The amount of stuff you get "for free" (prerendering, ssr, decent SEO) by using SvelteKit is so nice. That being said, I definitely agree with the sentiment here that the file based routing is sub-optimal and I think the hurt goes up exponentially with the size of a project. I've also found that straying off the opinionated path even a little gets…

this is exactly what i am thinking. i ended up building my own router that tries to use an openAPI schema as the sole source of truth but pre-populates the schema based on folder structure so that simple setups behave nearly identical to file based routers. the difference is that you can drop pre-populated routes when the app gets more complex and gradually move to a schema based approach and do things like extract m…

Sounds cool! If you have any code you're willing to share, I'd love to take a look :)

Re: Reflections on Migrating My SaaS to SvelteKit

#22
post #9

The more I see it the more I'm certain that Rich and the team screwed the pooch with the whole '+page.server.ts' stuff. They should really be using the existing syntax to have a context="server" portion instead of splitting the file out. Heck, it could even just be an import for a server.ts file in the same root directory if people really liked the +whatever style of having the server code separated. It feels especia…

I’ll take the opinionated and enforced structure. Even when they aren’t what I would choose. I like ecosystems with standardization.

That said… the one bit I can’t stand is every file having the same name. Working on 4 “+page.svelte” files at the same time breaks every dev environment I’ve ever liked (vscode, vim tabs). It seems to be fighting the tools and mental models I have.

Re: Reflections on Migrating My SaaS to SvelteKit

#25
post #3

SvelteKit is awesome - I wished there were a nice Docusaurus alternative in it. I checked out KitDocs and Sveltepress but both seem like small personal projects that can at anytime stop being maintained.

I’m working on a Next.js based alternative to Docusaurus if you are ever interested in switching over to the dark side and want to build a Next app lol

In the past, I got tasked with an existing Next.js app to play nice with a Docusarus user guide they were building. I found that Docusaurus was very limiting in that environment, and I was forced to launch a separate Docusarus powered docs site under a different sub domain.

I’ve ported over the Docusaurus functionality into an open source Next.js project, complete with Markdown loading, Tailwind CSS, simple .env file configuration, and much more.

I fixed the Docusaurus problems that I mentioned above.

https://github.com/elegantframework/elegant-cli

Re: Reflections on Migrating My SaaS to SvelteKit

#26
post #22
post #9

The more I see it the more I'm certain that Rich and the team screwed the pooch with the whole '+page.server.ts' stuff. They should really be using the existing syntax to have a context="server" portion instead of splitting the file out. Heck, it could even just be an import for a server.ts file in the same root directory if people really liked the +whatever style of having the server code separated. It feels especia…

I’ll take the opinionated and enforced structure. Even when they aren’t what I would choose. I like ecosystems with standardization. That said… the one bit I can’t stand is every file having the same name. Working on 4 “+page.svelte” files at the same time breaks every dev environment I’ve ever liked (vscode, vim tabs). It seems to be fighting the tools and mental models I have.

Me too. I absolutely love svelteKit but this is the most baffling decision, it makes searching for files in vscode so much slower and makes managing open tabs a mess. Even just being able to add an extra word and an extra dot to identify a file would make it tolerable. Like +home.page.svelte or something.

Re: Reflections on Migrating My SaaS to SvelteKit

#27

For folks who have used both, how do you feel Svelte + sveltekit compares to React + Next?

I honestly feel 10x more productive when using SvelteKit instead of Next, and really I have much more experience with React than I ever had with Svelte, it's just that simple and logical. The biggest problem however is ecosystem, you might have difficulties finding Svelte-specific libraries to do what you want and might need to create your own components (i.e. using generic JavaScript libraries), although that's not too hard it can become a bit of a burden to be maintaining it. Overall, I would really recommend people try out SvelteKit, but just pay attention to see if the libraries they may need are available before using it for a bigger project.

Re: Reflections on Migrating My SaaS to SvelteKit

#28

> The naming conventions for routes is a little bonkers. Now when I’m working on my app I have like 10 tabs open that all have the name +page.server.ts. Does anyone know how I can make this better in vim? :help setting-tabline Low-level stuff; consolidating with some kind of project root directory concept and patterns would be convenient for such cases.

   > :help setting-tabline
For VSCode users:

   Workbench > Editor: Label Format
Set to short will append the directory name right after the file name on the tabs, making it painless to work with the file structure.

Re: Reflections on Migrating My SaaS to SvelteKit

#30
post #8
post #5

how does it compare with react?

Very different. Svelte has magic event bindings and compiles `.svelte` files. Their learning material is interactive and worth going through just to see some new ideas.

It certainly feels like that, but there’s actually a lot more magic happening under the hood with React.

You can open the compiled svelte output and follow through the entire code path for updates in a few minutes.

Post reply on HN