Since my early days of programming, I have had an affinity for creating interesting applications that users could interact with. While most of my passion nowadays is reserved for fun and interesting backend web projects, a backend is nearly meaningless without an enjoyable frontend for people to play with. One of the easiest ways to add user interactions to a backend is with a Discord bot. One of the most interesting ways to get creative with a Discord bot is by giving it persistent state through some type of web API.

What Is a Standalone Discord Bot Capable Of?

Discord bots often offer tools and utilities to users. A simple bot may be able to utilize a server's state using Discord's built-in roles and permission system. This is often enough for most utility bots and for bots that provide fairly simple services such as moderation, providing links to important resources, managing some type of starboard/highlighted messages channel, or really any task you can think of that does not depend too much on any type of persistent state or historical data.

Simple games like tick-tack-toe, or possibly even chess can be written into a Discord bot that has no persistence or backend, but things become much more interesting when you add some way to store data on a backend that is separate from the bot itself.

Benefits of a Web Backend

A web backend not only provides data and bindings to your Discord bot, but also allows you to access that data across any number of user-facing applications. Providing a database and a REST API for a bot means you can store all sorts of configuration, decisions, and other data for your users. This data can either be recalled later by the bot or served somewhere else entirely--a website.

A Practical Example

Easily my favorite example of utilizing persistent data across a Discord bot and web API is a Discord-integrated role-playing game.

An RPG built with an API and Discord bot allows players to create and level up characters, find unique unlocks, complete quests, and have long-term campaigns with their friends. In Discord alone, this can still be quite fun, however the real fun comes once these characters in your Discord game transcend the application and are now accessible in web browsers, or even mobile apps. Websites and mobile apps are much better fit for custom UIs and the advanced actions needed to create an enjoyable game. Utilizing a backend means players are able to login online, manage their character, play campaigns, etc... all in a nice UI that is purpose-built to be a game. The Discord bot is able to access all this data online and allow for sharing and showing off of characters and progressions. Many people camp Discord all day, so it is a very convenient, quick way to communicate, see updates, and manage their persistent game characters, but it is not always the best way to use a custom application such as an RPG.


Combining a Discord bot with a web backend can allow for more creativity and flexibility when designing an app. Developers can write entire ecosystems using a small stack of tools and just by knowing one programming language and HTML.