Skip to content

fadymas/DevOverFlow

Repository files navigation

DevOverflow

A community-driven Q&A platform built for developers, by developers.


πŸ“– Project Description

DevOverflow is a Q&A platform for developers where they can ask programming questions, share knowledge, and help each other solve technical problems. It is designed for programmers, students, and anyone learning or working in software development. Users can post questions with rich-text formatting, browse answers from the community, and get AI-assisted help β€” all in one place. The platform also features a reputation and badge system that rewards contributors based on their activity and impact, encouraging a healthy and engaged community.


πŸš€ Setup Instructions

Follow these steps to run DevOverflow locally.

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn
  • A MongoDB database (local or MongoDB Atlas)
  • A Google and GitHub OAuth app (for social login)
  • A Gmail account with an App Password enabled (for email sending)
  • A TinyMCE API key
  • A Gemini API key

1. Clone the repository

git clone https://github.com/your-username/devoverflow.git
cd devoverflow

2. Install dependencies

npm install

3. Set up environment variables

Create a .env.local file in the root of the project and add the following:

# TinyMCE Editor
NEXT_PUBLIC_TINY_EDITOR_API_KEY=your_tinymce_api_key

# MongoDB
MONGODB_URL=mongodb+srv://your_user:[email protected]/devoverflow

# Better Auth
BETTER_AUTH_SECRET=your_random_secret_string
BETTER_AUTH_URL=http://localhost:3000   # Base URL of your app

# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret

# GitHub OAuth
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret

# Email (Nodemailer via Gmail)
EMAIL_FROM=[email protected]
PASS=your_gmail_app_password   # App password from Gmail account settings

# App URL
NEXT_PUBLIC_SERVER_URL=http://localhost:3000

# Gemini AI
GEMINI_API_KEY=your_gemini_api_key

Note: For Gmail, you need to enable 2-Step Verification and generate an App Password from your Google Account settings. Do not use your regular Gmail password.

4. Run the development server

npm run dev

The app will be running at http://localhost:3000.


πŸ—οΈ Architecture Overview

DevOverflow is a full-stack application built entirely within Next.js β€” there is no separate backend server.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Browser (Client)               β”‚
β”‚  - React components + Tailwind CSS + shadcn/ui   β”‚
β”‚  - Forms handled by React Hook Form + Zod        β”‚
β”‚  - TinyMCE rich text editor                      β”‚
β”‚  - Better Auth client (login/session triggers)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Next.js (Server Layer)             β”‚
β”‚                                                  β”‚
β”‚  Server Actions  ──────────────►  MongoDB        β”‚
β”‚  (CRUD operations, data logic)                   β”‚
β”‚                                                  β”‚
β”‚  API Routes:                                     β”‚
β”‚  - /api/email  ──────────────►  Nodemailer       β”‚
β”‚  - /api/ai     ──────────────►  Gemini API       β”‚
β”‚                                                  β”‚
β”‚  Better Auth (server-side session validation)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

How it connects:

  • The frontend triggers Server Actions for all database operations (fetching questions, posting answers, voting, etc.). No REST API is needed for these.
  • API Routes handle email sending via Nodemailer and AI requests via the Gemini API.
  • Better Auth handles authentication flows. Login and registration are triggered from the client, but session validation and access to protected data happen server-side.
  • All data is stored in MongoDB, taking advantage of its flexible document structure for nested data like questions, answers, tags, and comments.

🧠 Technical Decisions

1. MongoDB over a relational database

Since DevOverflow is a Q&A platform, the data is naturally nested and flexible β€” questions have answers, answers have comments, and tags connect across many questions. MongoDB's document model made it straightforward to store and query this kind of data without the overhead of complex joins. Its scalability also makes it a strong fit for a growing community platform.

2. Better Auth over NextAuth

Rather than reaching for the most popular solution, I chose Better Auth to deepen my understanding of how authentication actually works. This decision pushed me to learn about session management, email verification flows, and OAuth integrations at a lower level. The result was a stronger grasp of auth fundamentals rather than treating it as a black box.

3. Custom Badges & Reputation System

Rather than using a third-party library, I built a custom badge and reputation system from scratch. Users earn Bronze, Silver, and Gold badges based on six tracked metrics: question count, answer count, question upvotes, answer upvotes, and total profile views. Each metric has tiered thresholds, and badges are recalculated automatically as a user's activity grows. Reputation points are also awarded for positive contributions, giving the community a clear signal of who the most helpful and active members are. Building this myself gave me full control over the logic and made it a natural fit within the existing MongoDB data model.

4. Next.js Server Actions over a traditional REST API

Instead of building a separate API layer, I used Next.js Server Actions to handle all database logic. This keeps the codebase clean and organized β€” backend logic lives alongside the frontend but runs exclusively on the server. It also improves security since database credentials and operations are never exposed to the client.


πŸ“Έ Screenshots

Replace the placeholders below with actual screenshots of your app.

Home Page

image

Browse the latest questions from the community

Question Detail Page

image *View a question, read answers, and contribute your own*

Ask a Question

image *Rich text editor powered by TinyMCE for writing detailed questions*

User Profile

image *Track your questions, answers, and reputation*

Mobile View

image *Fully responsive design across all screen sizes*

πŸ› οΈ Tech Stack

Layer Technology
Framework Next.js (App Router)
Language TypeScript
Styling Tailwind CSS + shadcn/ui
Forms React Hook Form + Zod
Rich Text Editor TinyMCE
Database MongoDB
Authentication Better Auth
Email Nodemailer (Gmail)
AI Google Gemini API

πŸ“„ License

This project is open source and available under the MIT License.

About

A community-driven Q&A platform built for developers, by developers.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors