External Backend

Is there a way I can have all my backend outside of switch and the interaction be the same?

If so, what are the requirements that Twitch asks for this?

Thank you

Twitch only hosts your frontend, so all extension backends are external as that’s the only option.

The only requirements is that all communication between your EBS and the frontend MUST be over SSL (eg HTTPS, or WSS).

1 Like

And do you know if all the Data obtained from users can be saved outside of twitch, is there a different process I have to complete to do this?

Depends what sort of data you want to store. If you want to store things like the broadcasters settings for your extension then your server can still use the Configuration Service https://dev.twitch.tv/docs/extensions/building#using-the-configuration-service

If you want to store data about individual users though the config service wouldn’t have the capacity for that and you would need your own database or storage solution. And keep in mind that user data you store may be subject to GDPR and other privacy laws so make sure you’re legally compliant with how you choose to handle that data.

1 Like

Thank you!

One more thing:
The file “services/backend.js” from the example code “Hello World” runs automatically and creates a local server when the extension starts or do, is this just for the example? Do I have to have all my backend outside of Twitch?
If I can have all my backend outside of Twitch, how do I communicate to the front-end that it has to start showing the data if I send the signal from “panel.html”?

You run the backend server, it’s entirely up to you to decide how and where you want to run it, Twitch has nothing to do with that. Because extensions can be used at any time you will likely want your server to run your backend code 24/7.

To communicate with your backend from your frontend you could either use a HTTPS request, or a Websocket connection. In the Hello World example, the frontend files use jQuery to make an AJAX HTTP request to the backend service, in a live extension you could do something similar, except you would point the URL to wherever you are hosting your backend server.

1 Like

So, when creating a file “services/backend.js” inside the structure of my Twitch extension it runs it as a localhost?

The developer rig can act as a server to run your backend files, but for a live extension that wont work as that wont be accessible to anyone but you.

1 Like

Thank you! This was very helpful!