Skip to main content

Configuration

Comprehensive guide to configuring the DashClicks Backend microservices for development, testing, and production environments.

Environment Variables

The DashClicks Backend uses environment variables for configuration. The main .env file is located in the root directory of the backend project.

Core System Configuration

General Settings:

VariableDescriptionExample Value
API_VERSIONAPI version identifierv1
API_BASE_URLBase URL for API routerhttp://localhost:5001
NODE_ENVEnvironment modedevelopment
DEBUG_MODEEnable debug loggingtrue
INTERNAL_BASE_URLInternal API service URLhttp://localhost:5002
EXTERNAL_BASE_URLExternal API service URLhttp://localhost:5003
INTERNAL_V2_BASE_URLInternal API v2 service URL (Hono)http://localhost:5102
HONO_APP_PORTHono application port5102
AI_SERVICE_BASE_URLAI service URL (Deno)http://localhost:5010

Database Configuration:

VariableDescriptionExample Value
MONGO_DB_URLMongoDB connection stringmongodb+srv://devs:pass@sandbox-free.tirqwqb.mongodb.net/dashclicks-sandbox
MONGO_TEST_DB_URLTest database connection stringmongodb+srv://devs:pass@sandbox-free.tirqwqb.mongodb.net/dashclicks-sandbox

Redis Configuration (Required for socket services):

VariableDescriptionExample Value
REDIS_HOSTPrimary Redis server hostname127.0.0.1
REDIS_PORTPrimary Redis server port6379
REDIS_STORE_HOSTStore Redis server hostname127.0.0.1
REDIS_STORE_PORTStore Redis server port6378

Authentication & Security

VariableDescriptionExample Value
JWT_SECRETJWT token signing secretsomesupersecret
APP_SECRETApplication secret keysomesupersecret
APP_MISC_SECRETMiscellaneous app secretsomesupersecret
LEADS_SECRETLeads processing secretsomesupersecret
CLIENT_IDOAuth client identifier602f112cba0f0f08b442291e
CLIENT_SECRETOAuth client secret2f727e8848729fda7f19d27ae2ab73e9896f2b4b...
CLIENT_REDIRECT_URIOAuth redirect URIhttps://api.dashclicks.com/auth/oauth/callback
TOKEN_EXPIRYJWT token expiry time60m
TOKEN_EXPIRY_SECONDSJWT token expiry in seconds3600

Service Configuration

Service URLs & Communication:

VariableDescriptionExample Value
SOCKET_APIGeneral Socket service URLhttp://localhost:4000
GENERAL_SOCKETGeneral Socket service URL (alias)http://localhost:4000
CONVERSATION_SOCKETConversation Socket service URLhttp://localhost:6001
CONVERSATION_EMIT_URLSocket emission endpointhttp://localhost:4000
NOTIFICATION_SERVICE_URLNotification service URLhttp://localhost:5008
QM_WEBHOOK_URLQueue Manager webhook URLhttp://localhost:6002

Business & Utility Services:

VariableDescriptionExample Value
SHORT_URL_SERVICEURL shortening servicehttp://localhost:5002/v1/url
SHORT_DOMAINShort URL domainhttps://urlme.app
SEND_EMAIL_URLEmail sending service endpointhttp://localhost:5001/v1/e/sendgrid/mail
SEND_SMS_URLSMS sending service endpointhttp://localhost:5001/v1/e/twilio/send
CRM_PEOPLE_URLCRM contacts endpointhttp://localhost:5001/v1/crm/contacts/people
DEALS_PIPELINES_URLCRM pipelines endpointhttp://localhost:5001/v1/crm/pipelines

File Storage & CDN:

VariableDescriptionExample Value
WASABI_IMAGE_DOWNLOADWasabi image download endpointhttp://localhost:5001/v1/e/wasabi/download_by_key
WASABI_PUBLIC_IMAGE_DOWNLOADPublic Wasabi image endpointhttp://localhost:5001/v1/e/wasabi/public/download_by_key
WASABI_PUBLIC_URLWasabi public CDN URLhttps://open.s3.wasabisys.com
WASABI_ENDPOINTWasabi S3 endpoints3.wasabisys.com
WASABI_REGIONWasabi storage regionus-east-1

