Yet Another Browser Mud [](https://portal.azure.com#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FRoguelike-Celeb…
Yet Another Browser Mud [](https://portal.azure.com#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FRoguelike-Celeb…
This is a playful text-based online social chat space. You can think of it as a hybrid between communication apps like Slack and Discord and traditional text-based online game spaces such as MUDs and MOOs.
It was primarily built for Roguelike Celebration 2020, but can hopefully be repurposed for other events or communities.
On the backend, it's powered by a serverless system made up of Azure Functions, Azure SignalR Service, and a Redis instance (currently provided by Azure Cache for Redis), plus Google Firebase for authentication.
On the frontend, it's a rich single-page webapp built in TypeScript and React, using the Flux architecture via the useContext React hook.
This article provides some insight into the design principles underlying this project.
In context of Roguelike Celebration, we think of this project as being composed of three different parts: the frontend, the backend, and the content.
There is a browser-based "level editor" / CMS located at /admin/index.html for a valid instance (e.g. https://chat.roguelike.club/admin/index.html). To access the CMS, you will need to be an admin in that instance. Ask an existing admin, or see instructions at the end of this README if you're setting up your own instance.
There's no public docs yet for this editor tool, but hopefully it should be relatively self-explanatory given an understanding of our room format (which I think also sadly isn't documented, but will look familiar to those who have used Twine).
Clone this repo.
Run npm install.
npm run dev will start a local development environment (at http://localhost:1234/index.html by default). It auto-watches changes to HTML, CSS, and JS/TS code, and attempts to live-reload any connected browser instances.
npm run build will generate a bundled version of the webapp for distribution.
Do note that your frontend installation will not work until you have properly set up Firebase authentication and pointed it at a valid server backend (all via a .env file locally, or via GitHub repository secrets if you're deploying via our GH Actions workflows). If you are on the Roguelike Celebration organizing team, get in touch with us and we can give you credentials for an existing server instance (either staging/prod or dev, as appropriate). Otherwise, you will need a valid backend as well as API keys for a valid Firebase authentication account (see next section for setup).
This repo is set up to automatically deploy to Azure Static Web Apps when code is merged into main. (See "Deploying New Changes via GitHub Actions" below for how to finish configuring that for your fork.) If you want to host your frontend elsewhere, that's totally fine too! You can serve the asset bundle generated by npm run build anywhere, although it will need the correct secrets injected and also must be served over SSL/HTTPS.
After cloning this repo, the server directory contains all of the backend code. You may want to run npm install within the server directory to pull in dependencies for IDE autocompletion and such.
However, you cannot actually run the backend locally. You'll need to deploy your own server instance of the backend to test changes.
Currently, this project only runs on Azure. This requires your own Azure subscription.
If you don't already have an Azure account/subscription, you'll get a few hundred bucks of credits to use your first month, but if that's not the case you will want to keep an eye on the fact that running this backend will cost you actual money.
If you are a Roguelike Celebration volunteer: I apologize if this looks extremely daunting! I promise it's not a lot of work – it 90% consists of "click a link to automatically deploy a bunch of Azure stuff, then shuffle around some secret keys into GitHub Actions and a local .env file, then make a single Firebase config change".
The easiest way to deploy a backend is to use the template we have prepared. Going to this link will allow you to deploy a server backend to an Azure resource group you specify that will have everything configured, but won't actually contain code yet.
As a prerequisite, you will need the resource provider for Application Insights registered for your Azure subscription. The ARM template does not do this part for you. To register it, in the Azure Portal, go to Subscriptions and select your subscription. Then select Settings > Resource providers, find Microsoft.OperationalInsights in the provider list, select it, and click the Register button at the top of the list. You may also need to do the same for Microsoft.AlertsManagement, or you may have deployment failures for "failure anomalies smart detector alert rule" resources.
This ARM template asks you to plug in a GitHub Personal Access Token (PAT), which you can generate by going to while logged into GitHub. You want to create a "classic" token, with access to all "repo" and "workflow" permissions. I recommend making it short-lived (e.g., only valid for 7 days), as you will not need it after initial deployment.
Note: You must use a resource group that is in a region that supports Azure Static Web Apps, and most regions don't. This ARM template deploys things to the region that your selected resource group is in, and ignores the Region field. Only a few Azure regions support ASWA. Currently, those are Central US, East Asia, East US 2, West Europe, and West US 2. If your resource group isn't in one of those regions, you'll get a validation failure when trying to deploy from the ARM template.
After completing ARM template deployment, there are still a few things you need to manually configure before the app will function.
You need to add the proper connection string to your functions app. This should probably be in the template, but for now, follow these steps:
If you are a volunteer working on the core Roguelike Celebration space, you can use our development Firebase account. If you do not plan to deploy your frontend anywhere (i.e., you will just access it at localhost), you do not need to do steps beyond 2.
FIREBASE_API_KEY, FIREBASE_AUTH_DOMAIN, FIREBASE_PROJECT_ID, FIREBASE_STORAGE_BUCKET, FIREBASE_MESSAGING_SENDER_ID, FIREBASE_APP_ID, and FIREBASE_SERVER_JSON, the latter of which should contain the entire text of the attached JSON file.localhost, you need to add this locally via a .env file. In a local copy of the repo, copy .env.sample to .env and replace the dummy values with the appropriate real data.SERVER_HOSTNAME, containing the URL to your own Function App instance (the Azure URL for your backend – typically https://your-project.azurewebsite.net, where your-project is the project name you entered when deploying the Azure ARM template). Do the same thing to your local .env file as appropriate.https://[adjective]-[noun]-[hexadecimal numbers].azurestaticapps.net.From here, you will still need to deploy your backend server code, and likely deploy your frontend to the public web as well. Jump down to "Deploying New Changes via GitHub Actions" to continue setting up automatic deployments on git push.
firebaseConfig object of the JS config snippet. You should have Secrets titled FIREBASE_API_KEY, FIREBASE_AUTH_DOMAIN, FIREBASE_PROJECT_ID, FIREBASE_STORAGE_BUCKET, FIREBASE_MESSAGING_SENDER_ID, and FIREBASE_APP_ID..env.sample file to one named .env, and then replace the fake sample values for each key with the appropriate actual values you also stored as GitHub Secrets.FIREBASE_SERVER_JSON and whose value is the entire text of the downloaded JSON private key file.server/firebase-admin.json. This file will by default not be tracked by git (and we don't recommend you commit it), but you will need this file to be present if you wish to deploy the backend via CLI or VS Code instead of GitHub Actions. (See "Deploying new Changes" sections below.)No open issues yet, or sync has not completed.