link-stack/apps/bridge-frontend
2025-12-17 15:35:28 +01:00
..
app WhatsApp/Signal/Formstack/admin updates 2025-11-21 14:55:28 +01:00
public WhatsApp/Signal/Formstack/admin updates 2025-11-21 14:55:28 +01:00
.eslintrc.json Metamigo -> Bridge 2024-04-21 09:44:30 +02:00
.gitignore Metamigo -> Bridge 2024-04-21 09:44:30 +02:00
docker-entrypoint.sh WhatsApp/Signal/Formstack/admin updates 2025-11-21 14:55:28 +01:00
Dockerfile WhatsApp/Signal/Formstack/admin updates 2025-11-21 14:55:28 +01:00
middleware.ts WhatsApp/Signal/Formstack/admin updates 2025-11-21 14:55:28 +01:00
next.config.js Only allow single NextAuth provider, Login middleware updates 2024-09-27 14:52:44 +02:00
package.json Update deps 2025-12-17 15:35:28 +01:00
README.md WhatsApp/Signal/Formstack/admin updates 2025-11-21 14:55:28 +01:00
tsconfig.json WhatsApp/Signal/Formstack/admin updates 2025-11-21 14:55:28 +01:00

Bridge Frontend

Frontend application for managing communication bridges between various messaging platforms and the CDR Link system.

Overview

Bridge Frontend provides a web interface for configuring and managing communication channels including Signal, WhatsApp, Facebook, and Voice integrations. It handles bot registration, webhook configuration, and channel settings.

Features

  • Channel Management: Configure Signal, WhatsApp, Facebook, and Voice channels
  • Bot Registration: Register and manage bots for each communication platform
  • Webhook Configuration: Set up webhooks for message routing
  • Settings Management: Configure channel-specific settings and behaviors
  • User Authentication: Secure access with NextAuth.js

Development

Prerequisites

  • Node.js >= 20
  • npm >= 10
  • PostgreSQL database
  • Running bridge-worker service

Setup

# Install dependencies
npm install

# Run database migrations
npm run migrate:latest

# Run development server
npm run dev

# Build for production
npm run build

# Start production server
npm run start

Environment Variables

Required environment variables:

  • DATABASE_URL - PostgreSQL connection string
  • DATABASE_HOST - Database host
  • DATABASE_NAME - Database name
  • DATABASE_USER - Database username
  • DATABASE_PASSWORD - Database password
  • NEXTAUTH_URL - Application URL
  • NEXTAUTH_SECRET - NextAuth.js secret
  • GOOGLE_CLIENT_ID - Google OAuth client ID
  • GOOGLE_CLIENT_SECRET - Google OAuth client secret

Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint
  • npm run migrate:latest - Run all pending migrations
  • npm run migrate:down - Rollback last migration
  • npm run migrate:up - Run next migration
  • npm run migrate:make - Create new migration

Architecture

Database Schema

The application manages the following main entities:

  • Bots: Communication channel bot configurations
  • Webhooks: Webhook endpoints for external integrations
  • Settings: Channel-specific configuration settings
  • Users: User accounts with role-based permissions

API Routes

  • /api/auth - Authentication endpoints
  • /api/[service]/bots - Bot management for each service
  • /api/[service]/webhooks - Webhook configuration

Page Structure

  • / - Dashboard/home page
  • /login - Authentication page
  • /[...segment] - Dynamic routing for CRUD operations
    • @create - Create new entities
    • @detail - View entity details
    • @edit - Edit existing entities

Integration

Database Access

Uses Kysely ORM for type-safe database queries:

import { db } from '@link-stack/database'

const bots = await db
  .selectFrom('bots')
  .selectAll()
  .execute()

Authentication

Integrated with NextAuth.js using database adapter:

import { authOptions } from '@link-stack/auth'

Docker Support

# Build image
docker build -t link-stack/bridge-frontend .

# Run with docker-compose
docker-compose -f docker/compose/bridge.yml up
  • bridge-worker: Processes messages from configured channels
  • bridge-whatsapp: WhatsApp-specific integration service
  • bridge-migrations: Database schema management