DerPenz
DerPenz17mo ago

Is svelte support planned? update: its supported!

The only frontend library I now well is svelte but I really wanna try your Baas. Will the be support for it? And if so is there a planned release date?
56 Replies
jamwt
jamwt17mo ago
hi! @DerPenz we don't have an official client library yet, @ballingt has been working in this area on a more general javascript client that makes it easier to attach convex to non-react frameworks, and I do have an unofficial project for a long time ago: https://github.com/jamwt/svelte-convex
GitHub
GitHub - jamwt/svelte-convex: Quick, rough example using Convex wit...
Quick, rough example using Convex with Svelte. Contribute to jamwt/svelte-convex development by creating an account on GitHub.
jamwt
jamwt17mo ago
I think Tom might also have an updated version of it, but I'm not 100% sure
ballingt
ballingt17mo ago
I've got something similar, I'll get an example out this week! I showed @Jacob Wright who knows Svelte well my example he had some helpful feedback I'm incorporating.
DerPenz
DerPenzOP17mo ago
Thanks for the help. I will be looking into it That would be amazing Do you maybe have a Sveltekit example?
ballingt
ballingt17mo ago
Yep that's what I've been doing to make sure we server-side rendering so omnipresent in Sveltekit works
DerPenz
DerPenzOP16mo ago
Any update on this?
ballingt
ballingt16mo ago
Wow it's a week later already? @DerPenz this isn't out yet, I'm still working on getting a callback-based JavaScript client out.
ballingt
ballingt16mo ago
@DerPenz In the meantime, here's a draft SvelteKit example: https://github.com/thomasballinger/draft-demo-convex-sveltekit
GitHub
GitHub - thomasballinger/draft-demo-convex-sveltekit
Contribute to thomasballinger/draft-demo-convex-sveltekit development by creating an account on GitHub.
ballingt
ballingt16mo ago
ballingt
ballingt16mo ago
This is a bit messy and I've since learned about some even better patterns we can use — but if having a Sveltekit example is blocking you from getting started this should work! It was real fun to play with this, SvelteKit feels pretty good — I love getting to use good old CSS but in the same file as my component. @DerPenz let me know if you have any questions with this
DerPenz
DerPenzOP16mo ago
Thanks I will look into the draft later. I wanna participate in the web dev cody hackathon and I am most confident with sveltekit. As long as the basic realtime works its enough.
ballingt
ballingt16mo ago
The reactivity isn't bad, half of the code is getting server-side rendering working
Gray
Gray16mo ago
Definitely keen to see this when it's ready (or even before)! I pieced together a framework-agnostic, callback-based reactive client a few months ago as I was initially exploring Convex but haven't had time since then to do much with it. Is the idea to include your client in Convex releases going forward, or is it just an example of how you'd build one on top of the base web client?
ballingt
ballingt16mo ago
The callback-based client will be in Convex releases. It's something we've been meaning to do for a long time, it doesn't provide anything you couldn't implement based on the BaseConvexClient but it should cut down on the boilerplate we've noticed in when people write Svelte, Vue, Solid etc. clients.
ian
ian16mo ago
@Gray the ConvexClient is out now with Convex 1.3 https://news.convex.dev/announcing-convex-1-3/ It's not a full Svelte client, but it makes it easier to build one without pulling in ConvexReactClient
Convex News
Announcing Convex 1.3
Convex 1.3 brings a new callback-based JavaScript client for using Convex in non-React apps and a way to propagate error information for better error handling UX. We’ve also made a bunch of improvements to our CLI and runtime! Callback-based JavaScript client The reactive paradigm is a great fit
Gray
Gray16mo ago
Thanks, will check it out!
ballingt
ballingt16mo ago
I also just updated https://github.com/thomasballinger/draft-demo-convex-sveltekit, it's a bit simpler now that it uses ConvexClient instead of the React client Excited about the new Svelte changes announced today, as a non-Svelte native speaker the new syntax is clearer to me!
yarrichar
yarrichar16mo ago
Ooh, I'll have to take a look. I cam here to ask if anyone has auth working with convex + svelte? The convex + svelte example above worked fine for me, but then I realised I didn't know an auth solution for that combo. So I had to go back to react for web dev cody's hackathon.
burnstony#1975
burnstony#197515mo ago
@yarrichar any luck with auth
burnstony#1975
burnstony#197515mo ago
Convex needs a template inn Vercel for both React and Svelte https://github.com/vercel/examples
GitHub
GitHub - vercel/examples: Enjoy our curated collection of examples ...
Enjoy our curated collection of examples and solutions. Use these patterns to build your own robust and scalable applications. - GitHub - vercel/examples: Enjoy our curated collection of examples a...
burnstony#1975
burnstony#197515mo ago
@ballingt Adding a template If you would like the example to be featured in vercel.com/templates then also add the front matter metadata to the top of the readme, like in bot-protection-datadome. To know all the possible values for each metadata take a look at internal/fields.json. If you want to add related templates to your template, copy the slug from the other template into the relatedTemplates field, for example for vercel.com/templates/next.js/monorepo-turborepo the slug is monorepo-turborepo, as written in solutions/monorepo/README.md
yarrichar
yarrichar15mo ago
No I didn't in the end - so I ended up back with nextjs. In hindsight I don't think it would have been too hard to do a custom auth provider: https://docs.convex.dev/auth/custom-auth Here is an example of a custom provider for next auth: https://discord.com/channels/1019350475847499849/1019350478817079338/1133076376501637140
Custom Auth Integration | Convex Developer Hub
Convex can be integrated with any identity provider supporting the
vamshinenu
vamshinenu14mo ago
@yarrichar did you try Lucia It’s crazy simple
MergeTree Maxxer
MergeTree Maxxer12mo ago
Custom Auth is super easy in theory but the docs are super confusing Wait can I access user context with this?
jamwt
jamwt12mo ago
@Merge Tree Maxxer this client has a setAuth handler which you can use to integrate the framework's auth capabilities
MergeTree Maxxer
MergeTree Maxxer12mo ago
Sexyyyy. Are there docs for that I'm missing somewhere?
MergeTree Maxxer
MergeTree Maxxer12mo ago
Ah cool coollll
ndamofli
ndamofli8mo ago
Having seen so many amazing walkthrough videos on stack for nextjs apps, I think that a sveltekit/convex saas video is in line... A good boilerplate / template would help many of us svelte devs get on board with convex. Svelte with convex would be a combo made in heaven...
jamwt
jamwt8mo ago
@ballingt on our team has been investing in this quite a bit lately, and we recently added Svelte to our list of supported frameworks! see
No description
jamwt
jamwt8mo ago
the page with links is here: https://docs.convex.dev/client/svelte
Svelte | Convex Developer Hub
Convex is a great fit for reactive UI frameworks like Svelte. The
jamwt
jamwt8mo ago
client library, and example app
ballingt
ballingt8mo ago
@ndamofli do you have a favorite style of video for something like this? What would you want out of a video here? I agree videos can be nicer than text tutorials because there's no elision, ever single step is visible — but wondering what else you'd want beyond "create a sveltekit app, add convex, hook it up"
ndamofli
ndamofli8mo ago
Hi Tom.! First of all congrats on your amazing videos… As far as the tutorial video is concerned, a basic saas boilerplate app would be sufficient. Even a note / todo list would be ok I guess.. Sveltekit, ssr auth ( clerk or native convex) user / data stores, dynamic routes, file uploads, maybe a cloud function call as an example… Stripe / Lemon squeezy integrations would be godsent.. This feels a lot like a letter to santa..
ballingt
ballingt8mo ago
Thanks @ndamofli, helpful to hear! A video of this level could take a while but message received that this level of detail would be helpful.
GhostBob
GhostBob4mo ago
@ballingt just started testing convex with svelte and turns out, some 3rd party libraries I use with svelte 4 not working with svelte 5. Will convex ever support svelte 4 or it's totally not possible due inner architecture?
iScream
iScream4mo ago
Hi @GhostBob, I was in your shoes when I decided to join the hackathon (vol 2). All I did with Svelte before was relying on Svelte 4 but convex-svelte is built on Svelte 5, so it forced me to learn Svelte 5, and replace everything which does not support it. It has only been a two weeks journey in total but it was worth the effort. Svelte 5 is so much easier than Svelte 4, so I would recommend switching to it even if you feel it hurts. The project is private on github yet, but I will open it to public after 17th of September. Till then check out the result if you are interested: https://discord.com/channels/1019350475847499849/1283704544932397056/1283704544932397056
GhostBob
GhostBob4mo ago
@iScream it would be hard to substitute shadcn-svelte library components with another one
iScream
iScream4mo ago
I also use it, and all it does just warn about context="module" is being deprecated and use the module attribute instead. Do you have any other issue?
GhostBob
GhostBob4mo ago
small issue here and where, also can't install svelte-chartjs.
iScream
iScream4mo ago
There is a bug opened in svelte-chartjs about Svelte 5 (https://github.com/SauravKanchan/svelte-chartjs/issues/158). The author does not show any activity in the repo, but there are some contributors whom might be worth pinging.
GitHub
Issues · SauravKanchan/svelte-chartjs
svelte wrapper for chart.js. Contribute to SauravKanchan/svelte-chartjs development by creating an account on GitHub.
iScream
iScream4mo ago
GitHub
niemyjski - Overview
Open source software architect, beekeeper and private pilot. - niemyjski
GhostBob
GhostBob4mo ago
@iScream do you use convex auth with your svelte app? Can't find any documentation about convex svelte auth...
iScream
iScream4mo ago
I use Auth.js. There are tutorials in Convex doc about it, but I had to implement my own component instead of the React one. The tutorials describe auth.js setup, custom adapter and Convex function implementations.
GhostBob
GhostBob4mo ago
so technically - lucia auth - could be implemented too?
iScream
iScream4mo ago
I guess so.
GhostBob
GhostBob4mo ago
thank you
v
v4mo ago
Yep, super easy too
GhostBob
GhostBob4mo ago
@v found some issues that lucia v3 is not working with convex: https://github.com/get-convex/convex-lucia-auth/issues
GitHub
Issues · get-convex/convex-lucia-auth
Convex database adapter for Lucia Auth. Contribute to get-convex/convex-lucia-auth development by creating an account on GitHub.
v
v4mo ago
GitHub
GitHub - vynxc/lucia-svelte-convex-demo
Contribute to vynxc/lucia-svelte-convex-demo development by creating an account on GitHub.
v
v4mo ago
Simple implementation here
GhostBob
GhostBob4mo ago
interesting - thank you
v
v4mo ago
If you need help you can ping me, but I may be off to be soon I just pushed a fix to a broken commit. I believe it should all be working but I haven't tested it much Super easy to add oauth too
GhostBob
GhostBob4mo ago
great

Did you find this page helpful?