The Cocktail Collective is a community-driven platform to upload and share cocktail recipes. This is the monorepo that contains the server, client & a shared models package
Environment | Web | API |
---|---|---|
Production |
TBD |
TBD |
- WebStorm or Visual Studio Code
- Volta (recommended) or Node Version Manager (Mac | Windows)
- Docker Desktop
- Google Cloud CLI
- Access to the
the-cocktail-collective
Google project
- Setup application default credentials in the gcloud cli. This is needed to authenticate for gcloud services like Cloud Storage.
- Copy the contents of
.env.example
to a new file.env.local
(root project folder) and modify accordingly. - Run these commands:
# Run the mongodb database locally with docker
docker compose up -d
# Make sure you are using the correct node version, Volta does this automatically
# When using nvm, locate the `volta.node` key in `package.json` and set the version accordingly
nvm use <version>
# Install npm dependencies
npm i
# Run a dev-server for the api
npm run dev -w server
# In a separate terminal, run a dev-server for the client
npm run dev -w client
GitHub Actions are used for automatic code-checking.
- On merge for the main branch:
- Run tests for the server
- Run a build for the server
For infrastructure deployments see Terraform
We use Terraform for infrastructure as code. Authentication from Terraform to Google Cloud is done via ADC, see setting up ADC.
We use npm workspaces to manage the monorepo. To install packages, run it in the root and specify which workspace you need it in like this:
npm i <package> -w server # To install <package> in the server workspace
npm run dev -w client # To run the dev command in the client workspace
We use Dependabot for automatic dependency updates
- Creates a PRs for all outdated dependencies
- Checks for NPM & GitHub Actions dependencies
- Every monday at 6:00 (GMT+1)
The server has secrets (hashing keys, api keys etc.). These are stored in different locations for the different environments:
- The development secrets are fetched from the
server/.env.local
file. - The testing secrets are fetched from the
.env.test
file.- These are used in local tests & GitHub Actions
- Because of this, they are checked into version control, make sure not to put actual credentials in this file!
- The production secrets are fetched from GCP Secret Manager