Skip to content

pranava-mohan/WikiNITT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

136 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WikiNITT Logo

WikiNITT

The Ultimate Knowledge Hub for NIT Trichy

FeaturesTech StackGetting StartedStructureArchitecture

Go Next.js GraphQL MongoDB TailwindCSS AWS EC2 Netlify


Showcase

Main Stuff

Watch on YouTube

Admin Panel

Watch on YouTube

Features

Articles & Content

  • Rich Article System — Create, edit, and publish articles with Markdown support
  • Featured Content — Highlight important articles in a stunning carousel
  • Category Organization — Browse content by departments, hostels, student life, and more
  • Full-Text Search — Lightning-fast search powered by Meilisearch

Community Platform

  • Groups — Create public or private communities around shared interests
  • Posts & Discussions — Share ideas, ask questions, and engage with peers
  • Threaded Comments — Nested reply system for rich discussions
  • Voting System — Upvote/downvote posts and comments to surface quality content
  • Real-time Channels — Discussion channels within groups (with subscription support)

Authentication & Users

  • Secure Auth — NextAuth.js integration with JWT tokens
  • User Profiles — Customizable profiles with avatars via Cloudinary
  • Role-Based Access — User and Admin roles with GraphQL directive protection
  • Account Setup Flow — Guided onboarding with username selection

Admin Features

  • Content Management — Admin-only article creation and editing
  • User Management — Block/unblock users
  • Group Moderation — Manage community groups and memberships

Search & Discovery

  • Unified Search — Search across articles, posts, comments, and groups
  • Instant Results — Meilisearch-powered search with automatic indexing
  • Tab Navigation — Separate tabs for Articles and Community search results

Production-Ready

  • Rate Limiting — IP-based rate limiting for API protection
  • Request Timeout — Automatic request timeouts in production
  • Panic Recovery — Graceful error handling middleware
  • Environment Aware — Separate configs for development and production

Tech Stack

Backend (gravy/)

Technology Purpose
Go High-performance backend language
gqlgen Type-safe GraphQL server generation
MongoDB NoSQL database with rich querying
Meilisearch Lightning-fast full-text search engine
Cloudinary Cloud-based image and media management
Air Live-reload for development
Docker Containerized development environment
Redis Async Task Queue (RAG Sync)
AWS EC2 Production Hosting (Backend & Search)

Frontend (naan/)

Technology Purpose
Next.js 16 React framework with App Router
React 19 UI component library
TailwindCSS 4 Utility-first CSS framework
GraphQL Request Lightweight GraphQL client
TanStack Query Powerful data fetching & caching
Framer Motion Smooth animations
React Hook Form Performant form management
NextAuth.js Authentication for Next.js
Lucide React Beautiful icon library
Netlify Production Frontend Deployment

Getting Started

Prerequisites

  • Go 1.21+
  • Node.js 20+
  • Docker & Docker Compose
  • Cloudinary Account (for image uploads)
  • DAuth Client (for authentication)

Backend Setup

# Navigate to backend
cd gravy

# Create environment file, Configure you environment variables
cp .env.example .env

# Run the development server
docker compose up -d

Frontend Setup

# Navigate to frontend
cd naan

# Install dependencies
npm install

# Create environment file, Configure you environment variables
cp .env.example .env

# Generate GraphQL types
npm run codegen

# Start development server
npm run dev

Access the Application


Project Structure