Third-Party Integration Configuration

Stripe Payment Processing:

VariableDescriptionExample Value
STRIPE_SECRET_KEYStripe secret API keysk_test_YOUR_KEY
STRIPE_CLIENT_IDStripe Connect client IDca_YOUR_CLIENT_ID
STRIPE_REDIRECT_URLOAuth redirect URLhttps://ngrok-url.app/v1/e/stripe/auth/callback
SETUP_PRODUCTSetup product IDprod_M8h5Gq7SL2QkQ9

Twilio SMS/Voice:

VariableDescriptionExample Value
TWILIO_ACCOUNT_SIDTwilio account identifierACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWILIO_AUTH_TOKENTwilio authentication tokenYOUR_TWILIO_AUTH_TOKEN
TWILIO_MESSAGING_GROUP_SIDMessaging service group SIDMGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWILIO_API_KEYTwilio API keySKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWILIO_API_SECRETTwilio API secretYOUR_TWILIO_API_SECRET
TWIML_APP_SIDTwiML application SIDAPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWILIO_WEBHOOK_URLTwilio webhook endpointhttps://ngrok-url.app/v1/e/twilio/webhook
TWILIO_SMS_URLSMS webhook endpointhttps://ngrok-url.app/v1/e/twilio/webhook/inbound

Google Services:

VariableDescriptionExample Value
GOOGLE_CLIENT_IDGoogle OAuth client IDyour_google_client_id
GOOGLE_CLIENT_SECRETGoogle OAuth client secretyour_google_client_secret
GOOGLE_ADS_DEV_TOKENGoogle Ads developer tokenyour_google_ads_dev_token
GOOGLE_ADS_API_VERSIONGoogle Ads API versionv13
GOOGLE_ANALYTICS_CLIENT_IDAnalytics OAuth client IDyour_google_analytics_client_id
GOOGLE_ANALYTICS_CLIENT_SECRETAnalytics OAuth client secretyour_google_analytics_client_secret
GOOGLE_CLOUD_PROJECT_IDGoogle Cloud project IDyour_google_cloud_project_id
GOOGLE_PAGE_SPEED_API_KEYPageSpeed Insights API keyyour_google_page_speed_api_key

SendGrid Email Service:

VariableDescriptionExample Value
SENDGRID_API_KEYSendGrid API keySG.xxxxxx
SENDGRID_EVENT_WEBHOOK_URLSendGrid event webhookhttp://localhost:5001/v1/e/sendgrid/webhook
SENDGRID_INBOUND_WEBHOOK_URLSendGrid inbound webhookhttp://localhost:5001/v1/e/sendgrid/webhook/inbound
SENDGRID_TEMPLATE_VIOLATION_SUSPENSIONViolation suspension template IDd-30a82cd8576143cca3782165691339fe
SENDGRID_TEMPLATE_VIOLATION_WARNINGViolation warning template IDd-2eb1a53a371e40008fd58614737a41df
SENDGRID_TEMPLATE_DOMAIN_FAILEDDomain failed template IDd-a7c4a7d28e384d03bd894181134fd353
SENDGRID_GROUP_GENERALGeneral email group ID22798
SENDGRID_GROUP_SYSTEMSystem email group ID22799
SENDGRID_DEFAULT_DOMAIN_IDDefault domain ID11945395
SENDGRID_SUBUSER_IPSubuser IP address159.183.200.57

Facebook/Meta Integration:

VariableDescriptionExample Value
FACEBOOK_CLIENT_IDFacebook app client ID3246944435541246
FACEBOOK_CLIENT_SECRETFacebook app client secretYOUR_FACEBOOK_CLIENT_SECRET
FACEBOOK_API_VERSIONFacebook API versionv20.0
FACEBOOK_VERIFY_TOKENWebhook verification tokentokendata
FACEBOOK_INBOUND_REDIRECTOAuth redirect URLhttp://localhost:5001/v1/inbound/facebook/auth/callback
FACEBOOK_INBOUND_WEBHOOKInbound webhook URLhttp://localhost:5001/v1/inbound/webhookfb
FACEBOOK_ADS_REDIRECT_URLAds OAuth redirect URLhttps://ngrok-url.app/v1/e/facebook/auth/callback
FACEBOOK_ADS_WEBHOOK_URLAds webhook URLhttps://playground-api.dashclicks.com/v1/inbound/facebook/webhook

CRM Integration Configuration

HubSpot CRM:

VariableDescriptionExample Value
HUBSPOT_AUTHORIZE_URLOAuth authorization URLhttps://app.hubspot.com/oauth/authorize
HUBSPOT_REDIRECT_URLOAuth redirect URLhttp://localhost:5001/v1/e/hubspot/auth/callback
HUBSPOT_TOKEN_URLToken exchange URLhttps://api.hubapi.com/oauth/v1/token
HUBSPOT_SCOPESRequired OAuth scopescontacts
HUBSPOT_GRANT_TYPEOAuth grant typeauthorization_code

Salesforce CRM:

VariableDescriptionExample Value
SALESFORCE_AUTH_URLOAuth authorization URLhttps://login.salesforce.com/services/oauth2/authorize
SALESFORCE_TOKEN_URLToken exchange URLhttps://login.salesforce.com/services/oauth2/token
SALESFORCE_REDIRECT_URLOAuth redirect URLhttp://localhost:5001/v1/e/salesforce/auth/callback
SALESFORCE_AUTH_SCOPESRequired OAuth scopesfull
SALESFORCE_GRANT_TYPEOAuth grant typeauthorization_code

Zoho CRM:

VariableDescriptionExample Value
ZOHO_AUTHORIZE_URLOAuth authorization URLhttps://accounts.zoho.com/oauth/v2/auth
ZOHO_ACCESS_TOKEN_URLToken exchange URLhttps://accounts.zoho.com/oauth/v2/token
ZOHO_REDIRECT_URLOAuth redirect URLhttp://localhost:5001/v1/e/zoho/auth/callback
ZOHO_SCOPE_PERMISSIONSRequired API permissionsZohoCRM.modules.ALL
ZOHO_JWT_SECRETJWT signing secretzoho

Pipedrive CRM:

VariableDescriptionExample Value
PIPE_DRIVE_REDIRECT_URLOAuth redirect URLhttp://localhost:5001/v1/e/pipedrive/auth/callback

Keap (Infusionsoft) CRM:

VariableDescriptionExample Value
KEAP_BASE_URLKeap API base URLhttps://api.infusionsoft.com/crm/rest/v1
KEAP_REDIRECT_URLOAuth redirect URLhttp://localhost:5001/v1/e/keap/auth/callback
KEAP_JWT_SECRETJWT signing secretkeap

Email Marketing Integration Configuration

MailChimp:

VariableDescriptionExample Value
MAILCHIMP_AUTHORIZATION_URLOAuth authorization URLhttps://login.mailchimp.com/oauth2/authorize
MAILCHIMP_TOKEN_URLToken exchange URLhttps://login.mailchimp.com/oauth2/token
MAILCHIMP_REDIRECT_URIOAuth redirect URLhttp://localhost:5001/v1/e/mailchimp/auth/callback
MAILCHIMP_DATACENTER_URLDatacenter metadata URLhttps://login.mailchimp.com/oauth2/metadata
MAILCHIMP_JWT_SECRETJWT signing secretmailchimp

Constant Contact:

