# External Integrations

**Analysis Date:** 2026-01-11

## APIs & External Services

**Payment Processing - Stripe:**
- Service: Stripe - Subscription billing and payments
- Files: `web/app/controllers/api_stripe_controller.rb`, `web/config/application.rb` (lines 456-463)
- SDK/Client: stripe gem
- Auth: API keys in `config.stripe[:publishable_key]` and `config.stripe[:secret_key]`
- Endpoints used: Checkout sessions, customer portal, webhooks, Stripe Connect
- OmniAuth: stripe_connect configured for OAuth seller onboarding

**Payment Processing - PayPal:**
- Service: PayPal - Payment processing
- Files: `web/app/controllers/api_pay_pal_controller.rb`, `web/config/initializers/paypal.rb`
- SDK/Client: paypal-sdk-merchant-jk 1.118.1
- Auth: Username/password/signature configured in `web/config/application.rb`
- Mode: `sandbox` (upgradeable to production)
- Features: Express Checkout API

**Subscription Management - Recurly:**
- Service: Recurly - Subscription billing
- Files: `web/config/application.rb` (lines 176-179), `web/config/initializers/recurly.rb`
- SDK/Client: recurly gem 2.19.14 (noted: should upgrade to 3.x)
- Auth: Private and public API keys configured
- Frontend: Recurly.js via `REACT_APP_RECURLY_PUBLIC_API_KEY` environment variable
- Features: Subscription management, tax estimation, webhooks
- SSL: TLSv1_2 enforced

**Alternative Payment - Braintree:**
- Service: Braintree - Payment processing
- Auth: Token configured via `config.braintree_token` (sandbox and production tokens available)
- Frontend: `REACT_APP_BRAINTREE_TOKEN` environment variable
- Features: Payment method management

**Email Delivery - AWS SES:**
- Service: AWS SES - Primary email delivery
- Files: `web/config/application.rb` (lines 271-277)
- Connection: SMTP server `email-smtp.us-east-1.amazonaws.com:587`
- Auth: IAM user `AKIA2SXEHOQFKRW3OWMG` with credentials
- Integration: ActionMailer SMTP configured

**Email Delivery - SendGrid (Backup):**
- Service: SendGrid - Email delivery
- SDK/Client: sendgrid gem 1.2.0, sendgrid_toolkit
- Auth: Username `jamkazam`, password configured in `web/config/application.rb`
- Status: Currently using AWS SES as primary

## Data Storage

**Databases:**
- PostgreSQL - Primary data store
- Connection: via `DATABASE_URL` or `web/config/database.yml`
- Client: ActiveRecord ORM 4.2.8
- Migrations: 403+ migration files in `db/up/`
- Shared: Single database across all services (web, admin, websocket-gateway)

**File Storage - AWS S3:**
- Service: AWS S3 - File and media storage
- SDK/Client: aws-sdk ~1
- Auth: `AWS_KEY` and `AWS_SECRET` environment variables
- Region: `us-east-1`
- Buckets:
  - `jamkazam-dev` (private)
  - `jamkazam-dev-public` (public)
  - `jamkazam-analytics-dev` (analytics)
  - `jamkazam-jamtracks` (music tracks)
- CDN: CloudFront distribution `d34f55ppvvtgi3.cloudfront.net`
- Integration: CarrierWave gem for file uploads

**File Storage - Filestack:**
- Service: Filestack (FilePicker) - File upload service
- SDK/Client: filepicker-rails gem 0.1.0
- Auth: API key `AoskPXootR5OS6iIGegL2z`, secret configured
- S3 bucket: `jamkazam-dev`
- Upload directory: `avatars`

**Caching:**
- Redis - Session storage and job queue
- Host: `localhost:6379`
- Client: redis gem 3.3.0/3.3.3
- Used for: Resque job queue, session caching

**Message Queue:**
- RabbitMQ/AMQP - Async messaging between services
- Client: amqp gem 1.0.2/0.9.8
- Host: `127.0.0.1:5672`
- Used for: Async message publishing between web, admin, websocket-gateway

## Authentication & Identity

**Auth Provider - Devise:**
- Service: Devise - User authentication
- SDK/Client: devise gem 3.3.0
- Implementation: Session-based cookies with `remember_token`
- Token storage: httpOnly cookies shared between `www.jamkazam.local` and `beta.jamkazam.local`
- Session management: Rails session store

**OAuth Integrations - Facebook:**
- Provider: Facebook OAuth
- Files: `web/config/application.rb` (lines 282-283), `web/config/initializers/omniauth.rb`
- Credentials: App ID `468555793186398`, secret configured
- SDK/Client: omniauth-facebook gem
- Scopes: email, location

**OAuth Integrations - Google:**
- Provider: Google OAuth 2.0
- Files: `web/config/application.rb` (lines 170-174), `web/config/initializers/omniauth.rb`
- Credentials: Client ID `785931784279-gd0g8on6sc0tuesj7cu763pitaiv2la8.apps.googleusercontent.com`
- SDK/Client: google-api-client, omniauth-google-oauth2 gems
- Scopes: youtube, youtube.force-ssl, youtube.upload, email, profile
- API Key: `AIzaSyCPTPq5PEcl4XWcm7NZ2IGClZlbsiE8JNo` (public server key)