wikinitt/
├── gravy/                    # Go GraphQL Backend
│   ├── cmd/                  # CLI utilities
│   │   └── create_admin/     # Admin user creation tool
│   ├── graph/                # GraphQL schema & resolvers
│   │   ├── *.graphqls        # Schema definitions
│   │   ├── *.resolvers.go    # Resolver implementations
│   │   └── model/            # Generated models
│   ├── internal/             # Internal packages
│   │   ├── articles/         # Article repository
│   │   ├── auth/             # Authentication middleware
│   │   ├── categories/       # Category management
│   │   ├── community/        # Groups, posts, comments
│   │   ├── db/               # Database connection
│   │   ├── ratelimit/        # Rate limiting
│   │   ├── sanitization/     # Input sanitization
│   │   ├── search/           # Meilisearch client
│   │   ├── uploader/         # Cloudinary integration
│   │   └── users/            # User repository
│   ├── docker-compose.yml    # Development services
│   ├── Dockerfile.dev        # Development container
│   ├── gqlgen.yml            # GraphQL codegen config
│   └── server.go             # Main server entry
│
└── naan/                     # Next.js Frontend
    ├── public/               # Static assets
    ├── src/
    │   ├── app/              # Next.js App Router pages
    │   │   ├── admin/        # Admin dashboard
    │   │   ├── articles/     # Article pages
    │   │   ├── c/            # Community pages (groups)
    │   │   ├── community/    # Community feed
    │   │   ├── u/            # User profiles
    │   │   └── ...           # Other routes
    │   ├── components/       # React components
    │   │   ├── community/    # Community-related components
    │   │   ├── profile/      # Profile components
    │   │   ├── ui/           # Reusable UI components
    │   │   └── ...           # Feature components
    │   ├── gql/              # GraphQL queries & generated types
    │   └── lib/              # Utilities
    └── tailwind.config.ts    # Tailwind configuration

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                          Frontend (Next.js)                      │
│  ┌───────────┐  ┌───────────┐  ┌───────────┐  ┌───────────────┐ │
│  │  Next.js  │  │  React    │  │ TanStack  │  │   NextAuth    │ │
│  │ App Router│  │   Query   │  │   Query   │  │  (Auth.js)    │ │
│  └─────┬─────┘  └─────┬─────┘  └─────┬─────┘  └───────┬───────┘ │
└────────┼──────────────┼──────────────┼────────────────┼─────────┘
         │              │              │                │
         └──────────────┴──────────────┴────────────────┘
                               │
                    GraphQL Request (HTTP/POST)
                               │
                               ▼
┌─────────────────────────────────────────────────────────────────┐
│                     Backend (Go + gqlgen)                        │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │                    GraphQL API Layer                       │  │
│  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────────────┐  │  │
│  │  │ Articles│ │Community│ │  Users  │ │     Search      │  │  │
│  │  │Resolvers│ │Resolvers│ │Resolvers│ │    Resolvers    │  │  │
│  │  └────┬────┘ └────┬────┘ └────┬────┘ └────────┬────────┘  │  │
│  └───────┼───────────┼───────────┼───────────────┼───────────┘  │
│          │           │           │               │              │
│  ┌───────┴───────────┴───────────┴───────────────┘              │
│  │                                                               │
│  ▼                                                               │
│  ┌──────────────────┐  ┌───────────────┐  ┌─────────────────┐   │
│  │   Repositories   │  │   Cloudinary  │  │   Rate Limiter  │   │
│  │  (Data Access)   │  │   (Uploads)   │  │   (Protection)  │   │
│  └────────┬─────────┘  └───────────────┘  └─────────────────┘   │
└───────────┼─────────────────────────────────────────────────────┘
            │
    ┌───────┴───────┐
    │               │
    ▼               ▼
┌────────┐    ┌────────────┐
│MongoDB │    │ Meilisearch│
│  (DB)  │    │  (Search)  │
└────────┘    └────────────┘

               ┌─────────────┐
               │    Redis    │
               │   (Queue)   │
               └──────▲──────┘
                      │
                      │ (Article Events)
                      │
           ┌──────────┴──────────┐
           │   Paneer Worker     │
           │  (Python RAG Sync)  │
           └──────────┬──────────┘
                      │
                      ▼
           ┌─────────────────────┐
           │      ChromaDB       │
           │    (Vector Store)   │
           └─────────────────────┘

License

This project is licensed under the GNU General Public License v3.0 — see the LICENSE file for details.


Made with ❤️ for the NIT Trichy community