Skip to main content
Stiletto uses environment variables to configure various aspects of the application. These variables should be defined in a .env file in the root of your project.

Setup

Copy the .env.example file to .env and update the values according to your environment:
cp .env.example .env

Variables Reference

VITE_PUBLIC_URL

VITE_PUBLIC_URL
string
required
The public URL where your Stiletto instance is hosted.Example: https://stiletto.deeme.devThis is used for:
  • Generating absolute URLs
  • Social media meta tags
  • API callbacks and redirects
VITE_PUBLIC_URL=https://stiletto.deeme.dev

VITE_RESOURCES_URL

VITE_RESOURCES_URL
string
required
The URL of the API endpoint that serves static resources including icons, images, and map tiles.This endpoint should provide:
  • Item icons
  • Walker images
  • Map tiles generated using gdal2tiles-leaflet
  • Other game assets
VITE_RESOURCES_URL=https://api.example.com/resources

VITE_API_URL

VITE_API_URL
string
required
The base URL of the Stiletto API server.The API handles:
  • Clan management
  • Trading system
  • Discord integration
  • Walker tracking
  • User authentication
  • Diplomacy and alliance systems
API repository: stiletto-node-api
VITE_API_URL=https://api.stiletto.deeme.dev

VITE_DISCORD_CLIENT_ID

VITE_DISCORD_CLIENT_ID
string
required
Your Discord application’s client ID for OAuth integration.Used for:
  • Discord OAuth login
  • Linking clans to Discord servers
  • Discord bot integration
To get a Discord client ID:
  1. Go to the Discord Developer Portal
  2. Create a new application or select an existing one
  3. Copy the “Application ID” from the General Information page
VITE_DISCORD_CLIENT_ID=your_discord_client_id_here

VITE_PLAUSIBLE_URL

VITE_PLAUSIBLE_URL
string
The URL for Plausible Analytics integration (privacy-friendly analytics).If you’re using Plausible for analytics, provide your instance URL here. Leave empty if not using analytics.Example: https://plausible.io or your self-hosted instance
VITE_PLAUSIBLE_URL=https://plausible.io

VITE_VERSION

VITE_VERSION
string
default:"$npm_package_version"
The current version of the application.This is automatically populated from package.json during build. You typically don’t need to set this manually.Current version: 5.45.0
VITE_VERSION=$npm_package_version

Example Configuration

Here’s a complete example .env file:
.env
VITE_PUBLIC_URL=https://stiletto.deeme.dev
VITE_RESOURCES_URL=https://api.stiletto.deeme.dev/resources
VITE_API_URL=https://api.stiletto.deeme.dev
VITE_DISCORD_CLIENT_ID=123456789012345678
VITE_PLAUSIBLE_URL=https://plausible.io
VITE_VERSION=$npm_package_version

Development vs Production

For local development, you can point to localhost or development servers:
VITE_PUBLIC_URL=http://localhost:5173
VITE_RESOURCES_URL=http://localhost:3001/resources
VITE_API_URL=http://localhost:3001
VITE_DISCORD_CLIENT_ID=your_dev_discord_client_id
VITE_PLAUSIBLE_URL=
VITE_VERSION=$npm_package_version
For production, use your actual domain and API endpoints:
VITE_PUBLIC_URL=https://stiletto.deeme.dev
VITE_RESOURCES_URL=https://api.stiletto.deeme.dev/resources
VITE_API_URL=https://api.stiletto.deeme.dev
VITE_DISCORD_CLIENT_ID=your_prod_discord_client_id
VITE_PLAUSIBLE_URL=https://plausible.io
VITE_VERSION=$npm_package_version
Never commit your .env file to version control. The .env.example file should contain placeholder values only.

Using Environment Variables

In your code, access these variables using Vite’s import.meta.env:
const apiUrl = import.meta.env.VITE_API_URL;
const discordClientId = import.meta.env.VITE_DISCORD_CLIENT_ID;
All environment variables in Vite must be prefixed with VITE_ to be exposed to your application code.

Troubleshooting

  • Ensure your .env file is in the project root
  • Restart your development server after changing .env
  • Check that variable names are prefixed with VITE_
  • Verify your Discord Client ID is correct
  • Check that your redirect URIs are configured in the Discord Developer Portal
  • Ensure the client ID matches your environment (dev vs production)
  • Verify the API URL is accessible
  • Check for CORS configuration on the API server
  • Ensure the API is running and healthy

Contributing Guide

Learn how to set up your development environment

API Documentation

Explore the Stiletto Node API repository

Build docs developers (and LLMs) love