A modern, community-driven Q&A platform for developers β reimagined with the latest web technologies.
Documentation β’ Report Bug β’ Request Feature
π Project Status: Currently in active development. Core features are being implemented. Check back soon for the live demo!
|
Post questions, write detailed answers, and help others grow together. Full-text search with intelligent tag and category filtering. Organize content with technology tags (React, JavaScript, TypeScript, etc.). Save or remove questions and browse saved questions in your collection. Upvote or downvote questions and answers with optimistic UI updates. |
Sign in with Google, GitHub, or email via NextAuth. Seamless theme switching for comfortable viewing. Optimized for desktop, tablet, and mobile devices. Browse members, filter by reputation or popularity, and view each member's questions. View responsive profiles with bio, location, portfolio, activity stats, and paginated questions and answers. Users can edit their profile details. Right sidebar highlights top-voted questions and the most-used tags. |
|
Markdown editor (MDXEditor, loaded client-side only) for questions and answers, with syntax-highlighted code blocks rendered via Bright. Shared filter components and pagination across home, tags, tag details, collection, community, and answers. Request and error logging with Pino for debugging and monitoring. Generate intelligent answers using OpenAI integration. |
|
| Layer | Technology |
|---|---|
| Frontend | Next.js 16 (App Router, Server Components, Server Actions) β’ React 19 |
| Language | TypeScript |
| Database | MongoDB via Mongoose 8 |
| Auth | NextAuth.js v5 (Google, GitHub, Credentials) |
| Styling | Tailwind CSS 4 β’ shadcn/ui β’ Radix UI β’ Lucide |
| Forms & Validation | React Hook Form β’ Zod |
| Editor | MDX Editor β’ next-mdx-remote β’ Bright |
| AI | OpenAI via Vercel AI SDK |
| Logging | Pino |
β Node.js β₯ 22.13
β Yarn (via Corepack: `corepack enable`)
β MongoDB (local or Atlas)# 1οΈβ£ Clone the repository
git clone https://github.com/osamaayub/DevFlow.git
cd DevFlow
# 2οΈβ£ Install dependencies (also applies patches/ via patch-package)
yarn install
# 3οΈβ£ Create a .env.local file in the project root
# and add the variables listed below
# 4οΈβ£ At minimum set:
# MONGODB_URI, AUTH_SECRET (OAuth and OpenAI keys are optional)
# 5οΈβ£ Start development server
yarn dev
# 6οΈβ£ Open http://localhost:3000 in your browser ππ Note: Env files are loaded per environment and are git-ignored for security.
| Variable | Description | Example |
|---|---|---|
MONGODB_URI |
MongoDB connection string | mongodb+srv://user:[email protected]/devflow |
AUTH_SECRET |
NextAuth encryption key | Generate with: npx auth secret |
OPENAI_API_KEY |
OpenAI API key for AI answers | Get from OpenAI Platform |
| Variable | Provider | How to Get |
|---|---|---|
AUTH_GITHUB_ID |
GitHub OAuth | GitHub OAuth Settings |
AUTH_GITHUB_SECRET |
GitHub OAuth | GitHub OAuth Settings |
AUTH_GOOGLE_ID |
Google OAuth | Google Cloud Console |
AUTH_GOOGLE_SECRET |
Google OAuth | Google Cloud Console |
| Variable | Default | Values |
|---|---|---|
LOG_LEVEL |
debug (dev) / info (prod) |
debug, info, warn, error |
NEXTAUTH_URL |
Auto-detected (trustHost) |
Your site URL, e.g. http://localhost:3000 |
NEXT_PUBLIC_API_BASE_URL |
https://$VERCEL_URL on Vercel, otherwise localhost |
Base URL used by the API client in lib/api.ts |
# Development
yarn dev # Start dev server (webpack)
# Production
yarn build # Create optimized production build
yarn start # Run production server
# Code Quality
yarn lint # Run ESLint checks- Project setup with Next.js 16 & TypeScript
- MongoDB & Mongoose integration with multiple models
- NextAuth.js authentication (Google, GitHub, Email/Password)
- Complete database models (Questions, Answers, Users, Tags, Accounts, Collections, Interactive, Votes, QuestionView, TagQuestion)
- Server actions for CRUD operations (questions, answers, tags, auth)
- Tailwind CSS & component styling with shadcn/ui
- Dark/Light theme support with context provider
- Rich text editor with MDX support
- Tag management system with tag-question relationships
- Search functionality with filtering
- Pagination system
- Error handling with custom error handler
- Validation schemas with Zod
- AI Answer API endpoint with OpenAI integration
- API client functions and centralized route constants
- Core UI pages (home, sign-in, sign-up, ask-question, question details, tags, collections)
- React components (forms, cards, navigation, editor, search, filters, shared utilities)
- User authentication flow (sign up, sign in, OAuth)
- Question creation and editing
- Save and remove questions with a stateful saved-star indicator
- Collection page listing the signed-in user's saved questions
- Answer creation
- Question view tracking
- Responsive design across implemented pages
- Local search bar with filtering
- Navigation sidebar and mobile navigation
- Theme toggle component
- User avatar components
- Relative time display
- Toast notifications with Sonner
- Form validation with React Hook Form
- Database connection management
- Structured logging with Pino
- API route handlers for users, accounts, auth, and AI
- OAuth callback handling and user account creation
- Password hashing with bcrypt
- Username generation for OAuth users
- Session management and JWT callbacks
- MongoDB transaction support for complex operations
- Tag processing and helper functions
- Question filtering (newest, unanswered, popular)
- URL utilities and helpers
- AI Answer UI integration (API implemented, UI Implemented)
- Vote system (upvotes/downvotes) for questions and answers with optimistic updates
- Home filters (newest, recommended, frequent, unanswered)
- Shared filter component for tags, collection, community, and answers
- Pagination for questions, tags, tag details, answers, collection, and community
- Tag details page
- Community page with search, filters, and member details page
- User profiles with editable profile details, activity tabs, statistics, and pagination
- Right sidebar with hot questions and popular tags
- Back button across pages
- MDX editor loaded client-side only (fixes "This page couldn't load" on ask-question and question details)
- CI workflow (lint, type-check, build) and Docker image publishing to GHCR
- Jobs page implementation (placeholder exists)
- Question deletion UI (
deleteQuestionaction exists)
- Interaction tracking - Schema exists, implementation pending
- Answer editing and deletion
- User management actions
- Live demo deployment
- Admin dashboard
- Real-time notifications
- Advanced analytics and reporting
- Community features (comments, discussions)
- Badge system and gamification
- API rate limiting
- Additional OAuth providers
- Enhanced search algorithms
- Performance optimizations
- Additional unit and integration tests
DevFlow/
βββ src/
β βββ app/ # Routes only: thin pages, layouts, API handlers
β β βββ (auth)/ # sign-in, sign-up
β β βββ (root)/ # home, ask-question, questions/[id], tags, community, ...
β β βββ api/ # REST endpoints (accounts, users, ai/answers, auth)
β β βββ layout.tsx
β β βββ Providers.tsx
β βββ features/ # Vertical slices: one folder per domain
β β βββ answers/ # actions.ts + components/ (AnswerForm, AnswerCard, AllAnswers)
β β βββ auth/ # actions.ts, sign-out.action.ts + components/ (AuthForm, SocialAuthForm)
β β βββ collections/ # actions.ts (saved questions)
β β βββ community/ # actions.ts + components/ (UserCard, CommunityMemberProfile)
β β βββ questions/ # actions.ts + components/ (QuestionForm, QuestionCard, SaveQuestion)
β β βββ tags/ # actions.ts, tag-helpers.ts + components/ (TagCards)
β β βββ users/ # actions.ts + components/ (profile, activity, and profile editing)
β β βββ votes/ # actions.ts, vote-state.ts, components/, hooks/useVote.ts
β βββ server/ # Server-only infrastructure (never imported by client code)
β β βββ auth.ts # NextAuth configuration
β β βββ action.ts # Validate + authorize + connect wrapper for server actions
β β βββ errors/ # HTTP error classes, error handler
β β βββ db/ # connect.ts, models/, schemas/ (guarded by "server-only")
β βββ shared/ # Client-safe building blocks used across features
β β βββ api/ # Typed fetch client for the REST endpoints
β β βββ components/ # ui/ (shadcn), common/, editor/, filters/, navigation/, search/
β β βββ constants/
β β βββ context/ # Theme context
β β βββ lib/ # utils, url, validation (zod), logger
β β βββ types/
β βββ proxy.ts # Request proxy: forwards the question filter header
βββ patches/ # patch-package patches (next-themes)
βββ public/ # Static assets
βββ .github/workflows/ # CI and deploy workflows
βββ Dockerfile # Multi-stage standalone build
Dependency rules
appβfeaturesβshared;serveris used byappand featureactions.ts, never by client components.- A feature is imported only through its public surface:
@/features/<name>/componentsor@/features/<name>/actions. Features don't reach into each other's internals. - Relative imports stay inside one area; anything crossing areas uses the
@/alias (@/*βsrc/*).
All responses follow the standard envelope format:
{ "success": true, "data": {...}, "statusCode": 200 }Note: Questions, Answers, and Tags use Server Actions instead of REST API endpoints for better performance and type safety.
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/users |
List all users |
POST |
/api/users |
Create new user (201) |
GET |
/api/users/:id |
Get user by ID |
PATCH |
/api/users/:id |
Update user |
DELETE |
/api/users/:id |
Delete user |
POST |
/api/users/email |
Get user by email |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/accounts |
List all accounts |
POST |
/api/accounts |
Create new account |
GET |
/api/accounts/:id |
Get account by ID |
PATCH |
/api/accounts/:id |
Update account |
DELETE |
/api/accounts/:id |
Delete account |
POST |
/api/accounts/provider |
Get account by provider |
| Method | Endpoint | Description |
|---|---|---|
GET/POST |
/api/auth/[...nextauth] |
NextAuth.js handler (Google, GitHub, Credentials) |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/ai/answers |
Generate AI-powered answers with OpenAI |
Questions, Answers, Tags, Votes, Collections, and Community are handled via Server Actions instead of REST API:
| Feature | Action | Description |
|---|---|---|
| Questions | createQuestion |
Create new question with tags |
editQuestion |
Edit existing question | |
getQuestion |
Get single question by ID | |
getQuestions |
Get paginated questions with search and filters | |
getHotQuestions |
Get top questions for the right sidebar | |
incrementQuestionViews |
Track question views | |
deleteQuestion |
Delete a question (no UI yet) | |
| Answers | createAnswer |
Create answer for question |
getAnswers |
Get paginated answers with filters | |
| Tags | getTags |
Get paginated tags with filters |
getTagQuestions |
Get questions for specific tag | |
getTopTags |
Get popular tags for the right sidebar | |
| Votes | CreateVote / UpdateVote |
Cast, switch, or remove an upvote/downvote |
hasVoted |
Check the current user's vote on a question or answer | |
getUserVotesForTargets |
Batch-check votes for multiple targets | |
| Collection | toggleSaveQuestion |
Save or unsave a question |
hasSavedQuestion |
Check whether a question is saved | |
getSaveQuestions |
Get the user's saved questions (paginated, filtered) | |
| Community | getUsers |
Get paginated users with search and filters |
getCommunityMember |
Get a member and their questions | |
| Auth | signUpWithCredentials |
User registration |
signInWithCredentials |
User login | |
logout |
User sign out |
Build and run DevFlow in a containerized environment:
# Build the image
docker build -t devflow .
# Run the container
docker run -p 3000:3000 \
-e MONGODB_URI="mongodb+srv://..." \
-e AUTH_SECRET="your-secret-key" \
-e AUTH_GITHUB_ID="your-github-id" \
-e AUTH_GITHUB_SECRET="your-github-secret" \
devflowThe image runs as a non-root user on port 3000 for security.
GitHub Actions automate testing and deployment:
| Workflow | Trigger | Action |
|---|---|---|
| CI | PR or push to main/dev |
Lint β Type-check β Build |
| Deploy (Dev) | Push to dev |
Build β Push ghcr.io/.../devflow:dev |
| Deploy (Prod) | Push to main |
Build β Push ghcr.io/.../devflow:latest |
- Configure Settings β Environments in your GitHub repo
- Add secrets for
developmentandproductionenvironments:MONGODB_URIAUTH_SECRET- OAuth credentials
- Docker registry credentials (if using GHCR)
- π― Next.js App Router with Server Components and Server Actions
- π§© Client-only MDX editor loaded with
next/dynamicto keep it out of server rendering - ποΈ Optimized Bundle with tree-shaking
- π¦ MongoDB Indexing for fast queries
- π Docker Multi-stage Build for minimal image size
We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request against the
devbranch
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
- Reference related issues in your PR
# Check your MONGODB_URI format
# Expected: mongodb+srv://username:[email protected]/dbname
# Make sure your IP is whitelisted in MongoDB Atlas# Regenerate AUTH_SECRET
npx auth secret
# Verify OAuth credentials in your provider settings# Clear cache and reinstall
rm -rf .next node_modules
yarn install
yarn buildThis project is licensed under the MIT License β feel free to use it in your projects!
Have questions or want to contribute?
- π¬ GitHub Discussions β Ask questions & discuss features
- π Report Issues β Found a bug? Let us know
- π Documentation β Coming soon with API guides & architecture
- π₯ Join Development β We welcome contributors!
- β Star the repo β Shows your support!
Made with β€οΈ by Osama Ayub