- Live Demo
- Overview
- Features
- Tech Stack
- High-Level Architecture Diagram
- Project Structure
- Environment Variables
- Local Setup
- License
- Acknowledgments
Creatext AI is a full-stack AI-powered content generation platform built with Next.js 15, Google Gemini, Clerk authentication, and Neon PostgreSQL. It allows users to generate high-quality marketing, social media, and developer content using pre-built AI templates.
- π Secure authentication with Clerk
- π€ AI content generation using Google Gemini
- π 23+ ready-to-use templates
- π³ Credit-based usage system
- π History of generated content
- π° Razorpay subscription billing
- π¨ Modern UI with Tailwind CSS + shadcn/ui
- ποΈ Serverless PostgreSQL with Neon
| Layer | Technology |
|---|---|
| Framework | Next.js 15 (App Router) |
| Language | TypeScript |
| Authentication | Clerk |
| AI Model | Google Gemini |
| Database | Neon PostgreSQL |
| ORM | Drizzle ORM |
| Payments | Razorpay |
| Styling | Tailwind CSS v4 |
| UI | shadcn/ui + Radix |
| Deployment | Vercel |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT (Browser) β
β ββββββββββββ ββββββββββββββββ ββββββββββββββββββββββββββ β
β β Clerk β β Dashboard β β AI Content Editor β β
β β Auth UI β β (Templates) β β (Rich Text + Copy) β β
β ββββββ¬ββββββ ββββββββ¬ββββββββ βββββββββββββ¬βββββββββββββ β
βββββββββΌββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β NEXT.JS APP ROUTER β
β Middleware (auth gate via Clerk) |
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β PAGES / LAYOUTS β β
β β β’ / (Landing Page) β β
β β β’ /sign-in, /sign-up (Clerk) β β
β β β’ /dashboard (Template Gallery) β β
β β β’ /dashboard/content/:slug (AI Generation) β β
β β β’ /dashboard/history (Past Generations) β β
β β β’ /dashboard/billing (Subscription) β β
β β β’ /dashboard/setting (User Settings) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β API ROUTES β β
β β β’ POST /api/create-subscription (Razorpay) β β
β β β’ GET /api/history (DB query - usage history) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β CONTEXT PROVIDERS β β
β β β’ TotalUsageContext β β
β β β’ UpdateCreditUsageContext β β
β β β’ UserSubscriptionContext β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββ¬βββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββ βββββββββββββ βββββββββββββββββββ
β Google β β Neon β β Razorpay β
β Gemini API β β Postgres β β Payment Gateway β
β (AI Model) β β (Drizzle) β β β
ββββββββββββββββ βββββββββββββ βββββββββββββββββββ
ai-content-generator/
βββ app/
β βββ (auth)/ # Clerk auth pages
β βββ (context)/ # Usage & subscription state
β βββ (data)/ # AI templates
β βββ api/ # API routes
β βββ dashboard/ # Main app area
β
βββ components/ui/ # shadcn components
βββ lib/ # Utility functions
βββ utils/ # DB, schema, AI config
βββ public/ # Static assets
βββ middleware.ts # Route protection
βββ package.json
For detailed end-to-end architecture, refer to ARCHITECTURE.md
| Variable | Description | Required |
|---|---|---|
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
Clerk publishable key for client-side | β |
CLERK_SECRET_KEY |
Clerk secret key for server-side | β |
NEXT_PUBLIC_CLERK_SIGN_IN_URL |
Custom sign-in URL path | β |
NEXT_PUBLIC_CLERK_SIGN_UP_URL |
Custom sign-up URL path | β |
NEXT_PUBLIC_GOOGLE_GEMINI_API_KEY |
Google Gemini API key | β |
NEXT_PUBLIC_DRIZZLE_DB_URL |
PostgreSQL connection string | β |
NEXT_PUBLIC_RAZORPAY_KEY_ID |
Razorpay publishable key | β |
RAZORPAY_KEY_SECRET |
Razorpay secret key | β |
- Node.js 18.x or higher
- npm/yarn/pnpm
- PostgreSQL database (Neon account recommended)
- Clerk account
- Google AI Studio API key
- Razorpay account (for payments)
- Docker and Docker Compose (for Docker setup)
- Clone the repository
git clone https://github.com/yourusername/ai-content-generator.git
cd ai-content-generator- Install dependencies
npm install
# or
yarn install
# or
pnpm install- Set up environment variables
Create a .env.local file in the root directory:
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
# Google Gemini AI
NEXT_PUBLIC_GOOGLE_GEMINI_API_KEY=your_gemini_api_key
# Database (Neon PostgreSQL)
NEXT_PUBLIC_DRIZZLE_DB_URL=your_neon_database_url
# Razorpay
NEXT_PUBLIC_RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret- Set up the database
# Generate Drizzle migrations
npm run db:generate
# Run migrations
npm run db:migrate
# (Optional) Push schema directly
npm run db:push- Run the development server
npm run devVisit http://localhost:3000 to see the application.
- Clone the repository
git clone https://github.com/yourusername/ai-content-generator.git
cd ai-content-generator- Set up environment variables
Create a .env.local file in the root directory with all required variables:
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
# Google Gemini AI
NEXT_PUBLIC_GOOGLE_GEMINI_API_KEY=your_gemini_api_key
# Database (Neon PostgreSQL)
NEXT_PUBLIC_DRIZZLE_DB_URL=your_neon_database_url
# Razorpay
NEXT_PUBLIC_RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret- Configure Next.js for standalone output
Ensure your next.config.js includes:
module.exports = {
output: 'standalone',
// ...other config
}- Build and run with Docker Compose
# Build and start the container
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the container
docker-compose down- Access the application
Visit http://localhost:3000 to see the application.
Useful Docker Commands:
# Rebuild the image after code changes
docker-compose up -d --build
# View container status
docker-compose ps
# Execute commands inside the container
docker-compose exec app sh
# Remove containers and volumes
docker-compose down -vThis project is licensed under the MIT License - see the LICENSE file for details.
- Next.js - React framework
- Google Gemini - AI model
- Clerk - Authentication
- Neon - Serverless PostgreSQL
- shadcn/ui - UI components
- Razorpay - Payment gateway