Skip to content

About

Creatext AI is a full-stack AI-powered content generation platform built with Next.js 15, Google Gemini, Clerk authentication, and Neon PostgreSQL. It enables users to generate high-quality marketing, social media, and developer content using pre-built AI templates.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Creatext AI β€” AI Content Generator

πŸ“š Table of Contents

🌐 Live Demo

Visit CreatextAI β†’

πŸ“Œ Overview

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.

✨ Features

  • πŸ” 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

🧱 Tech Stack

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

High-Level Architecture Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        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) β”‚  β”‚                 β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

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


Environment Variables

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 βœ…

Local Setup

Prerequisites

- 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)

Installation Steps

Option 1: Standard Setup

  1. Clone the repository
git clone https://github.com/yourusername/ai-content-generator.git
cd ai-content-generator
  1. Install dependencies
npm install
# or
yarn install
# or
pnpm install
  1. 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
  1. 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
  1. Run the development server
npm run dev

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


Option 2: Docker Setup

  1. Clone the repository
git clone https://github.com/yourusername/ai-content-generator.git
cd ai-content-generator
  1. 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
  1. Configure Next.js for standalone output

Ensure your next.config.js includes:

module.exports = {
  output: 'standalone',
  // ...other config
}
  1. 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
  1. 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 -v

πŸ“„ License

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


πŸ™ Acknowledgments


About

Creatext AI is a full-stack AI-powered content generation platform built with Next.js 15, Google Gemini, Clerk authentication, and Neon PostgreSQL. It enables users to generate high-quality marketing, social media, and developer content using pre-built AI templates.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages