Skip to content

actuallyentropy/flock

Repository files navigation

Flock Chat - ATProto Powered Instant Messaging

A dockerized chat application powered by the AT Protocol with nginx for TLS termination.

Features

  • Environment-based configuration: All hardcoded URLs are now configurable via environment variables
  • Docker support: Complete containerization with nginx reverse proxy
  • TLS termination: nginx handles SSL/TLS, Node.js serves HTTP
  • Local development ready: Works with localhost and custom domains
  • OAuth optional: Can run without OAuth for local testing
  • AT Protocol integration: Real-time messaging via Bluesky's AT Protocol

Quick Start

  1. Generate SSL certificates for local development:

    ./generate-certs.sh
  2. Start the application:

    docker compose up
  3. Access the application:

Configuration

Environment Variables

Variable Default Description
DOMAIN localhost:8080 The domain name and port for the application
PROTOCOL https Protocol (http/https)
WS_PROTOCOL wss WebSocket protocol (ws/wss)
PORT 3000 Internal Node.js server port
ENABLE_OAUTH false Enable/disable OAuth authentication

Production Deployment

For production deployment, update the environment variables in docker-compose.yml:

environment:
  - DOMAIN=yourdomain.com
  - PROTOCOL=https
  - WS_PROTOCOL=wss
  - PORT=3000
  - NODE_ENV=production
  - ENABLE_OAUTH=true

And replace the self-signed certificates in the ssl/ directory with proper certificates.

Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│     Client      │───▶│      nginx      │───▶│   Node.js App   │
│   (Browser)     │    │  (TLS Proxy)    │    │   (Port 3000)   │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                              │
                              ▼
                       ┌─────────────────┐
                       │   SSL Certs     │
                       │   (ssl/ dir)    │
                       └─────────────────┘

Development

Local Testing Without OAuth

The application is configured to run without OAuth in local development mode by default. This allows you to test the UI and basic functionality without setting up Bluesky OAuth credentials.

Enabling OAuth

To enable OAuth for production or testing:

  1. Set ENABLE_OAUTH=true
  2. Use a non-localhost domain
  3. Configure proper SSL certificates
  4. Ensure the domain is accessible from the internet for OAuth callbacks

Files

  • Dockerfile - Node.js application container
  • docker-compose.yml - Multi-container setup with nginx
  • nginx.conf.template - nginx configuration template
  • generate-certs.sh - SSL certificate generation script
  • .dockerignore - Docker build exclusions

Health Check

The application provides a health endpoint at /health that returns the current status and configuration.

Troubleshooting

SSL Certificate Issues

If you see SSL certificate errors, regenerate the certificates:

rm -rf ssl/
./generate-certs.sh

Port Conflicts

If ports 8080 or 8081 are in use, modify the ports in docker-compose.yml:

ports:
  - "9080:443"  # Change 8080 to 9080
  - "9081:80"   # Change 8081 to 9081

Module Not Found Errors

If you see Node.js module errors, rebuild the containers:

docker compose down
docker compose build --no-cache
docker compose up

About

ATProto powered instant messaging.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors