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
66 changes: 65 additions & 1 deletion docs/developer/dev-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,74 @@ $ cd api-umbrella
$ docker-compose up
```

Assuming all goes smoothly, you should be able to see the homepage at [https://localhost:8101/](https://localhost:8101/). You will need to need to accept the self-signed SSL certificate for localhost in order to access the development environment.
Assuming all goes smoothly, you should be able to see the homepage at [https://localhost:8201/](https://localhost:8201/). You will need to accept the self-signed SSL certificate for localhost in order to access the development environment.

If you're having any difficulties getting the development environment setup, then open an [issue](https://github.com/NREL/api-umbrella/issues).

## Development Data

The development environment automatically seeds some sample data to help you get started quickly.

### Admin Account

The first time you visit the admin interface, you'll need to create an admin account:

1. Go to [https://localhost:8201/admin/](https://localhost:8201/admin/)
2. Accept the self-signed certificate warning in your browser
3. Since no admin accounts exist yet, you'll be automatically redirected to a signup page
4. Fill in the signup form:
- **Email:** Enter any email address (e.g., `admin@example.com`)
- **Password:** Choose a password (minimum 14 characters)
- **Password Confirmation:** Re-enter the password
5. Click **"Sign up"** and you'll be logged in automatically

This first-time signup is only available when no admin accounts exist. Once you've created your admin account, subsequent admins can be added through the admin interface under **"Admins"** in the **"Admin Accounts"** menu.

### Demo API User

A demo API user is created with a known API key for testing:

- **Email:** `demo.developer@example.com`
- **API Key:** `DEMO_KEY_FOR_DEVELOPMENT_ONLY_1234567890`

### Demo API Backend

A sample API backend is created and published that proxies to [httpbin.org](https://httpbin.org), a useful service for testing HTTP requests:

- **Name:** HTTPBin Echo API (Dev)
- **Frontend Path:** `/echo/`
- **Backend:** `https://httpbin.org/`

### Testing the Proxy

You can test the full proxy flow using the demo API key and backend:

```sh
# Test the echo endpoint (returns request details as JSON)
$ curl -k "https://localhost:8201/echo/get?foo=bar" \
-H "X-Api-Key: DEMO_KEY_FOR_DEVELOPMENT_ONLY_1234567890"

# Test POST requests
$ curl -k "https://localhost:8201/echo/post" \
-H "X-Api-Key: DEMO_KEY_FOR_DEVELOPMENT_ONLY_1234567890" \
-H "Content-Type: application/json" \
-d '{"hello": "world"}'
```

The `-k` flag is needed to accept the self-signed SSL certificate.

### Sample Analytics Data

The development environment seeds sample API request logs so the analytics graphs have data to display. Approximately 60-150 log entries are created, spread across the past 30 days, simulating requests to the `/echo/` endpoints.

To view the analytics:

1. Log in to the admin interface at [https://localhost:8201/admin/](https://localhost:8201/admin/)
2. Go to **"Analytics"** → **"API Drilldown"** or **"Filter Logs"**
3. Select a date range that includes the past 30 days

The seeded data includes a mix of successful (200) and error (400/500) responses to demonstrate different analytics views.

## Directory Structure

A quick overview of some of the relevant directories for development:
Expand Down
Loading
Loading