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 dev
Visit 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.