Skip to content

mikejseay/exquisite-text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

701 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exquisite Text

A collaborative writing game in the browser.


Exquisite Text

Exquisite Corpse is a game invented by surrealist artists in the 1920's. Each player adds to a composition in sequence, by being allowed to see only the end of what the previous person contributed. Here, I implement an online multiplayer version for poetry.

Work is tracked for this repository on the Exquisite Text Project Board.

Tech Stack

After Node is installed, use Corepack to automatically install the correct version of yarn (as defined in package.json):

corepack enable

Installation & Start

Local Development

Ensure nvm is installed. See their official installation notes for your system, but probably:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash

Install a version of Node. The current recomended version is 24:

nvm install 24
nvm use

Install corepack, a requirement for yarn:

npm install -g corepack

Clone this repository and make it your current directory. Install node modules for both the frontend and backend, while making local copies of the example .env files:

yarn
cp .env.example .env
cd server
yarn
cp .env.example .env
cd ..

In the server terminal, run yarn start, then in the root terminal run yarn start. This should automatically open a new browser tab at http://localhost:8080/. Note that by default, you will not be able to join a game from multiple tabs in the same browser on the same device unless you prevent localStorage from being reused (e.g. incognito tab, Firefox multi-accounts). This can be overridden by changing the root .env variable REACT_APP_DEBUG_SINGLE_BROWSER to true, but it will prevent you from properly debugging device recognition behavior.

Pre-commit Hooks

This project uses Lefthook for pre-commit hooks. Hooks are installed automatically when you run yarn install (via the postinstall script). On each commit, the following checks run in parallel across all three projects (client, server, app):

  • Lint (Biome)
  • Typecheck (TypeScript)
  • Tests (Vitest / Node test runner / Jest)

If any check fails, the commit is blocked. To skip hooks in an emergency, use git commit --no-verify.

For linting in VS Code, install the Biome extension.

PostgreSQL database functionality

Install PostgreSQL according to their instructions for your operating system. If you're using a Linux-like OS and have Homebrew, you can install PostgreSQL with brew install postgresql, with Linux: sudo apt install postgresql. Then start its service with Linux: sudo systemctl start postgresqlservice | macOS: brew services start postgresql.

NOTE: There are two separate .env files. PostgreSQL credentials are located in the .env in the server folder - make sure you're editing the credentials in the appropriate server .env file.

To set up the PostgreSQL backend, first log in to the default database with Linux: sudo -u postgres psql | macOS: psql postgres. Then run the following commands from the postgres command line to create the user and database that will be used for development:

CREATE ROLE me WITH CREATEDB LOGIN PASSWORD 'password';
CREATE DATABASE exquisite;
\q

Poke around the Database

\c exquisite;
\d
\dt
\dt+
SELECT * FROM poems;
SELECT * FROM lines;

Heroku Deployment

To deploy Exquisite Text to Heroku, we will roughly follow this guide.

First, you must be using a Git-enabled command-line. For Windows, we recommend the Git Bash utility in Git for Windows.

Next, you must make an account with Heroku and install the Heroku CLI.

From the root directory of this repo, log in to your Heroku account with heroku login, which will allow you to enter your credentials through the browser. Then run the following commands:

heroku create -a my-exquisite-text
git push heroku main

This will create a new Heroku app named my-exquisite-text and build the project in that app.

Soon we will add more docs to explain how to use Heroku Postgres to keep a database of poems.

Contact

mikejseay@gmail.com

Demonstration

Click the ▶ in the top right corner to see a demonstration. Normally, each window would be on a different player's computer!

About

A collaborative writing game in the browser (combined client and server for deployment on Heroku)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages