Skip to Content
🔧 Developer GuideConfiguration Environment

Last Updated: 4/7/2026


Configuration & Environment

Agricultural Microworlds uses environment variables and configuration files to control development server behavior, Docker services, and ASP.NET Core settings. This reference guide documents all configuration options available in the project.

Vite Development Server Configuration

The Vite configuration file (vite.config.js) controls the client-side development server and build process. Configuration is primarily driven by environment variables.

Environment Variables

VariableTypeDefaultDescription
ASPNETCORE_HTTPS_PORTnumber7050HTTPS port for the ASP.NET Core backend server
ASPNETCORE_URLSstringhttps://localhost:7050Semicolon-separated list of URLs the backend listens on; first URL is used if ASPNETCORE_HTTPS_PORT is not set
DEV_SERVER_PORTnumber5000Port for the Vite development server
OPEN_SVGbooleanfalseWhen set to "true", opens /indexsvg.html instead of /index.html on server start

Vite Server Settings

The Vite server is configured with the following fixed settings:

SettingValuePurpose
host0.0.0.0Allows external connections (required for Docker/Codespaces)
base/development-project-agopsimulationBase public path for assets
proxy^/weatherforecast → backendProxies API requests to the ASP.NET Core backend
httpsAuto-generated certificateUses .NET dev certificates for HTTPS support

Certificate Management

Vite automatically generates HTTPS certificates using dotnet dev-certs https. Certificates are stored in:

  • Windows: %APPDATA%/ASP.NET/https/
  • Linux/macOS: ~/.aspnet/https/

Certificate files:

  • agricultural-microworlds.client.pem (certificate)
  • agricultural-microworlds.client.key (private key)

Docker & Devcontainer Configuration

The development environment runs in Docker containers orchestrated by Docker Compose. Configuration is split between docker-compose.yml and devcontainer.json.

Docker Compose Services

ServiceImagePurpose
appmcr.microsoft.com/devcontainers/universal:2-focalMain development container with Node.js, .NET, and development tools
dbpostgres:17-alpinePostgreSQL database server (not yet integrated into the application)

PostgreSQL Environment Variables

The database service is configured with the following environment variables:

VariableDefault ValueDescription
POSTGRES_PASSWORDpostgresPassword for the PostgreSQL superuser
POSTGRES_USERpostgresPostgreSQL superuser username
POSTGRES_DBpostgresDefault database name

Note: The PostgreSQL database is provisioned but not yet integrated into the application. See the Planned Database Schema guide for future schema details.

Devcontainer Port Forwarding

The devcontainer forwards the following ports from the container to the host:

PortProtocolService
5000HTTPSVite development server
5001HTTPSASP.NET Core backend (alternative port)
5432HTTPSPostgreSQL database

Devcontainer Features

The devcontainer includes the following features:

  • Prettier: Latest version installed via npm-features
  • VS Code Extensions:
    • ms-dotnettools.csharp: C# language support
    • dbaeumer.vscode-eslint: ESLint integration
    • esbenp.prettier-vscode: Prettier code formatter

Post-Create Command

After the container is created, the following command runs automatically:

cd agricultural-microworlds.client && npm install

This ensures all Node.js dependencies are installed before development begins.

ASP.NET Core Configuration

The ASP.NET Core backend uses appsettings.json and appsettings.Development.json for configuration.

appsettings.json (Production)

SettingValueDescription
Logging.LogLevel.DefaultInformationDefault log level for all categories
Logging.LogLevel.Microsoft.AspNetCoreWarningLog level for ASP.NET Core framework logs
AllowedHosts*Allowed host headers (wildcard allows all)

appsettings.Development.json (Development)

SettingValueDescription
Logging.LogLevel.DefaultInformationDefault log level for development
Logging.LogLevel.Microsoft.AspNetCoreWarningFramework log level for development

Note: The backend currently only contains a stub WeatherForecast controller. Authentication, database connections, and lesson management are not yet implemented.

Configuration File Locations

FilePathPurpose
Vite configagricultural-microworlds.client/vite.config.jsClient build and dev server settings
Docker Compose.devcontainer/docker-compose.ymlContainer orchestration
Devcontainer.devcontainer/devcontainer.jsonVS Code devcontainer settings
ASP.NET settingsAgricultural-Microworlds.Server/appsettings.jsonProduction backend config
ASP.NET dev settingsAgricultural-Microworlds.Server/appsettings.Development.jsonDevelopment backend config
Package configagricultural-microworlds.client/package.jsonnpm scripts and dependencies
Babel configagricultural-microworlds.client/babel.config.jsJest/test transpilation

No .env File

Agricultural Microworlds does not use a .env file for configuration. All environment variables are set through:

  1. Docker Compose: Environment variables in docker-compose.yml
  2. Devcontainer: Port forwarding and features in devcontainer.json
  3. Shell Environment: Variables set in the terminal before running npm run dev

To override default values during development, set environment variables before running commands:

# Example: Change dev server port and open SVG page export DEV_SERVER_PORT=3000 export OPEN_SVG=true npm run dev

What’s Next