OpenForum Documentation

website·Indexed 30 days ago

https://openforum-docs.vercel.app

Documentation for OpenForum, a modern forum application built with Next.js 15. Includes guides on quick installation, Vercel deployment, environment configuration, high-level architecture, and admin panel management.

Tokens
16.4K
Snippets
72
Records
129
Agent score
73%

What's inside OpenForum

  1. OpenForum Component Architecture

    The frontend is organized into a hierarchical structure to separate routing, layout, and feature logic:

    • Page Components (app/ directory): Route-based components responsible for server-side data fetching, SEO metadata, and layout composition.
    • View Components (components/views/): Large, page-level components that manage complex state and integrate multiple feature components (e.g., Forum Home View, Thread View).
    • Feature Components (components/forum/): Small, reusable UI elements such as Thread Cards, Post Components, and Vote Buttons.
    • Global Layout: Includes a Header (Navigation, User Dropdown, Search), a context-specific Sidebar, and a Footer.
  2. Choose a deployment platform for OpenForum

    OpenForum supports multiple deployment strategies depending on the infrastructure requirements:

    • Cloud Platforms: Optimized for Next.js deployments via Vercel, Railway, or Netlify.
    • Container Deployment: For scalable, isolated environments using Docker, AWS ECS, or Google Cloud Run.
    • Self-Hosted: For full control over the server using a VPS, DigitalOcean Droplet, or AWS EC2 instance.
  3. OpenForum High-Level Architecture Overview

    OpenForum is a modern web application built with Next.js 15 and React 19. The architecture is divided into three primary layers:

    1. Frontend Layer: Utilizes React 19 Server Components, Shadcn/UI, and Tailwind CSS for a responsive, accessible interface.
    2. Backend Layer: Employs Next.js API Routes, Server Actions, and Middleware for business logic and request processing, deployed on the Vercel Edge Network.
    3. Data Layer: Uses Drizzle ORM to interface with a PostgreSQL database, managing schema and migrations.

    External integrations include Better Auth for identity management, Resend for email services, and a dedicated file storage system.

  4. OpenForum Product Overview

    OpenForum is an open-source, full-featured forum application designed for developer communities, customer support, and educational platforms. It is built with Next.js 15 and features real-time discussions, a responsive UI, and comprehensive administrative tools.
  5. OpenForum high-level project structure

    OpenForum is organized as a Next.js 15 project. The root directory contains the main application logic, configuration files for the framework, styling, and database ORM.
    openforum/
    ├── 📁 app/                    # Next.js 15 App Router - Main application pages
    ├── 📁 components/             # React components - Reusable UI components  
    ├── 📁 db/                     # Database - Schema and connection configuration
    ├── 📁 lib/                    # Libraries - Utility functions and configurations
    ├── 📁 actions/                # Server Actions - Backend logic and API operations
    ├── 📁 migrations/             # Database Migrations - Schema version control
    ├── 📁 docs/                   # Documentation - Guides and API references
    ├── 📁 public/                 # Static Assets - Images, icons, and public files
    ├── 📄 package.json            # Dependencies and scripts
    ├── 📄 next.config.ts          # Next.js configuration
    ├── 📄 tailwind.config.ts      # Tailwind CSS configuration
    ├── 📄 drizzle.config.ts       # Database ORM configuration
    └── 📄 tsconfig.json           # TypeScript configuration
  6. Backup OpenForum database and application files

    Use pg_dump for PostgreSQL database backups and tar for application files. It is recommended to automate these backups using a shell script and upload them to cloud storage like AWS S3.
    # Manual PostgreSQL dump
    pg_dump "your-database-url" > forum_backup_$(date +%Y%m%d).sql
    
    # Compressed backup
    pg_dump "your-database-url" | gzip > forum_backup_$(date +%Y%m%d).sql.gz
    
    # Backup application files
    tar -czf forum_files_$(date +%Y%m%d).tar.gz /path/to/forum
    #!/bin/bash
    # Automated backup script (backup.sh)
    DATE=$(date +%Y%m%d_%H%M%S)
    pg_dump "$DATABASE_URL" | gzip > "backups/forum_${DATE}.sql.gz"
    aws s3 cp "backups/forum_${DATE}.sql.gz" s3://your-backup-bucket/
  7. Prepare your environment for OpenForum installation

    Before installing OpenForum, ensure the following software and accounts are available:

    Required:

    • Node.js (version 18 or higher)
    • pnpm (recommended) or npm
    • PostgreSQL database (local or cloud)
    • Git

    Optional but Recommended:

    • Resend Account (for email notifications)
    • Google/GitHub OAuth Apps (for social login)
    • Code Editor (VS Code with TypeScript support recommended)
  8. Promote the first user to Admin

    The first registered user in OpenForum must be manually promoted to the admin role via a database update to gain access to the admin panel.
    UPDATE "user" SET role = 'admin' WHERE email = 'your-email@example.com';
  9. Choose a deployment platform for OpenForum

    OpenForum is built with Next.js 15 and can be deployed to any platform supporting Node.js. Recommended platforms include Vercel (optimized for Next.js), Railway (includes built-in PostgreSQL), and Netlify. For more control, container platforms like Docker, AWS ECS/EKS, and Google Cloud Run are supported, as well as traditional VPS/Dedicated servers.
  10. Enable Vercel Analytics for OpenForum

    To monitor your OpenForum deployment using Vercel Analytics, enable the feature in the Vercel project dashboard under the Analytics tab and add the VERCEL_ANALYTICS_ID environment variable.
    VERCEL_ANALYTICS_ID=your-analytics-id
  11. Configure custom domains and HTTPS

    Custom domain setup depends on the provider. For Vercel, add the domain in Project Settings and use the CNAME record cname.vercel-dns.com. For Railway, use the provided DNS values in Project Settings. HTTPS is automatic on Vercel, Railway, and Netlify. For self-hosted setups, use Nginx with SSL certificates or Let's Encrypt via Certbot.
    # Nginx SSL configuration
    server {
        listen 443 ssl;
        ssl_certificate /path/to/certificate.crt;
        ssl_certificate_key /path/to/private.key;
        
        location / {
            proxy_pass http://localhost:3000;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    }
    # Install and run Certbot for Let's Encrypt
    sudo apt install certbot python3-certbot-nginx
    sudo certbot --nginx -d yourdomain.com
  12. Contribute code to OpenForum

    To contribute code to the OpenForum project, follow this workflow:

    1. Fork the official repository.
    2. Create a dedicated feature branch for your changes.
    3. Adhere to the project's coding standards.
    4. Write and include tests for any new features.
    5. Submit a pull request for review.