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
BASE_URL_PATH/api/v1Base URL path for the API
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/api/v1
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

When using Docker, SPACE already ships with a minimal set of default environment variables.
You can override them or add new ones in docker-compose.yml:

  • Server variables → under the environment section of the space-server service
  • Client variables → under the environment section of the space-client service
  • MongoDB & Redis → also configurable under their respective services, using the standard variables from their public images

💡 Example:

services:
...
space-server:
...
environment:
ENVIRONMENT: production
ALLOWED_ORIGINS: http://localhost:3000
MONGO_URI: mongodb://user:password@mongodb:27017/space_db
REDIS_URL: redis://redis:6379
JWT_SECRET: test_secret
JWT_SALT: mySalt
JWT_EXPIRATION: 1d
space-client:
...
environment:
VITE_ENVIRONMENT: production
VITE_SPACE_BASE_URL: http://localhost:5403/api/v1
...