Note: the recommended way to run Crosshare locally is to use the container-based dev workflow outlined in the README.
Most of these instructions are written for unix-like OSes - folks have had success using Windows Subsystem for Linux to follow them on Windows, though.
Visit http://console.firebase.google.com/, click "add project" or "create a project". Use whatever name you'd like. You don't need to enable google analytics.
Click "Build" in the side bar, then "Authentication". Click "Get started". Click on the "Google" sign-in provider and toggle to "Enabled". Use anything you like for public facing name and enter your email as the project support email. Click "Save".
Click "Firestore Database" in the side bar. Click "Create database". Choose "start in production mode" and any storage location.
Click the little gear icon in the side bar and select "Project settings". Scroll to the "Your apps" section and click "</>" to create a web app. Register an app using whatever name you'd like. You don't need to set up hosting.
Copy the const firebaseConfig = {...}
lines from the Add Firebase SDK dialog that pops up and paste them into a new file at app/firebaseConfig.ts
. Change const firebaseConfig
to export const firebaseConfig
. These are the credentials used by the Crosshare frontend.
Now click "Continue to console" and click "Service accounts" at the top of the Project Settings page. Under "Firebase Admin SDK" click "Generate new private key". Save the resultant file as serviceAccountKey.json
in the root of this repository. This is the credential file for the Crosshare server.
Crosshare is currently deployed on node 20 - on Fedora it's:
$ sudo dnf install nodejs20
We use pnpm
for package management:
$ corepack enable pnpm
Install dependencies:
$ cd app
$ pnpm install
While still in the app/
directory, connect to your firebase project:
$ npx firebase login
$ npx firebase use --add
Now deploy the firestore rules and indexes:
$ npx firebase deploy --only firestore
Compile the i18n definitions:
$ pnpm compileI18n
Then start the server:
$ pnpm dev
You should now be able to view Crosshare locally at http://localhost:3000
Note: The indexes you created with firebase deploy --only firestore
can take a while to finish building. You might get related errors when viewing the site until they are done.
When running the constructor locally you'll get an error trying to download the word database. You can follow the instructions in the deployment guide to build and upload a version to your firebase app, or you can download a pregenerated worddb.json
(generated March 16, 2023) and upload it using the final command in the deployment guide.
Once the wordlist has been updated you need to update your cloud storage CORS settings so it can be downloaded in the browser. This stackoverflow post gives a step-by-step run down.