This document explains how to configure the speed test application using environment variables.
Create a .env.local file in the root directory of the project (it's already gitignored).
Controls whether the application runs real speed tests or uses dummy/simulated data.
- Values:
real|dummy - Default:
real - Description:
real: Performs actual speed tests using M-Lab's NDT7 protocoldummy: Uses simulated data for UI development and testing
Example:
NEXT_PUBLIC_TEST_MODE=dummyControls whether the speed test starts automatically when the page loads.
- Values:
true|false - Default:
false - Description:
true: Automatically starts the speed test on page loadfalse: User must manually click "Start Test" button
Example:
NEXT_PUBLIC_AUTO_START=trueThese variables are only used when NEXT_PUBLIC_TEST_MODE=dummy:
- Type: Number (Mbps)
- Default:
150.5 - Description: Simulated download speed in Mbps
- Type: Number (Mbps)
- Default:
75.2 - Description: Simulated upload speed in Mbps
- Type: Number (milliseconds)
- Default:
25 - Description: Simulated ping/latency in milliseconds
Example:
NEXT_PUBLIC_DUMMY_DOWNLOAD_SPEED=200.0
NEXT_PUBLIC_DUMMY_UPLOAD_SPEED=100.0
NEXT_PUBLIC_DUMMY_PING=15Use this for UI development without making actual network requests:
NEXT_PUBLIC_TEST_MODE=dummy
NEXT_PUBLIC_AUTO_START=true
NEXT_PUBLIC_DUMMY_DOWNLOAD_SPEED=150.5
NEXT_PUBLIC_DUMMY_UPLOAD_SPEED=75.2
NEXT_PUBLIC_DUMMY_PING=25Use this for production deployment with manual test start:
NEXT_PUBLIC_TEST_MODE=real
NEXT_PUBLIC_AUTO_START=falseUse this for demonstrations where you want tests to start automatically:
NEXT_PUBLIC_TEST_MODE=real
NEXT_PUBLIC_AUTO_START=true-
Copy the example file to create your local configuration:
cp .env.local.example .env.local
-
Edit
.env.localwith your preferred settings -
Restart the development server for changes to take effect:
bun dev # or npm run dev
- Environment variables starting with
NEXT_PUBLIC_are exposed to the browser - Changes to
.env.localrequire a server restart to take effect - The
.env.localfile is gitignored and should not be committed to version control - In dummy mode, a yellow banner appears at the top indicating "Development Mode"
- Dummy tests simulate realistic speed variations and take about 16 seconds to complete