-
So this cms uses file uploading to GitHub...I think?... rather than using node js or an external database, etc...which is super interesting to me and what initially attracted me to it...I want to understand how that works and how I could implement something like that myself, but I don't even know where to start. I wanted to start by simply grabbing data from a form, including images, and upload that to a GitHub repo via sveltekit, using any host, like Vercel, netlify, etc...rather than using adapter-node, for instance... So ultimately my question is how can I do something like that from a svelte or sveltekit app that is not using adapter-node, meaning I would need to communicate with GitHub directly...I think... For example, how does Sveltia CMS do this? Anyway, thank you :-) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Yes, Sveltia CMS uses the GitHub GraphQL API to upload files. This example just shows a simple text file, but any file, including images, can be uploaded if encoded in base64. Sveltia’s implementation can be found in github.js 🙂 I think Netlify/Decap CMS still uses the REST API to upload files, which is unnecessarily complicated. The GraphQL API is way easier! |
Beta Was this translation helpful? Give feedback.
-
hmmmm...could i basically use the github.js file as is in another sveltekit based cms? With the imports, of course. I'm really starting to get interested in the idea of a headless CMS from the perspective of data storage and retrieval...what i mean is the cms is not designed or styled by default, but has built data handling for different data storage options, like github, or supabase(postgres), mongo, etc... maybe like...sveltekit adapters...so the cms infra would be providing different adapters for different data storage options...maybe one could even mix and match them in a form... So a devloper can design and style the cms in any way they see fit for the project, allowing one to create bespoke custom cms experiences for each client, rather than an off the shelf fully built out cms with limited customization options, but the underlying infra, I'm really into this idea at the moment... dunno how practical it is, though... |
Beta Was this translation helpful? Give feedback.
Yes, Sveltia CMS uses the GitHub GraphQL API to upload files. This example just shows a simple text file, but any file, including images, can be uploaded if encoded in base64. Sveltia’s implementation can be found in github.js 🙂 I think Netlify/Decap CMS still uses the REST API to upload files, which is unnecessarily complicated. The GraphQL API is way easier!