Installation Guide
This guide will walk you through installing and configuring CyberPaste on your server.
Prerequisites
Before installing CyberPaste, ensure you have the following:
- Node.js: Version 18 or higher (Download)
- MongoDB: Version 5.0 or higher (Download)
- Discord Application: For OAuth2 authentication (Discord Developer Portal)
- Git: For cloning the repository (Download)
Step 1: Clone the Repository
git clone https://github.com/lollopanta/CyberPaste.git
cd CyberPaste
Step 2: Install Dependencies
npm install
This will install all required dependencies including Express.js, MongoDB, Passport.js, and other packages.
Step 3: Set Up MongoDB
Option A: Local MongoDB
-
Install MongoDB on your system
-
Start MongoDB service:
# Linux (systemd)
sudo systemctl start mongod
# macOS (Homebrew)
brew services start mongodb-community
# Windows
# Start MongoDB from Services or use mongod.exe -
Verify MongoDB is running:
mongosh
Option B: MongoDB Atlas (Cloud)
- Create an account at MongoDB Atlas
- Create a new cluster
- Create a database user
- Whitelist your server IP address
- Get your connection string
Step 4: Configure Discord OAuth
- Go to Discord Developer Portal
- Click "New Application" and give it a name
- Go to "OAuth2" → "General"
- Add a redirect URI:
- For local development:
http://localhost:3000/auth/discord/callback - For production:
https://yourdomain.com/auth/discord/callback
- For local development:
- Copy the "Client ID" and "Client Secret"
- Save the application
Step 5: Configure CyberPaste
Create or edit the config.yml file in the root directory:
# License Configuration
licenseKey: 'YOUR_LICENSE_KEY' # Replace with your actual license key
# Database Configuration
mongoURI: 'mongodb://localhost:27017/CyberPaste' # Or your MongoDB Atlas connection string
# Owner Configuration
OwnerID: 'YOUR_DISCORD_USER_ID' # Your Discord User ID (enable Developer Mode to get it)
# Debug Mode
debug: false # Set to true for development, false for production
# Web Server Configuration
baseURL: 'http://localhost:3000' # Your domain URL (no trailing slash)
Port: 3000 # Server port
useSSL: false # Set to true if using HTTPS (requires reverse proxy)
# Discord OAuth Configuration
clientId: 'YOUR_DISCORD_CLIENT_ID'
clientSecret: 'YOUR_DISCORD_CLIENT_SECRET'
# Session Configuration
sessionTime: '7d' # Session duration (e.g., 1h, 7d, 30d)
sessionSecret: 'YOUR_SECURE_SESSION_SECRET' # Generate a secure random string
Getting Your Discord User ID
- Enable Developer Mode in Discord:
- Settings → Advanced → Developer Mode
- Right-click on your username (in any server or DM)
- Click "Copy User ID"
- Paste it as
OwnerIDinconfig.yml
Generating a Session Secret
Generate a secure random string for sessionSecret:
# Linux/macOS
openssl rand -base64 32
# Or use an online generator
# https://www.dashlane.com/features/password-generator
Step 6: Start the Application
npm start
The application should start and you'll see:
[INFO] MongoDB connected
[INFO] Model loaded: Paste
[INFO] Model loaded: Settings
[INFO] Model loaded: Statistics
[INFO] Model loaded: User
[LICENSE] Validating license on startup...
[LICENSE] License validated successfully on startup!
[LICENSE] Periodic validation started (every 15 minutes)
[INFO] Server started on port 3000
[INFO] Access the application at http://localhost:3000
Step 7: Access the Application
Open your browser and navigate to:
- Homepage:
http://localhost:3000 - Admin Panel:
http://localhost:3000/staff(requires owner login)
Production Deployment
Using PM2 (Recommended)
-
Install PM2 globally:
npm install -g pm2 -
Start the application:
pm2 start index.js --name CyberPaste -
Save the PM2 process list:
pm2 save -
Set up PM2 to start on boot:
pm2 startup
Using Docker
Create a Dockerfile:
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY . .
EXPOSE 3000
CMD ["node", "index.js"]
Build and run:
docker build -t cyberpaste .
docker run -d -p 3000:3000 --name cyberpaste cyberpaste
Reverse Proxy with Nginx
Configure Nginx as a reverse proxy:
server {
listen 80;
server_name paste.example.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
SSL/HTTPS Setup
-
Install Certbot:
sudo apt-get install certbot python3-certbot-nginx -
Obtain SSL certificate:
sudo certbot --nginx -d paste.example.com -
Update
config.yml:baseURL: 'https://paste.example.com'
useSSL: true
Troubleshooting
Application won't start
- Check Node.js version:
node --version(must be 18+) - Verify MongoDB is running:
mongosh - Check
config.ymlfor errors - Review console output for error messages
MongoDB connection error
- Verify MongoDB is running
- Check connection string in
config.yml - Ensure MongoDB is accessible from your server
- Check firewall rules
- Verify credentials are correct
Discord OAuth not working
- Verify Client ID and Client Secret in
config.yml - Check redirect URI matches exactly in Discord Developer Portal
- Ensure redirect URI uses correct protocol (http/https)
- Verify Discord application is not restricted
License validation failed
- Verify license key is correct in
config.yml - Check internet connection (license server must be accessible)
- Ensure license key is valid and not expired
- Contact support if issues persist
Next Steps
- Configure your admin panel settings
- Customize your site branding
- Set up rate limits and security settings
- Review the API Reference for integration
- Check the FAQ for common questions
Need Help? Join our Discord server for support and assistance.