1

We have been using Svelte for some time and are now introducing Contentful. We'd like to continue our apps in Svelte, but all documentation suggests we have to use SvelteKit.

Has anyone successfully used Svelte with Contentful? And if so, do you have any tips/sticking points/examples that could be helpful?

Thanks!

lou_weez
  • 11
  • 1

1 Answers1

3

You can definitely use Svelte on its own with Contentful, but it's not advised.

This is because with Svelte (or React) your application runs entirely on the front-end, and your Contentful Space ID and Access token have to be included with your JavaScript on the client. So, someone else can use these credentials and send requests to the Contentful API on your behalf.

Now, this might be OK if you have a very high rate limit (that depends on your plan) but using SvelteKit (or Next.js) allows you either generate your website statically or render it on the server, and lets you to make sure your credentials never get sent to the client.