A modern, full-stack community-driven Q&A platform built with Next.js, inspired by Stack Overflow. DevOverflow enables users to ask questions, share answers, and collaborate with the developer community.
DevOverflow is a comprehensive question-and-answer platform designed for developers. It provides a seamless experience for knowledge sharing, problem-solving, and community engagement. The application features a robust authentication system, intelligent search capabilities, and an AI-powered answer generation system.
-
Authentication System
- Multi-provider support (GitHub, Google, Email/Password)
- Secure credential-based authentication with bcryptjs
- NextAuth v5 integration for OAuth and session management
-
Questions & Answers
- Create, read, update, and delete questions
- Post detailed answers with rich text editing
- Track view counts, upvotes, and downvotes
- Answer counter and engagement metrics
-
User Features
- Comprehensive user profiles with statistics
- User collections for saving favorite questions
- Follow community members
- Track user interactions and activity
-
Search & Discovery
- Global search across questions, tags, and users
- Local search within question lists
- Advanced filtering options (newest, popular, unanswered)
- Tag-based categorization and browsing
-
Community Features
- Browse active community members
- Explore and manage tags
- Job board for career opportunities
- User reputation and achievement tracking
-
AI-Powered Features
- AI-generated answer suggestions using Google AI SDK
- Intelligent content recommendations
-
User Experience
- Dark/Light theme support
- Responsive mobile-first design
- Real-time notifications via Sonner
- Rich text editing with MDX support
- Smooth animations and transitions
- Framework: Next.js 15.5 (App Router)
- Language: TypeScript
- UI Components: Radix UI + custom components
- Styling: TailwindCSS + Tailwind Merge
- Form Management: React Hook Form
- Content Editor: MDXEditor
- Icons: Lucide React
- Theme Management: next-themes
- Runtime: Node.js
- API Routes: Next.js API Routes
- Authentication: NextAuth v5
- Database: MongoDB with Mongoose ODM
- Password Encryption: bcryptjs
- Validation: Zod
- AI Provider: Google AI SDK
- AI Framework: Vercel AI SDK
- Linting: ESLint
- Code Formatting: Prettier
- Logging: Pino + Pino Pretty
- Query String: query-string
devoverflow/
βββ app/ # Next.js App Router
β βββ (auth)/ # Authentication pages
β β βββ sign-in/
β β βββ sign-up/
β βββ (root)/ # Main application routes
β β βββ page.tsx # Home page with questions list
β β βββ ask-question/ # Question creation
β β βββ collections/ # Saved collections
β β βββ community/ # Community members
β β βββ jobs/ # Job listings
β β βββ profile/ # User profiles
β β βββ questions/ # Question details and editing
β β βββ tags/ # Tag browsing
β βββ api/ # Backend API routes
β β βββ accounts/ # Account management
β β βββ auth/ # Authentication endpoints
β β βββ ai/ # AI answer generation
β β βββ users/ # User operations
β βββ constants/ # App-wide constants
β βββ layout.tsx # Root layout
β βββ globals.css # Global styles
β
βββ components/ # Reusable React components
β βββ cards/ # Card components
β β βββ AnswerCard.tsx
β β βββ QuestionCard.tsx
β β βββ JobCard.tsx
β β βββ TagCard.tsx
β β βββ UserCard.tsx
β βββ forms/ # Form components
β β βββ AuthForm.tsx # Sign in/up form
β β βββ QuestionForm.tsx # Question creation/editing
β β βββ AnswerForm.tsx # Answer submission
β β βββ ProfileForm.tsx # Profile editing
β β βββ SocialAuthForm.tsx
β βββ filters/ # Filtering components
β β βββ CommonFilter.tsx
β β βββ HomeFilter.tsx
β β βββ JobFilter.tsx
β βββ search/ # Search components
β β βββ GlobalSearch.tsx # App-wide search
β β βββ LocalSearch.tsx # Page-level search
β βββ navigation/ # Navigation components
β β βββ LeftSidebar.tsx
β β βββ RightSidebar.tsx
β β βββ navbar/
β βββ editor/ # Rich text editor
β β βββ index.tsx
β βββ ui/ # UI primitives
β βββ user/ # User-related components
β βββ votes/ # Voting components
β
βββ database/ # Mongoose models & schemas
β βββ user.model.ts # User model
β βββ question.model.ts # Question model
β βββ answer.model.ts # Answer model
β βββ tag.model.ts # Tag model
β βββ account.model.ts # OAuth account model
β βββ collection.model.ts # User collections model
β βββ vote.model.ts # Voting model
β βββ interaction.model.ts # User interactions model
β βββ tag-question.model.ts # Tag-question relationships
β
βββ lib/ # Utility functions & business logic
β βββ actions/ # Server actions
β β βββ question.action.ts
β β βββ answer.action.ts
β β βββ user.action.ts
β β βββ auth.action.ts
β β βββ tag.action.ts
β β βββ ...
β βββ handlers/ # Event & error handlers
β βββ api.ts # API client
β βββ mongoose.ts # Database connection
β βββ logger.ts # Logging setup
β βββ validations.ts # Zod schemas
β βββ utils.ts # Helper utilities
β βββ url.ts # URL utilities
β βββ http-errors.ts # Custom error classes
β
βββ context/ # React Context
β βββ Theme.tsx # Theme context
β
βββ constants/ # Application constants
β βββ route.ts # Route definitions
β βββ filters.ts # Filter options
β βββ states.ts # Default states
β βββ TechMap.ts # Technology mapping
β
βββ types/ # TypeScript type definitions
β βββ action.d.ts # Action response types
β βββ global.d.ts # Global types
β
βββ public/ # Static assets
β βββ icons/
β βββ images/
β
βββ docs/ # Documentation
β βββ mermaids/ # Architecture diagrams
β
βββ auth.ts # NextAuth configuration
βββ middleware.ts # Next.js middleware
βββ next.config.ts # Next.js configuration
βββ tsconfig.json # TypeScript configuration
βββ postcss.config.mjs # PostCSS configuration
βββ eslint.config.mjs # ESLint configuration
βββ package.json # Project dependencies
User
- User profile information
- Email and authentication details
- Reputation points and achievements
- Account creation timestamp
Question
- Title and detailed content
- Associated tags
- View count, upvotes, downvotes
- Answer count
- Author reference
Answer
- Answer content
- Associated question reference
- Author information
- Voting metrics
Tag
- Tag name and description
- Question associations
- Usage statistics
Account
- OAuth provider details
- External provider IDs
- User association
Collection
- User-saved question collections
- Collection metadata
- Question references
Vote
- Vote type (upvote/downvote)
- Related question/answer
- User information
Interaction
- User interaction tracking
- Question/answer interactions
- Action timestamps
- Node.js 18+
- npm or yarn
- MongoDB instance (local or cloud)
- GitHub and Google OAuth applications (for authentication)
-
Clone the repository
git clone <repository-url> cd devoverflow
-
Install dependencies
npm install
-
Set up environment variables Create a
.env.localfile in the root directory:# Database MONGODB_URI=<your-mongodb-connection-string> # NextAuth NEXTAUTH_SECRET=<your-secret-key> NEXTAUTH_URL=http://localhost:3000 # OAuth Providers GITHUB_ID=<your-github-oauth-id> GITHUB_SECRET=<your-github-oauth-secret> GOOGLE_CLIENT_ID=<your-google-client-id> GOOGLE_CLIENT_SECRET=<your-google-client-secret> # AI Services GOOGLE_GENERATIVE_AI_API_KEY=<your-google-ai-api-key>
-
Run the development server
npm run dev
Open http://localhost:3000 in your browser.
npm run dev- Start development server with Turbopacknpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLint checks
DevOverflow supports multiple authentication methods:
-
OAuth Authentication (GitHub, Google)
- Redirects to provider
- Account linkage and creation
- Session establishment
-
Email/Password Authentication
- User registration with email verification
- Secure password hashing with bcryptjs
- Login with credentials
-
Session Management
- NextAuth v5 handles session tokens
- Secure cookie-based sessions
- CSRF protection
- Global Search: Search across all questions, tags, and users
- Local Search: Search within current page results
- Filters:
- Newest questions
- Most popular questions
- Unanswered questions
- Most viewed questions
- Trending questions
The platform integrates Google's Generative AI to provide intelligent answer suggestions. Users can request AI-generated answers for their questions, which are processed through the /api/ai/answers endpoint.
The application uses Radix UI primitives combined with custom styling for a consistent, accessible UI:
- Buttons
- Forms and inputs
- Dropdowns and menus
- Dialog boxes
- Tabs and navigation
- Alerts and notifications
- Avatars and badges
The application is fully responsive with:
- Mobile-first approach
- Tablet and desktop optimizations
- Touch-friendly navigation
- Adaptive layouts
- Light and dark themes
- User preference persistence
- System preference detection
- Smooth theme transitions
POST /api/auth/[...nextauth]- NextAuth endpointsPOST /api/auth/signin-with-oauth- OAuth sign-in
GET /api/users- List usersPOST /api/users- Create userGET /api/users/[id]- Get user detailsPOST /api/users/email- Email operations
GET /api/accounts- List accountsPOST /api/accounts- Create accountGET /api/accounts/[id]- Get accountGET /api/accounts/provider- Provider lookup
POST /api/ai/answers- Generate AI answer
- Turbopack: Fast builds with Turbopack instead of webpack
- Optimized Images: Next.js image optimization
- Code Splitting: Automatic code splitting by routes
- Caching: Strategic caching with server components
- Password Hashing: bcryptjs for secure password storage
- CSRF Protection: Built-in with NextAuth
- HTTPS: Recommended for production
- Environment Variables: Sensitive data protected
- Input Validation: Zod schema validation
- SQL/NoSQL Injection: Protected by MongoDB and Mongoose
The application uses Zod for runtime validation:
- Form input validation
- API request validation
- Type-safe schema definitions
- Create feature branches for new features
- Follow the existing component and file structure
- Use TypeScript for type safety
- Write reusable, modular components
- Follow ESLint and Prettier configurations
- Test thoroughly before submitting PR
- Check
lib/logger.tsfor application logging - Use
lib/http-errors.tsfor consistent error handling - Leverage Next.js server component logging
- Monitor database connections in
lib/mongoose.ts
The application can be deployed on:
- Vercel (recommended for Next.js)
- AWS (EC2, Lambda)
- GCP (Cloud Run, App Engine)
- Azure (App Service)
- Self-hosted servers
- Set production environment variables
- Run
npm run buildand verify no errors - Test authentication flows
- Verify database connections
- Set up CDN for static assets
- Configure error tracking (Sentry, etc.)
- Next.js Documentation
- React Documentation
- TypeScript Handbook
- MongoDB Documentation
- NextAuth Documentation
- TailwindCSS Documentation
- Radix UI Documentation
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues, questions, or suggestions, please open an issue on the repository or contact the development team.
Built with β€οΈ by the Ankit Kumar
Last Updated: 2026