
Deploy theblackonion
Deploy and Host theblackonion chat with Railway
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.
About Hosting
Deploy your own instance to Railway with a single click:
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:
- Go to Settings ā Actions ā General
- Under Workflow permissions, select "Read and write permissions"
- 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:
- Connect your GitHub repository to Railway
- Add PostgreSQL database
- Mount volume at
/public
- Set environment variables
- 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
- Setup Guide - Complete installation and configuration instructions
- Environment Variables - Complete variable reference
- Railway Deployment - Deploy to Railway with persistent storage
- Railway Migration Fix - Fix "relation does not exist" errors
- File Security - Understanding protected file access
- API Documentation - Swagger API docs (when running)
šļø 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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - 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
- Hasan Shahriar - hasanshahriar32
š 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
chat-blackonion
ghcr.io/hasanshahriar32/chat-blackonion:latest