Skip to main content
Version: 2.0.1

⚙️ Configuring SPACE

To launch SPACE, you need to provide a set of environment variables.
These variables define how the server, the client, and the supporting services (MongoDB, Redis) are configured.

Depending on your setup (local, Docker, or Kubernetes), the way to provide these variables changes — but the variables themselves remain the same.


🌐 Server Environment Variables

These variables configure the SPACE server:

VariableRequiredDefault ValueDescription
ALLOWED_ORIGINS*Semicolon-separated string of allowed origins for CORS
DATABASE_NAMEspace_dbMongoDB database name (ignored if MONGO_URI is set)
DATABASE_USERNAMEmongoUserMongoDB username (ignored if MONGO_URI is set)
DATABASE_PASSWORDmongoPasswordMongoDB password (ignored if MONGO_URI is set)
MONGO_URImongodb://${dbCredentials}localhost:27017/${dbName}Full MongoDB connection string. dbCredentials correspond to the formatted version of DATABASE_USERNAME and DATABASE_PASSWORD, and dbName corresponds to DATABASE_NAME
REDIS_URLRedis URL for caching
JWT_SECRETSecret key for JWT generation. It can be any random string.
JWT_SALTSalt for JWT hashing. It can be any random string.
JWT_EXPIRATION1hJWT expiration (e.g., 1d, 2h)
ADMIN_USERadminDefault admin username
ADMIN_PASSWORDspace4allDefault admin password

🖥️ Client Environment Variables

These variables configure the SPACE client:

VariableRequiredDescription
VITE_ENVIRONMENTdevelopment or production
VITE_SPACE_BASE_URLBase URL of the SPACE server. For example: http://space-instance:5403
VITE_SPACE_ADMIN_API_KEY⚠️ Only in devAPI key for admin access (only works in development)

🚀 How to Provide Environment Variables

The way to configure SPACE depends on the technology you use.
Select your setup below:

🐳 Docker Setup

warning

This documentation applies to SPACE version 1.2.0 and later. If you're using an older version, please refer to the previous Docker setup instructions.

  1. Locate the .env.template file in the root of the repository
  2. Create a .env file based on it:
cp .env.template .env
  1. Adjust the variables according to your setup

📦 Environment Variables

All variables follow the standard .env format:

KEY=value

important

All environment variables not defined in the .env will be set to their default, so only instanciate those you want to override.

VariableDefault ValueDescription
BASE_PATH/spaceBase URL path
ADMIN_USERadminDefault admin username
ADMIN_PASSWORDspace4allDefault admin password
ALLOWED_ORIGINShttp://localhost:3000;https://myapp.comCORS origins (semicolon-separated)
DATABASE_NAMEspace_dbDatabase name (ignored if MONGO_URI is set)
DATABASE_ROOT_USERNAMErootMongoDB root user
DATABASE_ROOT_PASSWORD4dm1nMongoDB root password
DATABASE_USERNAMEmongoUserApplication DB user (ignored if MONGO_URI is set)
DATABASE_PASSWORDmongoPasswordApplication DB password (ignored if MONGO_URI is set)
MONGO_URImongodb://user:pass@mongodb:27017/dbFull MongoDB URI
REDIS_URLredis://redis:6379Redis connection
JWT_SECRETmy_secretJWT signing secret
JWT_SALTrandom_saltJWT hashing salt
JWT_EXPIRATION1hToken lifetime (1h, 1d, etc.)
ENVIRONMENTproductionFrontend environment
SPACE_HOSThttp://localhost:5403Public API URL
Important Notes
  • Do not define environment variables inside docker-compose.yml anymore
  • The .env file is now the single source of truth for configuration
  • Server and client variables remain unchanged; only the injection mechanism differs
  • Override sensitive values (e.g., JWT_SECRET, database credentials) in production