Textuality is an application that allows players to text in to a phone number, and have their text show up on a public screen. It also does a hell of a lot more (images, achievements, badges, automatic texts, moderation).
Textuality is set up as two Meteor applications: an admin app for setting up the automated texts and monitoring the texts that come in, and a client app for showing the public screens.
- Install Node
- Install Meteor:
curl https://install.meteor.com/ | sh
Textuality consists of an admin app and a client app. They are located in the textuality-admin
and textuality-client
directories. You have the option of running them individually, but it's easiest just to run them using the following command:
npm start
This will start the admin at http://localhost:5000
and the client at http://localhost:5002
. You may want to restart this command whenever you pull new code from github.
Both twilio
, used for the texting, and cloudinary
, used for the image storage, require API credentials to work. For security reasons, those API credentials are not present in this repository. You must create a settings.json
file at the root of this repo with the following format:
{
"public": {
"cloudinaryCloudName": "xxxxxxxxx"
},
"private": {
"twilioSid": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"twilioToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"cloudinaryKey": "xxxxxxxxxxxxxxxxxxxx",
"cloudinarySecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
Ask Roo for the credentials.
Textuality requires Twilio to receive texts. Twilio needs a publicly-visible endpoint to post the texts to. When Textuality is running in production, this should be set to the Galaxy URL (see Deploy
section below). In development, if two people are developing at once, you can't both be testing with the same phone number. Either purchase a new number or warn the other person you're gonna kick them off temporarily.
- Install ngrok(https://ngrok.com/download). You'll have to create an account and follow the instructions there.
- Move the
ngrok
executable to thebin
folder in this repo. - Test that it works by running
npm run open-tunnel
. - Copy the forwarding url to your clipboard. For example:
https://d9a11bf7.ngrok.io
- Goto the
Phone Numbers -> Manage Numbers
section of the Twilio admin. https://www.twilio.com/console/phone-numbers/incoming - Click on the phone number that you want to use.
- Scroll down to the
Messaging
section, and underA Message Comes In
, select Webhook. - Paste the URL from step 4 into the textbox, and add
/text-handler
to the end. For example:https://d9a11bf7.ngrok.io/text-handler
. You can leave dropdown set toHTTP POST
. - Hit
Save
. You're done!
Coming soon...
Just a quick run through of the folder structure of this app.
The following folders are no longer in use in this new branch, but I'm not deleting them yet so I can easily reference them.
textuality-app
textuality-deploy
textuality-tester
textuality-admin
: The Admin app for textuality, runs atlocalhost:5000
in dev.textuality-client
: The Client app for textuality, runs atlocalhost:5002
in dev.scripts
: Contains convenience scripts, likenpm run open-tunnel
bin
: Contains executables, currently justngrok
.
Within each meteor app, the structure is as follows:
.meteor
: Meteor versioning stuff, generally don't touch.client
: Code that runs on the browser only. Boilerplate stuff, except formain.scss
which is where we put all of our styles.imports
: This is where all the juicy bits go, broken down below.public
: Static content mostly, such as images (not including user submissions), videos, fonts, etc.server
: Code that runs from the server only.tests
: One day I'll bother with tests. Not today, Satan.
This is where basically everything lives. I use this folder instead of the client
and server
folders because this allows me to use npm's import
statements to determine what gets sent to the client. Just a better development practice, Meteor devs also recommend it.
api
: Where all of the collections live. All of the subfolders here are for the various collections, one for each. This folder is shared between the admin and client apps (the client app symlinks it to the admin app).schemas
: The schemas for the collections. Broken out because it's useful to have these all easily accessible. Shared between the admin and client apps, symlinked from client.services
: Connections to external services, such as Twilio and Cloudinary. Functional exports. Shared between the admin and client apps, symlinked from client.startup
: Code that runs when the app starts. Mostly initialization stuff.ui
: All of the react components in the whole app, basically the front end. Broken down further below.utils
: Little utility functions that prove useful across the app. Pure functions. Shared between the admin and client apps, symlinked from client.
Within each collection, the file structure is nearly idenctical:
[name]/[name].js
: Where the collection is initialized[name]/helpers.js
: All of the helpers (aka computed properties) for this collection.[name]/methods.js
: All of the server methods for this collection. Generally add/update/delete methods, plus some special cases. Mostly used by the admin app.[name]/server/publications-admin.js
: The publications used by the admin app.[name]/server/publications-client.js
: The publications used by the client app.
The UI folder is broken down as follows:
generic
: Generic components, like buttons, tables, and form inputs. Nothing domain-specific allowed. Highly reusable.modules
: Catch-all for modules that appear in the app. Domain-specific, broken down by domain subfolders.pages
: Top-level pages on the app. Subscriptions are typically managed here.App.jsx
: The React entry point for the app.Shell.jsx
: The wrapper html for the app.