Skip to content

A modern Q&A platform built with Next.js, featuring role-based access control (RBAC) using Clerk. This full-stack app demonstrates enterprise-level authentication, authorization patterns, and responsive UI design.

License

Notifications You must be signed in to change notification settings

tyaga001/clerk-qa-platform

Repository files navigation

Q&A Platform with RBAC

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.

Q&A Platform Screenshot

πŸ“– Complete Tutorial

Want to understand how this platform was built? Check out this complete guide:

Implementing Role-Based Access Control in Next.js 15

image

🌟 Features

  • 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

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm/yarn
  • A Clerk account
  • A Neon Database account

Installation

  1. Clone the repository:
git clone https://github.com/tyaga001/clerk-qa-platform
cd clerk-qa-platform
  1. Install dependencies:
npm install
  1. 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
  1. Initialize the database:
npx drizzle-kit push
  1. Start the development server:
npm run dev

Visit http://localhost:3000 to see the application.

πŸ—οΈ Project Structure

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

πŸ” Role-Based Access Control

The platform implements three main roles:

  • Admin: Full access to all features
  • Moderator: Can moderate content
  • User: Can ask and answer questions

πŸ“ Environment Variables

Required environment variables:

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
NEON_DATABASE_URL=

🀝 Contributing

Contributions are welcome. Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the Creative Commons License - see the LICENSE file for details.

πŸ‘ Acknowledgments

  • Clerk for authentication
  • Neon for the database

About

A modern Q&A platform built with Next.js, featuring role-based access control (RBAC) using Clerk. This full-stack app demonstrates enterprise-level authentication, authorization patterns, and responsive UI design.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages