Code-Query is a modern Q&A platform, inspired by StackOverflow, built to facilitate knowledge sharing and community engagement. It leverages the power of Next.js 15 for a responsive frontend, PostgreSQL with Prisma for a robust backend, and Google's Gemini AI to provide intelligent assistance.
- Q&A System: Ask questions, provide answers, and engage in threaded discussions (comments).
- Voting Mechanism: Upvote or downvote questions and answers to highlight quality content.
- AI Integration: Utilizes Google Gemini AI to assist users with answers or suggestions.
- Authentication: Secure user authentication and management via NextAuth (Auth.js) and PostgreSQL.
- Responsive Design: Built with TailwindCSS and Next.js for a seamless experience across devices.
- Markdown Support: Write and render rich text content using Markdown.
- Frontend: Next.js 15 (React 19)
- Backend: PostgreSQL, Prisma ORM
- Authentication: NextAuth.js
- Styling: TailwindCSS 4
- AI: Google Gemini
- Language: TypeScript
Follow these steps to set up the project locally.
- Node.js: Version 18 or higher.
- PostgreSQL: A running PostgreSQL instance.
- Gemini API Key: An API key from Google AI Studio.
-
Clone the repository:
git clone https://github.com/yourusername/Code-Query.git cd Code-Query -
Install dependencies:
npm install
-
Create a
.envfile in the root directory. -
Add the following environment variables:
# Database DATABASE_URL="postgresql://user:password@localhost:5432/queryflow?schema=public" # Authentication AUTH_SECRET="your-generated-secret" # Generate with `openssl rand -base64 32` # Gemini Configuration GEMINI_API_KEY=your-gemini-api-key
- Push the schema to your database:
npx prisma db push
Start the development server:
npm run devOpen http://localhost:3000 with your browser to see the result.
app/: App Router pages and layouts.components/: Reusable UI components.models/: Server-side actions (server/) and Prisma configuration.prisma/: Database schema and migrations.auth.ts: NextAuth configuration.public/: Static assets.
Contributions are welcome!
Distributed under the MIT License. See LICENSE for more information.