Skip to content

Commit

Permalink
Merge pull request #74 from dubinc/local-dev
Browse files Browse the repository at this point in the history
Set up environment variables
  • Loading branch information
steven-tey authored Sep 30, 2024
2 parents 69cd917 + 8a6149a commit d586e7b
Showing 1 changed file with 51 additions and 7 deletions.
58 changes: 51 additions & 7 deletions local-development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ First, clone the [Dub.co repo](https://d.to/github) into a public GitHub reposit

</Step>

<Step title="Set up environment variables">

Copy the `.env.example` file to `.env`:

```bash Terminal
cp .env.example .env
```

You'll be updating this `.env` file with your own values as you progress through the setup.

</Step>

</Steps>

## Step 2: Set up Tinybird Clickhouse database
Expand Down Expand Up @@ -276,6 +288,14 @@ Prerequisites:

</Steps>

<Tip>
The docker-compose setup includes Mailhog, which acts as a mock SMTP server
and shows received emails in a web UI. You can access the Mailhog web
interface at [http://localhost:8025](http://localhost:8025). This is useful
for testing email functionality without sending real emails during local
development.
</Tip>

### Option 2: PlanetScale hosted database

<Note>
Expand Down Expand Up @@ -327,17 +347,41 @@ Prerequisites:

</Steps>

## Step 5: Set up GitHub OAuth
## Step 5: Set up Mailhog

Next, [create a new GitHub App](https://github.com/settings/applications/new). This will allow you to sign in to Dub.co with your GitHub account.
To view emails sent from your application during local development, you'll need to set up [Mailhog](https://github.com/mailhog/MailHog).

Don't forget to set the following Callback URL:
<Note>
If you've already run `docker compose up` as part of the database setup, you
can skip this step. Mailhog is included in the Docker Compose configuration
and should already be running.
</Note>

```
http://localhost:8888/api/auth/callback/github
```
<Steps>

<Step title="Pull Mailhog Docker image">

Once your GitHub App is created, copy the `Client ID` and `Client Secret` into your `.env` file as the `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` environment variables.
Run the following command to pull the Mailhog Docker image:

```bash Terminal
docker pull mailhog/mailhog
```

</Step>

<Step title="Start Mailhog container">

Start the Mailhog container with the following command:

```bash Terminal
docker run -d -p 8025:8025 -p 1025:1025 mailhog/mailhog
```

This will run Mailhog in the background, and the web interface will be available at [http://localhost:8025](http://localhost:8025).

</Step>

</Steps>

## Step 6: Start the development server

Expand Down

0 comments on commit d586e7b

Please sign in to comment.