Deploy theblackonion

Deploy and Host theblackonion chat with Railway

Deploy theblackonion

Postgres

railwayapp-templates/postgres-ssl:17

Just deployed

/var/lib/postgresql/data

chat-blackonion

hasanshahriar32/chat-blackonion:latest

Just deployed

/data

Deploy and Host

A secure, real-time chat application with advanced features and elite cybersecurity standards.

Docker Build

About Hosting

Deploy your own instance to Railway with a single click:

Deploy on Railway

Why Deploy

  • āœ… Application (Docker image from GHCR)
  • āœ… PostgreSQL database (auto-configured)
  • āœ… Persistent storage at /data
  • āœ… Auto-generated secure credentials (check logs after deployment)

Common Use Cases

  • šŸ” Secure Authentication - JWT-based auth with bcrypt password hashing
  • šŸ’¬ Real-time Messaging - WebSocket-powered instant messaging with Socket.io
  • šŸ“ Secure File Sharing - Protected file uploads with channel-based access control
  • šŸ‘„ Channel Management - Create and manage chat channels
  • šŸ”” Notifications - Real-time notifications for messages and events
  • šŸ“Š Admin Dashboard - System monitoring and user management
  • šŸŽØ Modern UI - Built with React, Tailwind CSS, and Radix UI
  • šŸ”’ PIN Protection - Optional PIN lock for added security
  • šŸ“± PWA Support - Install as a Progressive Web App
  • šŸ›”ļø File Security - Authenticated and authorized file access only
  • šŸš‚ Railway Ready - Optimized for Railway deployment with mounted storage

Dependencies for

Deployment Dependencies

šŸ“– Complete Setup Guide: See docs/setup.md for detailed instructions.

āš ļø IMPORTANT: After forking, you must enable GitHub Actions workflow permissions:

  1. Go to Settings → Actions → General
  2. Under Workflow permissions, select "Read and write permissions"
  3. Click Save

This is required for automatic Docker image builds to work.

Quick Setup

# Clone your fork
git clone https://github.com//chat-blackonion.git
cd chat-blackonion

# Install dependencies
npm install

# Copy environment file
cp .env.example .env

# Edit .env with your database credentials and secrets
# See docs/setup.md for details

# Run database migrations
npm run db:migrate

# Seed database with initial admin user (optional)
npm run db:seed

# Start development server
npm run dev

Visit http://localhost:5000 to see the application.

šŸ” Default Credentials (Development Only):

  • Username: admin
  • Password: admin123
  • App Passcode: admin1234

āš ļø IMPORTANT: For production, set ADMIN_PASSWORD and ADMIN_PASSCODE environment variables before deployment!

šŸ› ļø Tech Stack

Frontend

  • React - UI library
  • TypeScript - Type-safe JavaScript
  • Vite - Fast build tool
  • Tailwind CSS - Utility-first CSS
  • Radix UI - Accessible component primitives
  • Socket.io Client - Real-time communication
  • React Query - Data fetching and caching
  • Wouter - Lightweight routing

Backend

  • Node.js - Runtime environment
  • Express - Web framework
  • Socket.io - WebSocket server
  • PostgreSQL - Database
  • Drizzle ORM - Type-safe database toolkit
  • Railway Storage - Persistent file storage (mounted volume)
  • JWT - Authentication tokens
  • Bcrypt - Password hashing

šŸ“¦ Available Scripts

# Development
npm run dev          # Start development server with hot reload

# Production
npm run build        # Build for production
npm run start        # Start production server

# Database
npm run db:generate  # Generate migration files from schema
npm run db:migrate   # Run pending migrations
npm run db:push      # Push schema changes directly
npm run db:studio    # Open Drizzle Studio (database GUI)
npm run db:seed      # Seed database with initial data

# Utilities
npm run check        # Run TypeScript type checking
npm run setup:passcode  # Set up admin passcode

🐳 Docker Deployment

Using Pre-built Image

docker pull ghcr.io//chat-blackonion:latest

docker run -d \
  -p 5000:5000 \
  -v $(pwd)/public:/public \
  -e DATABASE_URL="postgresql://..." \
  -e SESSION_SECRET="your-secret" \
  --name chat-blackonion \
  ghcr.io//chat-blackonion:latest

Building Locally

docker build -t chat-blackonion .
docker run -d -p 5000:5000 -v $(pwd)/public:/public --env-file .env chat-blackonion

ļæ½ Railway Deployment

šŸ“– Railway Guide: See docs/RAILWAY.md for complete Railway deployment instructions.

Railway provides:

  • āœ… Automatic deployments from GitHub
  • āœ… Managed PostgreSQL database
  • āœ… Persistent storage mounted at /public
  • āœ… Zero configuration file uploads

Quick start:

  1. Connect your GitHub repository to Railway
  2. Add PostgreSQL database
  3. Mount volume at /public
  4. Set environment variables
  5. Deploy! šŸš€

šŸ”§ Environment Variables

Create a .env file based on .env.example:

# Required
DATABASE_URL=postgresql://user:pass@host:port/database
SESSION_SECRET=your-random-secret-key

# Security (Highly Recommended for Production)
ADMIN_PASSWORD=your-secure-admin-password    # Default: admin123
ADMIN_PASSCODE=your-secure-app-passcode      # Default: admin1234

# Optional - Railway Storage
# RAILWAY_STORAGE_PATH=/public  # Auto-configured for Railway

# Optional - Development
NODE_ENV=development
PORT=5000
NODE_TLS_REJECT_UNAUTHORIZED=0  # For development only

šŸ” Security Notes:

  • ADMIN_PASSWORD sets the initial admin account password (used during database seeding)
  • ADMIN_PASSCODE sets the app access code (calculator unlock sequence)
  • If not set, defaults will be used (NOT secure for production!)
  • These values are only used when creating a new database
  • Change credentials via Admin Dashboard after first login

Generate a secure session secret:

openssl rand -base64 32

šŸ“– Complete Variable Reference: See docs/ENVIRONMENT-VARIABLES.md

šŸ“š Documentation

šŸ—ļø Project Structure

chat-blackonion/
ā”œā”€ā”€ client/              # Frontend React application
│   ā”œā”€ā”€ src/
│   │   ā”œā”€ā”€ components/  # Reusable UI components
│   │   ā”œā”€ā”€ pages/       # Page components
│   │   ā”œā”€ā”€ contexts/    # React contexts
│   │   └── lib/         # Utilities and helpers
│   └── public/          # Static assets
ā”œā”€ā”€ server/              # Backend Express application
│   ā”œā”€ā”€ routes/          # API route handlers
│   ā”œā”€ā”€ services/        # Business logic
│   ā”œā”€ā”€ lib/             # Server utilities
│   └── config/          # Configuration files
ā”œā”€ā”€ shared/              # Shared types and schemas
ā”œā”€ā”€ migrations/          # Database migrations
└── docs/                # Documentation

šŸ¤ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

šŸ”’ Security

  • All passwords are hashed with bcrypt
  • JWT tokens for authentication
  • SQL injection protection via Drizzle ORM
  • CORS configuration for API security
  • SSL/TLS for database connections
  • Environment variable protection
  • Protected file access - Files require authentication and channel membership
  • Path traversal prevention
  • Channel-based authorization for all uploaded files

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

šŸ‘„ Authors

šŸ™ Acknowledgments

  • The Black Onion team for cybersecurity excellence
  • Open source community for amazing tools and libraries

⭐ Star this repository if you find it helpful!


Template Content

More templates in this category

View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

View Template
(v1) Simple Medusa Backend
Deploy an ecommerce backend and admin using Medusa

View Template
peppermint
Docker-compose port for peppermint.sh