VariableDescriptionExample Value
CONSTANTCONTACT_AUTH_ENDPOINTOAuth authorization URLhttps://api.cc.email/v3/idfed
CONSTANTCONTACT_ACCESS_TOKEN_ENDPOINTToken exchange URLhttps://idfed.constantcontact.com/as/token.oauth2
CONSTANTCONTACT_REDIRECT_URLOAuth redirect URLhttp://localhost:5001/v1/e/constantcontact/auth/callback
CONSTANTCONTACT_AUTH_SCOPERequired OAuth scopecontact_data

ActiveCampaign:

VariableDescriptionExample Value
ACTIVECAMPAIGN_API_VERSIONAPI version path/api/3

Queue Manager Configuration

Business Process Queues (Actual settings from .env):

VariableDescriptionCurrent Value
QM_SUBSCRIPTION_CANCELEnable subscription cancellation queuetrue
QM_SUBSCRIPTION_ACTIVATEEnable subscription activation queuetrue
QM_CONTACTSEnable contacts processing queuetrue
QM_DEALSEnable deals processing queuetrue
QM_DEALS_AUTOMATIONSEnable deals automation queuetrue
QM_REPUTATIONEnable reputation management queuetrue
QM_INSTASITES_BUILDEnable InstaSites build queuetrue
QM_INSTASITES_PURGEEnable InstaSites purge queuetrue
QM_INSTAREPORT_BUILDEnable InstaReport build queuetrue
QM_HOOKSEnable webhooks processing queuetrue

Support & Communication Queues:

VariableDescriptionCurrent Value
QM_SUPPORT_SNOOZEEnable support ticket snooze queuetrue
QM_SUPPORT_MESSAGE_STATUSEnable support message status queuetrue
QM_SUPPORT_NOTIFICATIONEnable support notification queuetrue
QM_SUPPORT_COMMUNICATION_CHECKEnable communication check queuetrue

Billing & Account Management:

VariableDescriptionCurrent Value
QM_BILLING_NEW_AUTHEnable billing authentication queuetrue
QM_BILLING_CONTACTSEnable billing contacts queuetrue

Queue Configuration Settings:

VariableDescriptionCurrent Value
SUBSCRIPTION_CANCEL_QUEUES_ATTEMPTSMax attempts for subscription cancel10
DAYS_UNTIL_INSTASITE_PURGEDays before InstaSite purge90

Business Configuration

Currency & Pricing:

VariableDescriptionCurrent Value
BASE_CURRENCYDefault currencyUSD
ADDITIONAL_APP_FEE_CENTSAdditional app fee in cents5
ADDITIONAL_APP_FEE_PERCENTAGEAdditional app fee percentage0.0045
ADDITIONAL_APP_FEE_SUBSCRIPTION_PERCENTAGESubscription fee percentage0.005

Site Management:

VariableDescriptionCurrent Value
DUDA_INTERNAL_ENDPOINTDuda API internal endpointhttp://localhost:5001/v1/e/duda
DUDA_SITES_DOMAINDuda sites API domainhttps://api.duda.co/api/sites/multiscreen
DUDA_USERDuda API username23d70bc914
DUDA_PASSWORDDuda API passwordHh8iL7Zz9sQ7
DUDA_TOKENDuda API token61198bd65332564be0eac436

Reviews & Templates:

VariableDescriptionCurrent Value
REQUEST_REVIEW_TEMPLATE_IDSendGrid review request template IDd-ff9f9394c39e41b8b8440b340220731f

External Service APIs

SEMrush SEO Analytics:

VariableDescriptionExample Value
SEMRUSH_API_URLSEMrush API base URLhttps://api.semrush.com/
SEMRUSH_DATABASEDefault database regionUS

Yext Local Listings:

VariableDescriptionExample Value
YEXT_API_KEYSYext API key15bd68d8636553d827ce4b66db6063d1
YEXT_API_KEY_SCANYext scan API key8368b6559b71e36953e0ce03f82d1f34
YEXT_API_VPARAMYext API version parameter20200525
YEXT_SCAN_EXPIRY_DAYSScan result expiry days2

Firebase Cloud Messaging:

VariableDescriptionExample Value
FCM_SERVER_KEYFCM server keyAAAAUztqSMs:APA91bGdgHGt_PUFG...

