A modern Q&A platform built with Next.js and Clerk, featuring role-based access control. Ask questions, share knowledge, and learn from others in a secure, well-structured environment.
Want to understand how this platform was built? Check out this complete guide:
Implementing Role-Based Access Control in Next.js 15
- 
Authentication & Authorization - Secure authentication with Clerk
- Role-based access control (RBAC)
- Protected routes and API endpoints
 
- 
Core Functionality - Ask and answer questions
- Search users and questions
- Admin dashboard for content moderation
- Real-time updates
 
- Node.js 18+
- npm/yarn
- A Clerk account
- A Neon Database account
- Clone the repository:
git clone https://github.com/tyaga001/clerk-qa-platform
cd clerk-qa-platform- Install dependencies:
npm install- Set up environment variables:
# Create a .env file in the root directory and add:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_publishable_key
CLERK_SECRET_KEY=your_secret_key
NEON_DATABASE_URL=your_database_url- Initialize the database:
npx drizzle-kit push- Start the development server:
npm run devVisit http://localhost:3000 to see the application.
clerk-qa-platform/
├── .idea/                # IDE configuration
├── .next/                # Next.js build output
├── drizzle/              # Drizzle ORM files
├── node_modules/         # Dependencies
├── public/              # Static files
├── src/                 # Source code
│   ├── app/            # Next.js app directory
│   │   ├── admin/      # Admin dashboard
│   │   ├── api/        # API routes
│   │   ├── qa/         # Q&A features
│   │   └── searchUsers/# User search functionality
│   ├── components/     # React components
│   ├── db/            # Database configurations
│   ├── lib/           # Utility libraries
│   ├── types/         # TypeScript types
│   └── utils/         # Utility functions
├── .env               # Environment variables
├── .gitignore        # Git ignore rules
├── favicon.ico       # Site favicon
├── globals.css       # Global styles
├── layout.tsx        # Root layout
├── middleware.ts     # Auth middleware
└── page.tsx          # Root page
The platform implements three main roles:
- Admin: Full access to all features
- Moderator: Can moderate content
- User: Can ask and answer questions
Required environment variables:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
NEON_DATABASE_URL=Contributions are welcome. Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (git checkout -b feature/AmazingFeature)
- Commit your changes (git commit -m 'Add some AmazingFeature')
- Push to the branch (git push origin feature/AmazingFeature)
- Open a Pull Request
This project is licensed under the Creative Commons License - see the LICENSE file for details.

