Skip to content

revcodeshq/bbgwebsite

Repository files navigation

🎯 BBG Alliance Dashboard

A comprehensive Discord bot dashboard for managing Whiteout Survival alliance activities

Next.js React MongoDB Discord API

Built by RevCodes

🌟 Features

🏰 Alliance Management

  • Member Tracking: Comprehensive member list with role-based permissions
  • Activity Monitoring: Track member participation and engagement
  • Alliance Statistics: View alliance performance metrics and progress

πŸ“… Event Scheduling

  • Interactive Calendar: Full-featured calendar for alliance events
  • Event Management: Create, edit, and manage alliance activities
  • Automated Reminders: Discord notifications for upcoming events
  • Event History: Track past events and participation

🎁 Giveaway System

  • Active Giveaways: Manage ongoing contests and rewards
  • Automated Entries: Handle participant registration
  • Winner Selection: Fair and transparent winner selection
  • Giveaway History: Complete audit trail of all giveaways

πŸ’¬ Communication Hub

  • Real-time Chat: Integrated chat system with Discord sync
  • Announcements: Broadcast important alliance news
  • Forum Integration: Discussion threads for alliance topics
  • Notification System: Comprehensive notification management

πŸ‘‘ Admin Dashboard

  • User Management: Admin tools for member oversight
  • Moderation Tools: Content and behavior management
  • Analytics: Detailed insights into alliance activity
  • Task Management: Assign and track alliance tasks

πŸ” Security & Authentication

  • Discord OAuth: Secure authentication via Discord
  • Role-based Access: Granular permission system
  • Rate Limiting: Protection against abuse
  • Data Validation: Comprehensive input sanitization

πŸš€ Quick Start

Prerequisites

  • Node.js 18.0 or higher
  • MongoDB database (local or MongoDB Atlas)
  • Discord application for OAuth

Installation

  1. Clone the repository

    git clone https://github.com/revcodes/bbgwebsite.git
    cd bbgwebsite
  2. Install dependencies

    npm install
  3. Configure environment variables

    cp .env.example .env.local

    Edit .env.local with your configuration:

    # Database
    MONGODB_URI=mongodb://localhost:27017/bbg-alliance
    
    # NextAuth
    NEXTAUTH_SECRET=your-super-secret-key-here
    NEXTAUTH_URL=http://localhost:3000
    
    # Discord OAuth
    DISCORD_CLIENT_ID=your_discord_application_client_id
    DISCORD_CLIENT_SECRET=your_discord_application_secret
    
    # Discord Bot
    BOT_TOKEN=your_discord_bot_token
    GUILD_ID=your_discord_server_guild_id
    ANNOUNCEMENTS_CHANNEL_ID=your_announcements_channel_id
    
    # Public Variables
    NEXT_PUBLIC_GUILD_ID=your_discord_server_guild_id
  4. Set up Discord Application

    • Create a Discord application at Discord Developer Portal
    • Configure OAuth2 redirect URI: http://localhost:3000/api/auth/callback/discord
    • Create a bot and get the bot token
    • Invite the bot to your Discord server with appropriate permissions
  5. Start the development server

    npm run dev
  6. Open your browser Navigate to http://localhost:3000

πŸ§ͺ Testing

Unit Tests

npm test                 # Run tests once
npm run test:watch      # Run tests in watch mode
npm run test:coverage   # Run tests with coverage

End-to-End Tests

npm run test:e2e        # Run E2E tests
npm run test:e2e:ui     # Run E2E tests with UI

🐳 Docker Deployment

Using Docker

# Build the image
docker build -t bbg-alliance-dashboard .

# Run the container
docker run -p 3000:3000 --env-file .env.local bbg-alliance-dashboard

Docker Compose

version: '3.8'
services:
  app:
    build: .
    ports:
      - "3000:3000"
    env_file:
      - .env.local
    depends_on:
      - mongodb
  
  mongodb:
    image: mongo:4.4
    ports:
      - "27017:27017"
    volumes:
      - mongodb_data:/data/db

volumes:
  mongodb_data:

πŸ“ Project Structure

bbgwebsite/
β”œβ”€β”€ app/                    # Next.js 13+ App Router
β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”œβ”€β”€ components/        # React components
β”‚   β”œβ”€β”€ admin/            # Admin dashboard
β”‚   β”œβ”€β”€ alliance/         # Alliance management
β”‚   β”œβ”€β”€ chat/             # Chat interface
β”‚   β”œβ”€β”€ dashboard/        # Main dashboard
β”‚   β”œβ”€β”€ forum/           # Forum functionality
β”‚   β”œβ”€β”€ giveaways/       # Giveaway system
β”‚   └── profile/         # User profiles
β”œβ”€β”€ lib/                   # Utilities and configurations
β”‚   β”œβ”€β”€ models/           # MongoDB models
β”‚   β”œβ”€β”€ mongodb.js        # Database connection
β”‚   β”œβ”€β”€ security.js       # Security utilities
β”‚   └── validation.js     # Input validation
β”œβ”€β”€ public/               # Static assets
β”œβ”€β”€ __tests__/           # Test files
β”œβ”€β”€ e2e/                 # End-to-end tests
└── utils/               # Helper functions

πŸ› οΈ Tech Stack

  • Frontend: Next.js 15, React 19, Bootstrap 5
  • Backend: Node.js, Express.js, Socket.io
  • Database: MongoDB with Mongoose
  • Authentication: NextAuth.js with Discord OAuth
  • Testing: Jest, Playwright
  • Styling: CSS Modules, Bootstrap, Custom CSS
  • Deployment: Docker, Vercel-ready

πŸ”§ Configuration

Environment Variables

Variable Description Required
MONGODB_URI MongoDB connection string βœ…
NEXTAUTH_SECRET NextAuth.js secret key βœ…
NEXTAUTH_URL Application URL βœ…
DISCORD_CLIENT_ID Discord OAuth client ID βœ…
DISCORD_CLIENT_SECRET Discord OAuth client secret βœ…
BOT_TOKEN Discord bot token βœ…
GUILD_ID Discord server ID βœ…
ANNOUNCEMENTS_CHANNEL_ID Discord announcements channel βœ…
ADMIN_ROLE_NAMES Admin role names (comma-separated) ❌
RATE_LIMIT_REQUESTS Rate limit requests per window ❌
RATE_LIMIT_WINDOW Rate limit window in milliseconds ❌

Discord Permissions

The bot requires the following Discord permissions:

  • Send Messages
  • Read Message History
  • Manage Messages
  • Embed Links
  • Attach Files
  • Read Messages/View Channels
  • Use Slash Commands

🚦 Development

Available Scripts

Script Description
npm run dev Start development server with custom server
npm run dev:next Start Next.js development server only
npm run build Build for production
npm start Start production server
npm test Run unit tests
npm run test:e2e Run end-to-end tests

Code Style

This project uses:

  • ESLint for code linting
  • Prettier for code formatting
  • Jest for unit testing
  • Playwright for E2E testing

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details on:

  • Development setup
  • Code style guidelines
  • Pull request process
  • Issue reporting

πŸ”’ Security

For security concerns, please review SECURITY.md. This project implements:

  • Input validation and sanitization
  • Rate limiting
  • CSRF protection
  • Secure authentication
  • Environment variable protection

πŸ“„ License

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

πŸ™ Acknowledgments

  • Whiteout Survival community for inspiration
  • Discord.js for excellent Discord API integration
  • Next.js team for the amazing framework
  • Vercel for deployment platform

πŸ“ž Support


Made with ❀️ by RevCodes
Empowering alliance management through technology

About

No description, website, or topics provided.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published