System Configuration

Debug & Monitoring:

VariableDescriptionExample Value
LEGACY_DEFAULTS_DEBUGEnable legacy debug mode1
PROXY_URLProxy server URLhttps://proxy.mydashmetrics.com
WHITE_LABEL_DOMAINWhite label domainhttps://whitelabeldomain.com
UPSTREAM_SERVERUpstream proxy server10.0.3.185:80

Conversation System:

VariableDescriptionExample Value
CONVERSATION_REPLY_TO_EMAILDefault reply-to emailinbox@conversations-dev.dashboardnotifications.com

pnpm Monorepo Configuration

The DashClicks Backend uses pnpm for package management with workspace configuration defined in pnpm-workspace.yaml:

Development Scripts

Initial Setup (Required first run):

# Install all dependencies and copy shared files
pnpm run build

Shared Files Management:

# Copy shared files after editing /shared folder
pnpm run copySharedFiles

# Update shared models and utilities across all services
pnpm run copySharedFiles

Testing:

# Run all tests across services
pnpm test

# Generate coverage reports
pnpm run coverage

Documentation:

# Build and serve documentation
pnpm run docs

# Start documentation frontend
pnpm run docs-frontend

AI Service Configuration (Deno)

The AI service runs on Deno (not Node.js) and uses ai-service/.env:

ai-service/.env
# Service Configuration
PORT=5010
NODE_ENV=development

# AI Configuration (keys not set in provided .env)
OPENAI_API_KEY=
OPENAI_DEFAULT_MODEL=gpt-4o-mini

Shared Files Configuration

Critical: Understanding Git Ignore Patterns

The monorepo uses specific .gitignore patterns that prevent committing changes to service-level shared folders:

.gitignore
# Shared files are Git-ignored in ALL services
*/models/
*/utilities/

# This means these folders won't be committed:
internal/api/v1/models/
internal/api/v1/utilities/
external/Integrations/models/
external/Integrations/utilities/
conversation-socket/models/
conversation-socket/utilities/
dashboard-gateway/models/
dashboard-gateway/utilities/
general-socket/models/
general-socket/utilities/
queue-manager/models/
queue-manager/utilities/

Shared Models Configuration

The shared/models/_globalSchemaOptions.js file configures all Mongoose schemas:

shared/models/_globalSchemaOptions.js
module.exports = {
// Global schema options applied to all models
timestamps: true,
versionKey: false,

// Transform JSON output
toJSON: {
transform: function (doc, ret) {
ret.id = ret._id;
delete ret._id;
delete ret.__v;
return ret;
},
},

// Transform Object output
toObject: {
transform: function (doc, ret) {
ret.id = ret._id;
delete ret._id;
delete ret.__v;
return ret;
},
},
};

Development Scripts Configuration

Add these scripts to your workflow:

# Initial setup - installs dependencies and copies shared files
pnpm install

# Copy shared files after editing
pnpm run copySharedFiles

# Run tests across all services
pnpm test

# Generate coverage reports
pnpm run coverage

# Build documentation
pnpm run docs

Integration API Keys Setup

