Add basic READMEs

This commit is contained in:
Darren Clarke 2025-05-23 13:20:07 +02:00
parent 58e713c98b
commit 3659a4ef38
6 changed files with 864 additions and 50 deletions

View file

@ -1,36 +1,133 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# Bridge Frontend
## Getting Started
Frontend application for managing communication bridges between various messaging platforms and the CDR Link system.
First, run the development server:
## 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
```bash
# Install dependencies
npm install
# Run database migrations
npm run migrate:latest
# Run development server
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
# Build for production
npm run build
# Start production server
npm run start
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
### Environment Variables
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
Required environment variables:
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
- `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
## Learn More
### Available Scripts
To learn more about Next.js, take a look at the following resources:
- `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
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
## Architecture
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
### Database Schema
## Deploy on Vercel
The application manages the following main entities:
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
- **Bots**: Communication channel bot configurations
- **Webhooks**: Webhook endpoints for external integrations
- **Settings**: Channel-specific configuration settings
- **Users**: User accounts with role-based permissions
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
### 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:
```typescript
import { db } from '@link-stack/database'
const bots = await db
.selectFrom('bots')
.selectAll()
.execute()
```
### Authentication
Integrated with NextAuth.js using database adapter:
```typescript
import { authOptions } from '@link-stack/auth'
```
## Docker Support
```bash
# Build image
docker build -t link-stack/bridge-frontend .
# Run with docker-compose
docker-compose -f docker/compose/bridge.yml up
```
## Related Services
- **bridge-worker**: Processes messages from configured channels
- **bridge-whatsapp**: WhatsApp-specific integration service
- **bridge-migrations**: Database schema management