Dec 4, 2018 - By Megan Dobransky

Use Case: How Casperr is building Extensions easier with the Config Service

Use Case: How Casperr is building Twitch Extensions easier with the Config Service

Technology shouldn’t stifle your creativity. We want you to spend time realizing your great ideas, not on the infrastructure to make them work. Until now, developers had to build out — and scale — all parts of their Extension backend, even for common scenarios like handling channel- and Extension-specific configuration. That’s why we built the Configuration Service.

The Configuration Service enables you to store persistent per-channel and per-Extension specific data, and have it provided to your front-end on Extension start up. This is a common pattern needed for most Extensions, and in the past, developers would need to build this themselves. With the Config Service, developers can quickly support scenarios like enabling broadcasters to customize your Extension, store UserIDs to call third-party APIs from your Extension back-end service, or save Extension-wide settings. More importantly, you don’t need to expose your backend to the frontend on initial load, reducing your need to scale.

The Config Service is one of the first of our Scaling Solutions and it’s not a panacea, but it does reduce the complexity of building an Extension backend, because developers shouldn’t need to build for and scale a very common scenario. You can focus more on bringing your ideas to life. That’s certainly what Casperr is excited about.

Casperr has been a web developer for six years, but in his free time, he likes to build things that relate to streaming and gaming. He was already using the Twitch API to experiment, so when Extensions were announced, he got right to work.

“I saw Extensions as a way to integrate concepts I was already working on more easily. I wanted to see if it could be helpful for the community.”

That’s where most of Casperr’s Extension ideas come from. “Most of my Extensions are just things that I thought would be useful. My first Extension was for a notification about latest followers. My stream is tiny, so a new follower is a huge deal,” Casperr said.

For Casperr, while generating revenue is a nice bonus, Extensions are about personal development and the fulfillment of creating something that is useful for the Twitch community.

While Extensions and the Twitch API helped Casperr get started bringing his ideas to life, he hit a pretty big roadblock right away. To build a Twitch Extension, developers needed to build and operate the backend. “I’m a full-stack developer, but setting up the backend put me off some of my next ideas.” For instance, Casperr wanted to develop a Twitter feed, but someone would have to approve the handle and he couldn’t do that without building the server and database.

The Configuration Service was built to help developers just like Casperr.

In mid-November, Casperr launched a new Extension implementing the Config Service: Featured Viewer.

“This one was exciting for me, because it was one that I had the idea for all the way back when I first considered building a Bits-enabled Extension, but held off because I wasn’t comfortable doing the back-end work required. Now with Config Service, I was able to build it with no worries!”

The premise of the Extension is that a viewer exchanges Bits to become a “Featured Viewer” on the channel of the streamer with the Extension installed. This could either be as a means to advertise their own channel, or simply to showcase themselves as a super fan. The Featured Viewer is displayed for 10 minutes, so the metadata about that viewer has to be stored somewhere in order to serve it to all the other viewers who are watching the broadcast at the time of the transaction and those who joined the stream sometime during those 10 minutes.

Without the Config Service, Casperr said he would have likely needed to design and build a relational database with multiple tables and records for every single streamer with the Extension installed, write to it on every transaction, and read from it on every single page view. “While this may be a relatively simple database application, it is not an area I have much experience in,” Casperr said.

With the Config Service, Casperr can store a very simple JSON string in the Config Service itself, which is specific to the streamer’s channel so no fiddling with relationships was required. After 10 minutes, rather than delete the data, Casperr simply stops displaying it. When a new Featured Viewer comes along, the config is overwritten and a PubSub message is sent so all viewers current and future will see the new Featured Viewer.

Casperr does still have to use an Extension Backend Service (EBS)to verify the transaction, update the config (as the initiation of config update comes from a viewer as opposed to broadcaster), and send the PubSub message. However, the Config Service took away his personal concerns of database architecting.

Casperr is next planning to upgrade his Latest Followers Extension to have monetized features and use theConfig Service to give users the option to toggle features on or off, so that feature will use just the JavaScript API without needing to send any calls from the backend.

With Config Service, Casperr is able to bring his ideas to life easier and faster — and you can, too!

There are a few ways that you can get started with the Configuration Service.

Try the Configuration Service samples on GitHub:

From your desktop machine, download or update the Developer Rig.

Watch the Configuration Service 101 video tutorial.

Join the Amazon Web Services Credit Program to help you get started.

As always, let us know what you think by connecting with us @TwitchDev on Twitter, in the Developer forums, or on our monthly live broadcast (follow us for notifications when we’re live).

Ready to build interactive experiences on Twitch? Start now!

In other news
Dec 5, 2018

Announcing December’s Free Games with Prime

December has arrived, which means we’re bringing you a new slate of Free Games with Prime. Starting today, you’ll be able to claim and play…
Announcing December’s Free Games with Prime Post
Nov 30, 2018

Developers come together for a gathering of music and tech at Capitol Royale

Twitch is partnering with Capitol 360 Innovation Lab as a Founding Member to bring you Capitol Royale, a two-day tech conference and…
Developers come together for a gathering of music and tech at Capitol Royale Post