Skip to content

PostFlow AI is an intelligent LinkedIn post writing platform designed to help users create highly engaging, potentially viral content quickly and efficiently

Notifications You must be signed in to change notification settings

khalidh1b/postflow-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

PostFlow AI

An intelligent LinkedIn post generation platform that leverages AI to create viral content with advanced virality scoring and comprehensive post management.

๐Ÿš€ Features

Core Functionality

  • AI-Powered Post Generation: Generate LinkedIn posts using Google's Gemini AI
  • Virality Score Calculator: Advanced algorithm to predict post performance
  • Post Library: Save and manage your generated posts
  • Customizable Post Configuration: Fine-tune every aspect of your content
  • Real-time Analytics: Track post performance and engagement metrics

Post Customization Options

  • Post Types: Insight, Story, Question, Announcement, Tutorial
  • Tone Variations: Professional, Casual, Inspirational, Humorous, Technical
  • Length Options: Short, Medium, Long posts
  • Format Styles: Standard, Numbered List, Bullet Points, Q&A
  • Hook Styles: Question, Statistic, Story, Bold Statement
  • CTA Types: Engagement, Visit Link, Follow, Comment, Share
  • Hashtag Strategies: Minimal, Moderate, Extensive

User Features

  • Authentication: Secure user login/registration with Better Auth
  • Usage Tracking: Monitor post generation limits and usage patterns
  • Feedback System: Collect user feedback and bug reports
  • Responsive Design: Mobile-first design with Tailwind CSS

๐Ÿ› ๏ธ Technology Stack

Frontend

  • Next.js 16: React framework with App Router
  • React 19: Latest React version with hooks and context
  • TypeScript: Type-safe development
  • Tailwind CSS 4: Utility-first CSS framework
  • Radix UI: Accessible component library
  • React Hook Form: Form management with Zod validation
  • Framer Motion: Animations and transitions

Backend & Database

  • Next.js API Routes: Serverless API endpoints
  • Drizzle ORM: Type-safe SQL toolkit
  • LibSQL: Lightweight SQLite database
  • Better Auth: Authentication solution

AI & External Services

  • Google Gemini AI: Content generation
  • Zod: Schema validation

๐Ÿ“ฆ Installation

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm/yarn

Setup

  1. Clone the repository
git clone <https://github.com/khalidh1b/postflow-ai.git>
cd postflow-ai
  1. Install dependencies
pnpm install
  1. Environment Variables Create a .env.local file in the root directory:
# Database
DATABASE_URL="file:./dev.db"

# AI Service
GEMINI_API_KEY="your-google-gemini-api-key"

# Authentication (Better Auth)
BETTER_AUTH_SECRET="your-auth-secret"
BETTER_AUTH_URL="http://localhost:3000"

# Optional: OAuth Providers
AUTH_GOOGLE_ID="your-google-oauth-id"
AUTH_GOOGLE_SECRET="your-google-oauth-secret"
  1. Database Setup
# Run database migrations
pnpm drizzle-kit push

# (Optional) Generate migrations
pnpm drizzle-kit generate
  1. Start Development Server
pnpm dev

Open http://localhost:3000 to view the application.

๐Ÿ—๏ธ Project Structure

src/
โ”œโ”€โ”€ app/                    # Next.js App Router
โ”‚   โ”œโ”€โ”€ api/               # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ auth/          # Authentication endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ generate-post/ # Post generation API
โ”‚   โ”‚   โ”œโ”€โ”€ feedback/      # Feedback system
โ”‚   โ”‚   โ””โ”€โ”€ posts/         # Post management
โ”‚   โ”œโ”€โ”€ login/             # Login page
โ”‚   โ”œโ”€โ”€ register/          # Registration page
โ”‚   โ”œโ”€โ”€ pricing/           # Pricing page
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ components/            # React components
โ”‚   โ”œโ”€โ”€ ui/               # Reusable UI components
โ”‚   โ”œโ”€โ”€ auth/             # Authentication components
โ”‚   โ”œโ”€โ”€ post-generator/   # Post generation components
โ”‚   โ”œโ”€โ”€ layout/           # Layout components
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ db/                   # Database schema and configuration
โ”œโ”€โ”€ lib/                  # Utility functions and configurations
โ”œโ”€โ”€ hooks/                # Custom React hooks
โ”œโ”€โ”€ contexts/             # React contexts
โ””โ”€โ”€ types/                # TypeScript type definitions

๐Ÿ”ง Available Scripts

# Development
pnpm dev              # Start development server with Turbopack
pnpm build            # Build for production
pnpm start            # Start production server
pnpm lint             # Run ESLint

# Database
pnpm drizzle-kit push     # Push schema changes to database
pnpm drizzle-kit generate # Generate migration files
pnpm drizzle-kit studio   # Open Drizzle Studio

๐ŸŽฏ Core Components

Post Generation Flow

  1. Configuration Form: Users customize post parameters
  2. AI Processing: Gemini AI generates content based on configuration
  3. Virality Scoring: Algorithm calculates potential performance
  4. Preview & Edit: Users can review and modify generated content
  5. Save to Library: Posts are stored for future reference

API Endpoints

POST /api/generate-post

Generates a LinkedIn post with virality scoring.

Authentication Endpoints

  • POST /api/auth/sign-in - User login
  • POST /api/auth/sign-up - User registration
  • POST /api/auth/sign-out - User logout

๐ŸŽจ UI Components

The application uses a comprehensive component library built with:

  • Radix UI: For accessible primitives
  • Tailwind CSS: For styling
  • Lucide React: For icons
  • Framer Motion: For animations

Key UI components include:

  • Form controls with validation
  • Post configuration sections
  • Virality score displays
  • Post library management
  • Responsive navigation

๐Ÿ” Authentication

Implemented using Better Auth with:

  • Email/password authentication
  • Session management
  • Protected routes
  • User profile management

๐Ÿ“Š Database Schema

Core Tables

  • users: User accounts and profiles
  • sessions: Authentication sessions
  • posts: Generated LinkedIn posts with metadata
  • user_feedback: User feedback and bug reports
  • usage_tracking: Post generation usage limits

๐Ÿš€ Deployment

Vercel (Recommended)

  1. Connect your repository to Vercel
  2. Configure environment variables
  3. Deploy automatically on push to main branch

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and commit: git commit -m "Add feature"
  4. Push to the branch: git push origin feature-name
  5. Submit a pull request

๐Ÿ“ License

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

๐Ÿ†˜ Support

For support and feedback:

  • Use the in-app feedback system
  • Report issues on GitHub

๐Ÿ”ฎ Roadmap

  • Advanced analytics dashboard
  • Post scheduling feature
  • Multi-platform support (Twitter, Facebook)
  • Team collaboration features
  • Advanced AI model options
  • A/B testing for posts
  • Template library
  • Export functionality

Built with โค๏ธ using Next.js, TypeScript, and Gemini AI.