Skip to main content

3.1 - Environment Variables

Configure the environment variables required for player-map.

Create .env file

Create a .env file at the root of your application:

# Privy App ID (required for wallet authentication)
VITE_PRIVY_APP_ID=your_privy_app_id_here

# Pinata JWT Key (required for IPFS upload)
VITE_PINATA_JWT_KEY=your_pinata_jwt_key_here

# IPFS Gateway (required)
VITE_IPFS_GATEWAY=gateway.pinata.cloud

Required Variables

VITE_PRIVY_APP_ID

Description: Your Privy application ID for wallet authentication.

How to get it:

  1. Create an account on Privy
  2. Create a new application
  3. Copy the App ID from the dashboard

Example:

VITE_PRIVY_APP_ID=clxxxxxxxxxxxxxxxxxxxxx

VITE_PINATA_JWT_KEY

Description: Pinata JWT key for IPFS file upload.

How to get it:

  1. Create an account on Pinata
  2. Go to "API Keys"
  3. Create a new JWT key
  4. Copy the JWT key

Example:

VITE_PINATA_JWT_KEY=eyJhbGxxxxxxxxxxxxxx...

VITE_IPFS_GATEWAY

Description: IPFS gateway URL (required).

Example:

VITE_IPFS_GATEWAY=gateway.pinata.cloud

Important: VITE_ prefix

⚠️ All environment variables must be prefixed with VITE_ to be accessible in Vite code.

Variables without the VITE_ prefix will not be exposed to the client.

Security

Never commit the .env file

Add .env to your .gitignore:

# Environment variables
.env
.env.local
.env.*.local

Sensitive variables

Environment variables containing secret keys should never be committed to the Git repository.