Skip to content

Commit

Permalink
Update backend module's README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamsinghshubham777 authored Sep 30, 2024
1 parent 2302ccb commit 69364b3
Showing 1 changed file with 50 additions and 4 deletions.
54 changes: 50 additions & 4 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# backend
# Down The Aisle (Backend 💾)

This package contains all API-related code for the `Down The Aisle` app.
This package contains all API-related code for the `Down The Aisle` system.

## Getting Started
## 🎬 Getting Started

Make sure to have the following environment variables:

Expand All @@ -11,7 +11,7 @@ Make sure to have the following environment variables:
3. JWT_ISSUER
4. JWT_SECRET

You can make a script to temporarily set the environment variables and run the server with those values, for example:
**Tip:** You can make a script to temporarily set the environment variables and run the server with those values, for example:

```sh
#!/bin/bash
Expand Down Expand Up @@ -49,3 +49,49 @@ For `production` script, just copy-paste the `connection string` that the MongoD
```
mongodb+srv://<username>:<password>@<host>/<database_name>?retryWrites=true&w=majority&appName=<app_name>
```

Let's assume that you name your script `run_server_dev.sh`, you can run the script using `./run_server_dev.sh ` from the `backend` directory.

## 🌐 Deploy on Globe

In order to run the `production` server, you can host your instance of this `backend` app anywhere you want, this is just an example showing how to do it on https://globe.dev as one option out of many.

You need to follow the guide [here](https://invertase.docs.page/globe/cli) to set up `globe CLI` on your local system. The steps are straightforward, execute the following 2 commands in order:

> **Note:** Make sure to manually create a project on https://globe.dev before following these instructions!
```
fvm dart pub global activate globe_cli
```

```
globe login
```

Then link your Globe project to your local instance by executing the following command inside the `backend` directory:

```
globe link
```

Make sure to copy the `project ID` you receive (if you don't get any, then go to globe.dev's dashboard and grab it from there).

After that, generate a `TOKEN` using the following command (and selecting the appropriate interactive CLI options):

```
globe token create
```

And once you have both these tokens, you can execute the following command to deploy your backend instance on your Globe project:

```
globe deploy --token={YOUR_GLOBE_TOKEN} --project="${YOUR_GLOBE_PROJECT_ID}" --prod
```

Replace `YOUR_GLOBE_TOKEN` and `YOUR_GLOBE_PROJECT_ID` with your own values extracted in the previous steps.

> **Note:** Know that `--prod` is `optional` and can be removed if you want to deploy only on the `preview` track and not the `production` track
If you have cloned/forked this repository, you also have the luxury to just upload your globe token and globe project ID values to your GitHub action secrets (using the following keys: `GLOBE_TOKEN` and `GLOBE_PROJECT_ID`) and as soon as you push changes to any `backend` module related files, your latest instance would automatically be deployed on Globe.

> **Note:** The GitHub action workflow is set up in a way that it deploys to the `production` branch when you push changes to the `main` branch, and deploys to the `preview` branch when you push changes to any other branch than `main`.

0 comments on commit 69364b3

Please sign in to comment.