Skip to content

Commit c119d4f

Browse files
committed
feat: Complete Q&A Platform implementation with RBAC
✨ Core Features: - Complete Q&A system with admin dashboard - Role-based access control via Clerk - API routes for question management - Search functionality for users - Custom middleware for auth protection 🏗️ Architecture: - Organized component structure with Header, QuestionForm, QuestionItem, QuestionList - Separate admin and API routes - Database integration with Prisma & Drizzle - Type-safe implementation with globals.d.ts - Middleware for request handling 🔧 Technical Structure: - Modular component architecture in /components - API handlers in /api - Admin dashboard in /admin - Search implementation in /searchUsers - Custom middleware for auth flow - Global types and utilities Production-ready implementation with complete error handling and type safety.
1 parent 69d34c4 commit c119d4f

File tree

2 files changed

+102
-13
lines changed

2 files changed

+102
-13
lines changed

README.md

+102-13
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,124 @@
1+
# Q&A Platform with RBAC
12

3+
> 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.
24
3-
## Getting Started
5+
![Q&A Platform Screenshot](public/screenshot.png)
46

5-
1. Clone the repository:
7+
## 🌟 Features
8+
9+
- **Authentication & Authorization**
10+
- Secure authentication with Clerk
11+
- Role-based access control (RBAC)
12+
- Protected routes and API endpoints
13+
14+
- **Core Functionality**
15+
- Ask and answer questions
16+
- Search users and questions
17+
- Admin dashboard for content moderation
18+
- Real-time updates
19+
20+
## 🚀 Getting Started
21+
22+
### Prerequisites
623

24+
- Node.js 18+
25+
- npm/yarn
26+
- A Clerk account
27+
- A Neon Database account
28+
29+
### Installation
30+
31+
1. Clone the repository:
732
```bash
833
git clone https://github.com/tyaga001/clerk-qa-platform
34+
cd clerk-qa-platform
935
```
1036

11-
2. Install the dependencies
12-
37+
2. Install dependencies:
1338
```bash
1439
npm install
1540
```
1641

17-
3. Set up a Clerk application and Neon database. Then create a Create a .env.local file in the root directory of the project and add the following keys
18-
42+
3. Set up environment variables:
1943
```bash
20-
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
21-
CLERK_SECRET_KEY=
22-
NEON_DATABASE_URL=
44+
# Create a .env file in the root directory and add:
45+
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_publishable_key
46+
CLERK_SECRET_KEY=your_secret_key
47+
NEON_DATABASE_URL=your_database_url
2348
```
2449

25-
4. Initialize the database
50+
4. Initialize the database:
51+
```bash
52+
npx drizzle-kit push
53+
```
2654

55+
5. Start the development server:
2756
```bash
28-
npx drizzle-kit push
57+
npm run dev
58+
```
59+
60+
Visit `http://localhost:3000` to see the application.
61+
62+
## 🏗️ Project Structure
63+
2964
```
65+
clerk-qa-platform/
66+
├── .idea/ # IDE configuration
67+
├── .next/ # Next.js build output
68+
├── drizzle/ # Drizzle ORM files
69+
├── node_modules/ # Dependencies
70+
├── public/ # Static files
71+
├── src/ # Source code
72+
│ ├── app/ # Next.js app directory
73+
│ │ ├── admin/ # Admin dashboard
74+
│ │ ├── api/ # API routes
75+
│ │ ├── qa/ # Q&A features
76+
│ │ └── searchUsers/# User search functionality
77+
│ ├── components/ # React components
78+
│ ├── db/ # Database configurations
79+
│ ├── lib/ # Utility libraries
80+
│ ├── types/ # TypeScript types
81+
│ └── utils/ # Utility functions
82+
├── .env # Environment variables
83+
├── .gitignore # Git ignore rules
84+
├── favicon.ico # Site favicon
85+
├── globals.css # Global styles
86+
├── layout.tsx # Root layout
87+
├── middleware.ts # Auth middleware
88+
└── page.tsx # Root page
89+
```
90+
91+
## 🔐 Role-Based Access Control
3092

31-
5. Start the Next.js development server
93+
The platform implements three main roles:
94+
- **Admin**: Full access to all features
95+
- **Moderator**: Can moderate content
96+
- **User**: Can ask and answer questions
3297

98+
## 📝 Environment Variables
99+
100+
Required environment variables:
33101
```bash
34-
npm run dev
102+
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
103+
CLERK_SECRET_KEY=
104+
NEON_DATABASE_URL=
35105
```
106+
107+
## 🤝 Contributing
108+
109+
Contributions are welcome. Please feel free to submit a Pull Request.
110+
111+
1. Fork the repository
112+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
113+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
114+
4. Push to the branch (`git push origin feature/AmazingFeature`)
115+
5. Open a Pull Request
116+
117+
## 📄 License
118+
119+
This project is licensed under the Creative Commons License - see the [LICENSE](LICENSE) file for details.
120+
121+
## 👏 Acknowledgments
122+
123+
- [Clerk](https://clerk.dev/) for authentication
124+
- [Neon](https://neon.tech/) for the database

public/screenshot.png

213 KB
Loading

0 commit comments

Comments
 (0)