**OAuth Integrations - Twitter:**
- Provider: Twitter OAuth
- Files: `web/config/application.rb` (lines 285-287), `web/config/initializers/omniauth.rb`
- Credentials: App ID `nQj2oEeoJZxECC33tiTuIg`, secret configured
- SDK/Client: omniauth-twitter, twitter gems
- Scopes: Write access
- Public account: `jamkazam`

## Monitoring & Observability

**Error Tracking - Bugsnag:**
- Service: Bugsnag - Error tracking and reporting
- SDK/Client: bugsnag gem 5.3.2
- Auth: API key `fa0e229f687bcb2c8711fcb80223744e`
- Files: `web/config/initializers/bugsnag.rb`
- Features: EventMachine error hook integration

**Analytics - Google Analytics:**
- Service: Google Analytics 4
- Frontend IDs:
  - Development: `G-MC9BTWXWY4` (`.env.development.example`)
  - Production: `G-SPTNJRW7WB` (`.env.production`)
- Backend: Universal Analytics `UA-44184562-2`
- SDK/Client: react-ga4 2.1.0

**Time Series Metrics - InfluxDB:**
- Service: InfluxDB - Metrics storage
- SDK/Client: influxdb gem 0.3.14, influxdb-rails 0.1.12
- Database: `development` (configurable)
- Auth: Username/password `root`/`root`
- Host: `localhost:8086`
- Status: Currently disabled for production (`ignored_environments` configured)
- File: `web/config/initializers/influxdb-rails.rb`

**Application Performance - New Relic:**
- Service: New Relic - APM
- SDK/Client: newrelic_rpm gem
- Deployment: Production environment only

## Search & Indexing

**Search - Elasticsearch:**
- Service: Elasticsearch - Full-text search
- SDK/Client: elasticsearch gem
- Host: `http://support.jamkazam.com:9200`
- Used for: Music session search, content search across platform

## CI/CD & Deployment

**Hosting:**
- Not explicitly defined (appears to be self-hosted or cloud infrastructure)
- Environment vars: Configured via `.env` files and `config/application.rb`

**CI Pipeline:**
- Jenkins build scripts: `*/jenkins` files in each service directory
- Build script: Root `./build` script

## Environment Configuration

**Development:**
- Required env vars: `DATABASE_URL`, `AWS_KEY`, `AWS_SECRET`, API keys for services
- Secrets location: `.env.local` files (gitignored), `config/application.rb` (hardcoded for dev)
- Mock/stub services: Sandbox modes for Stripe, PayPal, Recurly, Braintree

**Production:**
- Secrets management: Environment variables, configuration files
- Database: Production PostgreSQL with connection pooling
- Services: Production API keys for all external services

## Webhooks & Callbacks

**Incoming - Stripe:**
- Endpoint: `/api/webhooks/stripe` (inferred from controller naming)
- Verification: Signature validation via Stripe SDK
- Events: payment_intent.succeeded, customer.subscription.updated, etc.
- File: `web/app/controllers/api_stripe_controller.rb`

**Incoming - PayPal:**
- Endpoint: Configured in PayPal Express Checkout
- Verification: PayPal SDK handles IPN verification
- File: `web/app/controllers/api_pay_pal_controller.rb`

**Incoming - Recurly:**
- Endpoint: Webhook handlers for subscription events
- Verification: Recurly signature validation
- Events: Subscription updates, billing events

## Security & Fraud Prevention

**Browser Fingerprinting - Fingerprint.js:**
- Service: Fingerprint.js - Device identification
- SDK/Client: @fingerprintjs/fingerprintjs 4.6.0
- Used for: Fraud detection, device tracking
- Expiration: 14 days configured

**Email Validation - Kickbox:**
- Service: Kickbox - Email verification
- SDK/Client: kickbox gem
- Auth: API key `e262991e292dd5ef382c4a69f2b359f718cf267712b8684c9c28d6402ec18965`
- Features: Email verification, bounce checking
- Status: `check_bounced_emails = false` (can be enabled)

**reCAPTCHA - Google:**
- Service: Google reCAPTCHA - Bot protection
- Frontend: `REACT_APP_SITE_KEY=6Let8dgSAAAAAFheKGWrs6iaq_hIlPOZ2f3Bb56B`
- Backend: Public key `6Let8dgSAAAAAFheKGWrs6iaq_hIlPOZ2f3Bb56B`, private key configured
- Used for: User registration, checkout protection

## Support & Community

**Support - Desk.com:**
- Service: Desk.com - Customer support
- Files: `web/config/application.rb` (lines 184-192)
- URL: `https://jamkazam.desk.com`
- Integration: Multipass SSO for support portal
- Multipass key: Configured for single sign-on

**Forums - Vanilla Forums:**
- Service: Vanilla Forums - Community forums
- Files: `web/config/application.rb` (lines 311-315)
- URL: `http://forums.jamkazam.com`
- Integration: JSConnect for forum authentication
- Client ID: `www`, secret configured
- Staff badge: `(JamKazam Staff)` postfix

## Video & Conferencing

**WebRTC:**
- Host: `https://webrtc-demo.jamkazam.com`
- Features: WebRTC-based peer-to-peer video calls
- Config: `config.video_conferencing_host`, open room functionality

## Utilities

**Survey Integration:**
- Service: SurveyMonkey
- Signup survey: `https://www.surveymonkey.com/r/WVBKLYL`

**Live Chat - Olark:**
- Service: Olark - Live chat widget
- Status: Disabled (`config.olark_enabled = false`)

---

*Integration audit: 2026-01-11*
*Update when adding/removing external services*
