At the meetup on Thursday, I was inspired by the excellent presentation about a tool for streamers by @KrisCoulson, and joined the call during the open time and talked about a related idea I have. The idea is to make it convenient to run a server (or a long-running process), like is needed for a discord bot, using the serverless platform to handle most of the app’s functionality including the user interface, the api, database migrations, configuration, and more.
I’ve started work on it in a repository (on GitHub and GitLab). I have made it run the discord bot inside the redwood API, using redwood only to build it, so the serverful component doesn’t need to have access to the database. Depending on the requirements of the app, that may be wanted, but for most, the data can be accessed through the API.
Currently it’s just a bot that says “Cheetos” whenever it is mentioned. It’s running in my startup’s Discord. There’s a link to it in the hybrid-bot README.
I am making functionality that uses the database now, to show integration between the serverless and the serverful components. I have added a model for drawing entrants, with a scaffold, and am adding an API key to the configuration, and making it so the serverful component only uses the API_KEY which is shared between the serverless and serverful component, to start up, and having the serverless component send the Discord bot token to the serverful process. After that I will work on making the deployment and updating of the serverful component smooth. It could run on a $5 VPS or a serverful PaaS like fly.io
.
I’d like to make an official cookbook entry once I get things working smoothly.
I hope this will be useful and be the start of a lot of collaboration in the Redwood.js community. I may stream some of the work on twitch. I’m happy to get feedback or help building it! Thanks.