Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20
v24
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Auth0

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
97 changes: 97 additions & 0 deletions README-ADVANCED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Advanced Instructions
This file contains steps that you can take for advanced configuration of your local environment. These instructions assume you've already run the Getting Started instructions located in the project's main README.md file.

## Mimick a production environment locally, with https (using Caddy as an example)

This section guides you through setting up a reverse proxy server to enable local HTTPS development for your project. The process involves installing Caddy, creating a configuration file (Caddyfile), setting up local domain resolution, and running Caddy.

This setup allows you to access your local development server via HTTPS using a custom domain, mimicking a production environment while working locally. It's particularly useful for testing features that require secure connections or specific domain configurations.

### Instructions:

1. Install Caddy using your operating system's package manager. Check out Caddy's installation instructions for specific steps. For example, on OSX using homebrew, you could use the following command:
```shell
brew install caddy nss
```
2. Create a file called Caddyfile in the /auth0-b2b-saas-starter/ directory on your local machine. If you have cloned the repo to a different directory, make sure to use that instead.

```shell
cd ~/Developer/auth0-b2b-saas-starter
touch Caddyfile
```
3. Open the `Caddyfile` in your favorite code editor or IDE.
4. Enter the following values in the Caddyfile.
```bash
fake-production-url.com:443 {
reverse_proxy 127.0.0.1:3000
tls internal
}
```
5. Add the following line to the end of /etc/hosts
NOTE: you have to use superuser to edit the hosts file
Example: `sudo vi /etc/hosts` or `sudo code /etc/hosts`)
```shell
# SaaStart
127.0.0.1 fake-production-url.com
```
6. In a new terminal window, navigate to the repository folder and use the `caddy run` command to start the process.
```shell
cd ~/work/assemble
caddy run # You will have to enter your password or touch ID to approve the keychain addition
```

In some cases you might get the error message “ERROR pki.ca.local failed to install root certificate”, but that's not an indication that Caddy is not working.

### Testing Caddy
1. Run the following cURL command:
```shell
curl -vI https://fake-production-url.com
```

Amongst the overall output, you should be able to see the following lines included:
```shell
* Server certificate:
* subject: [NONE]
* start date: {unix-style timestamp}
* expire date: {unix-style timestamp}
* subjectAltName: host "fake-production-url.com" matched cert's "fake-production-url.com"
* issuer: CN=Caddy Local Authority - ECC Intermediate
* SSL certificate verify ok.
```

---

## Use an email platform for managing transactional email while developing (using Mailtrap as an example)

This section guides you through setting up an email platform for easy local testing and development.

When simulating a production environment on your personal development environment, it can also be helpful to test email delivery and manage transactional emails without actually sending emails to real users. This can be achieved with an email platform of your choice, with this guide focusing on [Mailtrap.io](https://mailtrap.io) as one example. These services can act as a “fake” SMTP email provider, collecting and displaying the email messages it was supposed to send without actually delivering them. This allows you to test email functionality while creating organizations and inviting users while using any email addresses you want, even those that aren't real. This makes a solution like this ideal for troubleshooting and testing SaaStart.

> [!IMPORTANT]
> You must use an email domain that actually exists and has an MX record for testing. For example, using `acme.com` will work, but `acmeairlines.net` will not, as it lacks a valid MX record.

### Step 1: Set Up a Mailtrap Account

1. **Sign Up:** Go to [Mailtrap.io](https://mailtrap.io) and sign up for an account. You can use your Google account for quick registration.
2. Choose the **Email Testing** option during the sign-up process.
3. **Create an Inbox:** Once signed in, go to [Mailtrap Inboxes](https://mailtrap.io/inboxes) and select **My Inbox**. This is where intercepted email messages will be displayed.
4. **Obtain SMTP Credentials:** Open your inbox and click on **Show Credentials** to reveal the SMTP setup details. You'll need the host, port, username, and password to configure Mailtrap as your SMTP provider in Auth0.

### Step 2: Configure Auth0 to Use Mailtrap

1. **Access Your Auth0 Tenant:** Log in to your Auth0 dashboard and navigate to your tenant.
2. **Set Up the Email Provider:** Go to **Branding > Email Providers** in the Auth0 dashboard. Enable **Use my own email provider** and select **SMTP**.
3. **Populate SMTP Details:** Enter the SMTP credentials you obtained from Mailtrap:
- **Host:** Use the host provided by Mailtrap.
- **Port:** Use port `587` or `2525`.
- **Username and Password:** Enter the credentials from Mailtrap.
4. Click **Save** to apply the settings.

> [!IMPORTANT]
> When entering the "From" email address in the SMTP Provider Settings, **do not** include `auth0.com` or `okta.com` in the email subdomain, as this will prevent the setup from working.

### Step 3: Test Email Delivery in Auth0

1. **Send a Test Email:** After configuring Mailtrap as your SMTP provider, click on **Send Test Email** in the Auth0 dashboard. You can use any email address for testing, even a fake one.
2. **Verify Email in Mailtrap:** Go back to your Mailtrap inbox and verify that the test email has been received. You can now inspect the email content, subject, and other details to ensure everything is working correctly.

Loading
Loading