Stripe Payment Processing

  1. Create Stripe Account: Visit stripe.com and create an account
  2. Get API Keys: Dashboard → Developers → API keys (Vinod Nimbalkar's test account is being used for Stripe local development)
  3. Test vs Live Keys: Use sk_test_ for development, sk_live_ for production
  4. Webhook Setup (Production + Local Testing):

Production (Dashboard)

  • Create webhook endpoint: https://yourdomain.com/v1/store/webhook
  • Select minimal events first:
    • payment_intent.succeeded
    • payment_intent.payment_failed
    • invoice.paid
    • invoice.payment_failed
    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted
  • Copy the signing secret (e.g. whsec_...) → set as STRIPE_WEBHOOK_SECRET in .env

Local Development

  1. Install Stripe CLI: https://stripe.com/docs/stripe-cli

  2. Authenticate:

    stripe login
  3. Start a listener forwarding to your local service (adjust port/path if routed through API Router):

    # If the webhook is handled by the API Router
    stripe listen --forward-to localhost:5000/v1/store/webhook

    Or, if handled directly by Internal API on 5002:

    stripe listen --forward-to localhost:5002/store/webhook
  4. Copy the printed signing secret (looks like whsec_...) → set in .env.local:

    STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxx
  5. (Optional) Expose publicly via ngrok (if Stripe Dashboard needs to hit your machine directly):

    ngrok http 5000
    # Then add https://your-ngrok-id.ngrok.io/v1/store/webhook in Stripe dashboard
  6. Trigger test events:

    # Core payment intents
    stripe trigger payment_intent.succeeded
    stripe trigger payment_intent.payment_failed

Twilio SMS/Voice

  1. Create Twilio Account: Visit twilio.com
  2. Get Credentials: Console Dashboard → Account SID and Auth Token
  3. Buy Phone Number: Phone Numbers → Manage → Buy a number
  4. Configure Webhooks:
    • SMS: https://yourdomain.com/v1/e/twilio/webhook/inbound
    • Voice: https://yourdomain.com/v1/e/twilio/webhook
  1. Create Google Cloud Project: console.cloud.google.com
  2. Enable APIs: Google Ads API, Analytics Reporting API
  3. Create OAuth 2.0 Credentials: APIs & Services → Credentials
  4. Get Developer Token: Google Ads → Tools & Settings → API Center

OpenAI for AI Service

  1. Create OpenAI Account: platform.openai.com
  2. Generate API Key: API Keys → Create new secret key
  3. Set Usage Limits: Billing → Usage limits (prevent overcharges)
  4. Monitor Usage: Usage → Dashboard

VS Code Debug Configuration

The monorepo includes comprehensive VS Code launch configurations in .vscode/launch.json:

Individual Service Debugging

.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Internal API (5002)",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/internal/app.js",
"env": {
"NODE_ENV": "development",
"PORT": "5002"
},
"console": "integratedTerminal",
"restart": true,
"runtimeArgs": ["--inspect"]
},
{
"name": "External API (5003)",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/external/index.js",
"env": {
"NODE_ENV": "development",
"PORT": "5003"
},
"console": "integratedTerminal",
"restart": true
}
]
}

Service Health Check

Each service provides a simple /status endpoint for health monitoring:

# Check service status
curl http://localhost:5002/status # Internal API
curl http://localhost:5003/status # External API

# Expected response format
{
"status": "ok"
}

Running Services for Development

🚨 CRITICAL: Always use VSCode debugger configurations to start services. Never run services directly with node commands.

  1. Open VS Code in the backend workspace
  2. Go to Run and Debug panel (Ctrl+Shift+D)
  3. Use "Start All Services" compound configuration to launch all 7 services
  4. Individual services can be debugged separately using their named configurations

This ensures proper environment loading, debugging capabilities, and service interdependency management.

Development Best Practices

Environment Management

  • Keep .env file in root directory only
  • Use different .env files for different environments if needed
  • Never commit .env files to version control
  • Use .env.sample as a template for other developers

Service Dependencies

  • MongoDB: Required for all services (data storage)
  • Redis: Required for socket services (real-time features)
  • External APIs: Optional for basic functionality, required for integrations

Queue Manager Best Practices

  • Set queue flags to false in development to prevent background processing
  • Enable only necessary queues for your development work
  • Use QM_SCHEDULE_UTILIZATION_MONITORING=true for monitoring in development

This configuration documentation reflects the actual DashClicks Backend implementation. For additional setup guidance, see the Quick Start Guide or Architecture Overview.

💬

Documentation Assistant

Ask me anything about the docs

Hi! I'm your documentation assistant. Ask me anything about the docs!

I can help you with:
- Code examples
- Configuration details
- Troubleshooting
- Best practices

Try asking: How do I configure the API?
09:30 AM