Skip to main content

Overview

JOIP Web Application requires various environment variables for database connections, API integrations, authentication, and feature configuration. This page provides a comprehensive reference for all supported variables.
On Replit, configure all environment variables in the Secrets tab (Tools → Secrets). Never commit secrets to version control.

Required Variables

These variables are essential for the application to function:

Database Configuration

string
required
PostgreSQL connection string in standard format.Format: postgresql://username:password@host:port/databaseExample:
Neon Example:
Ensure SSL mode is enabled (?sslmode=require) for production databases.

Session Security

string
required
Secret key for signing session cookies. Must be cryptographically secure.Recommended: 32+ random charactersExample:
Generate secure secret:

Supabase Storage

string
required
Your Supabase project URL.Format: https://[project-id].supabase.coExample:
Find this in your Supabase project settings under “API”.
string
required
Supabase anonymous (public) API key for client-side operations.Example:
Find this in Supabase project settings under “API” → “Project API keys”.
string
required
Supabase service role key for server-side storage operations.Example:
Keep this secret! Service key has full access to your Supabase project. Never expose in client code.

Reddit API Integration

string
required
Reddit application client ID for content fetching.Example:
Obtain from: https://www.reddit.com/prefs/apps
string
required
Reddit application client secret.Example:
Create a “script” type application on Reddit for server-side API access.

Replit OIDC Authentication

Required for production deployment on Replit:
string
Comma-separated list of domains where your Repl is accessible.Example (single domain):
Example (multiple domains):
Behavior:
  • Application prioritizes app.joip.io if present
  • Falls back to first domain in list
  • Used for OAuth callback URL generation
  • Enables Replit OIDC authentication when set
string
Your Replit project ID (automatically populated by Replit).Example:
Required for Replit OIDC authentication in production.
string
Replit OIDC issuer URL (standard value).Value:
This value is consistent across all Replit deployments.

AI Providers

Caption Generation

At least one AI provider is required for caption generation:
string
OpenRouter API key for AI caption generation (primary provider).Example:
Models used:
  • Manual Editor: google/gemini-2.5-pro (contextual captions)
  • Fallback: google/gemini-2.5-flash-lite
  • Smart Captions: gemini-2.5-flash-lite
Obtain from: https://openrouter.ai/
string
OpenAI API key (alternative to OpenRouter).Example:
Falls back to this provider if OpenRouter fails.

AI Undress (Image Editing)

string
xAI API key (primary provider for AI Undress feature).Example:
Model used: grok-imagine-image-pro (via /v1/images/edits)
string
Freepik API key (fallback provider for AI Undress).Example:
Model used: Seedream 4.5 Edit
enum
default:"xai"
Primary AI Undress provider selection.Options: xai | freepikExample:
Defaults to xai if not specified.
string
default:"grok-imagine-image-pro"
Optional xAI model override for AI Undress.Example:
string
Replicate API token (dormant/legacy backend for AI Undress).Example:
This credential is currently not used in active AI Undress flows.

Optional Features

Imgchest Import

string
Imgchest API key for importing existing JOIP galleries.Example:
Required for “Import JOIP from Imgchest” feature.

Payment Providers

PayGate (Credit Cards)

string
PayGate merchant wallet address for credit card payments.Example:
string
PayGate callback URL for payment notifications.Example (local dev with ngrok):
Production: Auto-detected from REPLIT_DOMAINS

Telegram Stars

string
Telegram bot token for Telegram Star payments.Example:
Obtain from: https://t.me/BotFather
string
Secret for verifying Telegram webhook signatures.Example:
Required in production when TELEGRAM_BOT_TOKEN is set.
string
default:"OfficialJoipBot"
Telegram bot username (without @).Example:
string
Telegram channel ID for membership features.Example:

Thirdweb (Crypto Checkout)

string
Thirdweb client ID for crypto checkout.Example:
string
Secret for verifying Thirdweb webhook signatures.Example:
string
EVM wallet address for receiving Thirdweb payments.Format: Must be valid EVM address (0x…)Example:
Must be a valid 40-character hexadecimal EVM address.

Payblis

string
Payblis merchant key.Example:
string
Payblis secret key for API authentication.Example:
boolean
default:"auto"
Enable Payblis sandbox mode.Values: true | falseExample:
Defaults to true in development, false in production.

Application Settings

enum
default:"development"
Node.js environment mode.Options: development | productionExample:
Behavior:
  • development: Enables detailed error messages, Vite HMR
  • production: Optimized builds, minimal logging
number
default:"5000"
Server listening port.Example:
Always use port 5000 on Replit. Changing this may break deployment.
number
Optional override for internal localhost callbacks/proxy calls.Example:
Defaults to PORT when omitted.
string
default:"./uploads"
Local directory for file uploads (legacy).Example:
All uploads now use Supabase Storage. This setting is mostly unused.
string
Explicit host URL override.Example:
Auto-detected from REPLIT_DOMAINS in production.

Database Connection Tuning

Optional settings for optimizing PostgreSQL connection pooling:
number
default:"20"
Maximum number of database connections in pool.Example:
number
default:"2"
Minimum number of database connections in pool.Example:
number
default:"10000"
Idle timeout in milliseconds before closing connection.Example:
number
default:"10"
Connection timeout in seconds.Example:
number
default:"3600"
Maximum connection lifetime in seconds.Example:
number
default:"30000"
Statement timeout in milliseconds.Example:
number
default:"20000"
Query timeout in milliseconds.Example:

Logging Configuration

enum
default:"info"
Application logging level.Options: error | warn | info | debugExample:
Levels:
  • error: Only critical errors
  • warn: Errors and warnings
  • info: Normal operation info (recommended for production)
  • debug: Detailed debugging information

Environment Validation

The application validates all environment variables on startup (server/environmentConfig.ts:89):
Startup Behavior:
  • Errors: Application may fail to start or have limited functionality
  • Warnings: Application starts but some features are disabled
Check console logs on startup for validation results.

Configuration Examples

Security Best Practices

Critical Security Rules:
  • Never commit .env files to Git
  • Use Replit Secrets for all sensitive values
  • Rotate secrets periodically (every 90 days)
  • Use different secrets for dev/staging/prod
  • Audit access to Replit Secrets regularly

Secret Generation

Generate cryptographically secure secrets:

Environment Files

Never track environment files in Git:

Troubleshooting

Missing Required Variables

Symptom: Application fails to start with validation errors Solution:
  1. Check startup logs for specific missing variables
  2. Add all required variables to Replit Secrets
  3. Restart the application

Invalid Variable Format

Symptom: “Invalid format” warnings on startup Solution:
  1. Verify variable format matches documentation
  2. Check for extra spaces or quotes
  3. Validate URLs include protocol (https://)

Features Not Working

Symptom: Specific features disabled or failing Solution:
  1. Check for related warnings in startup logs
  2. Verify optional variables are set correctly
  3. Test connectivity to external services

Next Steps

Deploy on Replit

Complete Replit deployment guide

Database Setup

Configure PostgreSQL and Neon

Storage Configuration

Setup Supabase Storage