2020-09-15 22:28:15 +08:00
# Contributing
2020-09-15 21:53:17 +08:00
2020-10-06 05:29:49 +08:00
## Technologies
- NodeJS v10
- Firebase
2020-11-02 15:16:17 +08:00
## Prerequisite - Firebase Setup
2020-09-15 22:01:36 +08:00
2020-10-06 05:29:49 +08:00
1. [Create a new Firebase project. ](https://console.firebase.google.com/u/0/ )
2020-10-16 05:05:28 +08:00
- The project name doesn't really matter, but just name it `monkeytype` .
2020-10-06 05:29:49 +08:00
- Google Analytics is not necessary.
2020-09-15 22:01:36 +08:00
2020-11-02 15:16:17 +08:00
1. [Install the Firebase CLI ](https://firebase.google.com/docs/cli )
1. Run `firebase login` on your terminal to log in to the same google account as you just used to create the project.
1. Git clone this project.
2021-04-10 03:19:21 +08:00
1. Duplicate `.firebaserc_example` , rename the new file to `.firebaserc` and change the project name of default to the firebase project id you just created.
2020-09-15 22:01:36 +08:00
2020-10-06 05:29:49 +08:00
- If `.firebaserc_example` does not exist after cloning, create your own with:
```.firebaserc
{
"projects": {
2021-01-04 02:27:40 +08:00
"default": "your-firebase-project-id"
2020-10-06 05:29:49 +08:00
}
}
```
2020-09-15 22:01:36 +08:00
2020-10-06 05:29:49 +08:00
- Run `firebase projects:list` to find your firebase project id.
2020-09-15 21:53:17 +08:00
2020-11-02 15:16:17 +08:00
1. Generate a Firebase Admin private key
2020-09-15 22:28:15 +08:00
2020-10-06 05:29:49 +08:00
- In your Firebase console, go to Project Settings > Service Accounts
- Click "Generate New Private Key"
- Save as `serviceAccountKey.json` in the `functions/` directory
2020-09-15 22:28:15 +08:00
2021-02-16 07:54:43 +08:00
1. Enable Firebase Authentication
- In the Firebase console, go to Authentication
- Click on `Email/Password` , enable it and save
- Click on `Google` , add a support email and save
2021-03-12 01:08:12 +08:00
1. Enable Firebase Firestore
- In the Firebase console, go to Cloud Firestore
- Create database
- Start in test mode
- Select default location and enable
2020-11-02 15:16:17 +08:00
## Building and Running
2020-10-06 05:29:49 +08:00
2020-11-02 15:16:17 +08:00
1. Run `npm install` in the project root directory to install dependencies.
2020-11-02 19:19:24 +08:00
1. Run `npm run start:dev` to start a local dev server on port 5000. It will watch for changes and rebuild when you edit files in `src/` or `public/` . Use ctrl+c to stop it.
2020-12-12 04:51:41 +08:00
- Run `firebase use <your-project-id>` if you run into any errors for this.
2020-10-06 05:29:49 +08:00
2020-11-02 15:16:17 +08:00
## Standards and Conventions
2020-10-04 19:29:12 +08:00
2021-03-19 09:16:28 +08:00
1. Code style is enforced by [Prettier ](https://prettier.io/docs/en/install.html ), which is automatically ran every time you `git commit` (if you've followed the above instructions properly).
2020-09-15 21:53:17 +08:00
2020-09-15 22:28:15 +08:00
## Questions
2020-10-04 19:35:25 +08:00
If you run into any problems, let me know on [GitHub ](https://github.com/Miodec ) or [Discord ](https://discord.gg/monkeytype ) in the `#development` channel.