Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
28cce3c
feat: integrate Supabase with NextAuth for user authentication and AI…
dineshxr Jul 30, 2025
b794c82
refactor: simplify middleware to handle i18n only and remove auth logic
dineshxr Jul 30, 2025
9f4d3af
Fix NextAuth session type and user ID handling
dineshxr Jul 30, 2025
4efadb0
Fix build errors: add errorMessage support and disable old auth imports
dineshxr Jul 30, 2025
b74d71c
Fix AI usage route: update to NextAuth and remove missing functions
dineshxr Jul 30, 2025
670c3fd
Fix all remaining auth imports: replace Better Auth with NextAuth in …
dineshxr Jul 30, 2025
0d4862d
Fix TypeScript errors in checkout session: handle undefined email and…
dineshxr Jul 30, 2025
8d6c8f8
Fix TypeScript errors: add role property to NextAuth types and session
dineshxr Jul 30, 2025
f77c78e
Fix admin functionality: disable Better Auth admin features, simplify…
dineshxr Jul 30, 2025
5350e04
refactor: migrate auth system from Better Auth to NextAuth.js with Go…
dineshxr Aug 5, 2025
d4d211c
chore: update flowchartai submodule reference to dirty state
dineshxr Sep 5, 2025
fff87b8
Merge remote changes while preserving Google-only auth and Infogiph b…
dineshxr Sep 6, 2025
8396d60
chore: mark flowchartai submodule as dirty
dineshxr Sep 6, 2025
c95ca21
chore: restructure project - move flowchartai to root directory
dineshxr Sep 6, 2025
d0c1de5
fix: remove duplicate @supabase/supabase-js dependency
dineshxr Sep 6, 2025
40fbc84
ikkk
dineshxr Sep 6, 2025
f0cfac9
fix: update vercel.json for new project structure
dineshxr Sep 6, 2025
ecb9a2b
feat: allow git push commands in approved bash operations list
dineshxr Sep 6, 2025
43acb98
fix: update pnpm-lock.yaml to resolve dependency mismatch
dineshxr Sep 6, 2025
49ee54b
refactor: migrate from better-auth to next-auth for authentication
dineshxr Sep 6, 2025
92b4c75
feat: migrate from better-auth to next-auth
dineshxr Sep 6, 2025
2991950
feat: add customizable title, description and placeholder props to Fl…
dineshxr Sep 6, 2025
0e8d98f
Fix deployment errors: NextAuth config, CDN resources, and CORS
dineshxr Sep 6, 2025
ab0baf4
feat: add CORS headers for API routes and domain redirects to infogip…
dineshxr Sep 6, 2025
48592f1
chore: disable AdSense, update auth paths and manifest URL, and comme…
dineshxr Sep 6, 2025
4b2f39a
feat: add offline mode with mock responses when database is unavailable
dineshxr Sep 7, 2025
f99a68a
feat: enable Vercel Analytics and Speed Insights for production monit…
dineshxr Sep 12, 2025
37edc85
feat: replace Bricolage font with Gambarino and update landing page s…
dineshxr Sep 13, 2025
8dd6be9
merge: upstream main into main
dineshxr Dec 8, 2025
55166a5
Merge upstream/main
dineshxr Jan 27, 2026
ad3d547
feat: Rebrand FlowChart AI to InfoGiph across all user-facing text an…
dineshxr Jan 27, 2026
370a112
Merge origin/main into local with InfoGiph branding
dineshxr Jan 27, 2026
ddc243b
fix: Remove broken flowchart-ai-generator page and corrupted Gambarin…
dineshxr Jan 27, 2026
d2fde57
fix: Resolve build issues (NextConfig, Auth, Dependencies)
dineshxr Jan 27, 2026
cbc8250
Refactor Excalidraw export functionality, enhance flowchart creation …
dineshxr Jan 27, 2026
feeebbe
fix: comprehensive TypeScript errors for Vercel deployment
dineshxr Jan 28, 2026
cb69b15
feat: Implement AI-powered FlowViz Architect for diagram generation, …
dineshxr Mar 3, 2026
392d31c
fix: homepage query → canvas → auth → animation flow
dineshxr Mar 3, 2026
44a2c84
fix: move dynamic import with ssr:false into client component for can…
dineshxr Mar 3, 2026
d68b387
fix: resolve www vs non-www CORS issue for auth requests
dineshxr Mar 3, 2026
8a4bf15
refactor: migrate authentication from custom components and better-au…
dineshxr Mar 12, 2026
b07f848
feat: Implement new marketing page sections, add GIF export functiona…
dineshxr Mar 12, 2026
607bd3b
chore: Remove unused dependencies and enable Vercel Analytics.
dineshxr Mar 12, 2026
94cfc9e
chore: Remove numerous UI components, Magic UI elements, Tailark prev…
dineshxr Mar 12, 2026
9334760
fix: resolve hero overlap and improve SEO across the site
dineshxr Mar 31, 2026
d3fc045
feat: modernize canvas UI and add animated gallery diagrams
dineshxr Mar 31, 2026
5883353
fix: add size parameter to getIcon function
dineshxr Mar 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
56 changes: 50 additions & 6 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,57 @@
{
"permissions": {
"allow": [
"Bash(ls:*)",
"WebFetch(domain:cdn.flowchartai.org)",
"Bash(curl:*)",
"Bash(identify:*)",
"Bash(npm i:*)",
"Bash(git clone:*)",
"Bash(pnpm install:*)",
"Bash(brew install:*)",
"Bash(convert:*)",
"Bash(tree:*)"
"Bash(export:*)",
"Bash(brew services start:*)",
"Bash(createdb:*)",
"Bash(pnpm db:generate:*)",
"Bash(pnpm db:migrate:*)",
"Bash(pnpm dev:*)",
"Bash(node:*)",
"Bash(nvm install:*)",
"Bash(nvm use:*)",
"Bash(source:*)",
"Bash(lsof:*)",
"Bash(PORT=3001 pnpm dev)",
"Bash(PORT=3005 pnpm dev)",
"Bash(pnpm add:*)",
"Bash(nvm list:*)",
"Bash(curl:*)",
"Bash(kill:*)",
"Bash(PORT=4000 pnpm dev)",
"Bash(timeout:*)",
"Bash(gtimeout:*)",
"Bash(pnpm lint:*)",
"Bash(npm run dev:*)",
"Bash(pnpm init-supabase:*)",
"Bash(NEXT_PUBLIC_SUPABASE_URL=\"https://edmyvuutyhkwxmvsesxd.supabase.co\" NEXT_PUBLIC_SUPABASE_ANON_KEY=\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImVkbXl2dXV0eWhrd3htdnNlc3hkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTcxMTE4NzMsImV4cCI6MjA3MjY4Nzg3M30.0zwVoYcr7X9m4M8QQpDf9IVTulxFFTs-gD7IdxlG-TU\" SUPABASE_SERVICE_ROLE_KEY=\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImVkbXl2dXV0eWhrd3htdnNlc3hkIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc1NzExMTg3MywiZXhwIjoyMDcyNjg3ODczfQ.f97IuM7hbazHYoXJnKogfVMZE1Dz6nfddm3FQ_L5OWY\" pnpm init-supabase)",
"Bash(git config:*)",
"Bash(git pull:*)",
"Bash(git rm:*)",
"Bash(git checkout:*)",
"Bash(git add:*)",
"Bash(git commit:*)",
"Bash(git push:*)",
"Bash(psql:*)",
"Bash(claude mcp:*)",
"Bash(grep:*)",
"Bash(ls:*)",
"Bash(npx tsc:*)",
"mcp__playwright__browser_wait_for",
"mcp__playwright__browser_navigate",
"mcp__playwright__browser_type",
"mcp__playwright__browser_snapshot",
"mcp__playwright__browser_click",
"mcp__playwright__browser_evaluate",
"mcp__playwright__browser_console_messages",
"mcp__playwright__browser_close",
"Bash(find:*)",
"Bash(pnpm remove:*)",
"Bash(pnpm build:*)"
],
"deny": [],
"ask": []
Expand Down
4 changes: 4 additions & 0 deletions .cursor/mcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
},
"magic-ui": {
"command": "npx",
"args": ["-y", "@magic-ui/mcp@latest"]
}
}
}
2 changes: 2 additions & 0 deletions .playwright-mcp/console-2026-03-03T03-46-26-508Z.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[ 11392ms] [WARNING] Please ensure that the container has a non-static position, like 'relative', 'fixed', or 'absolute' to ensure scroll offset is calculated correctly. @ webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/framer-motion@12.4.7_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/framer-motion/dist/es/utils/warn-once.mjs:8
[ 17103ms] [ERROR] Failed to load resource: the server responded with a status of 404 (Not Found) @ http://localhost:3000/api/auth/get-session:0
1 change: 1 addition & 0 deletions .playwright-mcp/console-2026-03-03T03-47-40-165Z.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ 2713ms] [ERROR] Failed to load resource: the server responded with a status of 404 (Not Found) @ http://localhost:3000/api/auth/get-session:0
113 changes: 113 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

FlowChart AI is an open-source, AI-powered flowchart generator built with Next.js 15. It transforms natural language descriptions into professional, editable diagrams using an Excalidraw-based canvas. The codebase is split into two main directories:

- `flowchartai/` - Main Next.js application
- Root directory contains legacy/removed files (marked as deleted in git status)

## Development Commands

Run all commands from the `flowchartai/` directory:

```bash
# Development
pnpm dev # Start development server with content collections watch
pnpm build # Build for production (includes content collections build)
pnpm start # Start production server

# Code Quality
pnpm lint # Check and auto-fix with Biome
pnpm lint:fix # Fix with unsafe transformations
pnpm format # Format code with Biome

# Database
pnpm db:generate # Generate Drizzle schema
pnpm db:migrate # Run database migrations
pnpm db:push # Push schema changes directly
pnpm db:studio # Open Drizzle Studio

# Content & Email
pnpm docs # Build content collections
pnpm email # Start email development server on port 3333

# Deployment (Cloudflare Workers)
pnpm preview # Build and preview
pnpm deploy # Build and deploy
pnpm upload # Build and upload
pnpm cf-typegen # Generate Cloudflare types
```

## Architecture

### Tech Stack
- **Frontend**: Next.js 15 (App Router), React 19, TypeScript 5
- **Styling**: Tailwind CSS 4, Radix UI components
- **Canvas**: Excalidraw integration with Mermaid support
- **AI**: OpenRouter API (multiple AI models supported)
- **Database**: PostgreSQL with Drizzle ORM
- **Authentication**: Better Auth (Google, GitHub OAuth)
- **Storage**: Cloudflare R2 / AWS S3 compatible
- **Content**: Content Collections for MDX processing
- **Email**: React Email templates
- **Deployment**: Vercel, Cloudflare Workers, or self-hosted

### Key Directory Structure
```
flowchartai/
├── src/
│ ├── app/ # Next.js App Router pages
│ ├── components/ # React components (UI components in ui/)
│ ├── db/ # Drizzle schema and migrations
│ ├── lib/ # Utility functions and configurations
│ ├── mail/ # React Email templates
│ └── config/ # Application configuration
├── content/ # MDX content for docs/blog
├── public/ # Static assets
└── messages/ # i18n message files
```

### Import Paths
- `@/*` maps to `./src/*`
- `@/content/*` maps to `./content/*`
- `@/public/*` maps to `./public/*`
- `content-collections` maps to `./.content-collections/generated`

## Configuration Notes

### Environment Setup
The application requires several environment variables for full functionality:
- Database connection (PostgreSQL)
- OpenRouter API key for AI features
- OAuth credentials (Google/GitHub)
- Optional: Cloudflare R2/AWS S3 for file storage
- Optional: Resend API for email notifications

### AI Models
Default model is `google/gemini-2.5-flash` but supports multiple providers through OpenRouter. Model configuration is in `src/app/api/ai/chat/flowchart/route.ts`.

### Feature Toggles
Feature flags are configurable in `src/config/website.tsx` for docs pages, AI pages, upgrade cards, and Discord widgets.

### Usage Limits
AI generation limits are configurable in `src/lib/ai-usage.ts`:
- Free tier: 1 AI generation per day per user
- Paid tiers: 500-1000 generations per month

## Development Notes

- Uses Biome for linting and formatting (not ESLint/Prettier)
- Content Collections for MDX processing with watch mode in development
- Database operations use Drizzle ORM with PostgreSQL
- Images are unoptimized for Cloudflare Workers compatibility
- Supports both Vercel and Cloudflare Workers deployment
- Multi-language support via next-intl

## Testing & Quality

- Run `pnpm lint` before committing to ensure code quality
- Database schema changes require `pnpm db:generate` after modification
- Content changes trigger automatic rebuilds in development mode
151 changes: 151 additions & 0 deletions SUPABASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Supabase Integration for Infogiph

This project now supports Supabase for authentication, storage, and database hosting, making it perfect for deployment on Vercel.

## Features

- ✅ **Hybrid Authentication**: Better Auth with Supabase database support
- ✅ **Supabase Storage**: File uploads and storage using Supabase buckets
- ✅ **Google OAuth**: One-tap login with Google integration
- ✅ **Vercel Ready**: Optimized for Vercel deployment

## Quick Setup

### 1. Environment Variables

Add these to your `.env.local`:

```bash
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL="https://your-project.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-anon-key"
SUPABASE_SERVICE_ROLE_KEY="your-service-role-key"

# Google OAuth
NEXT_PUBLIC_GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
```

### 2. Initialize Supabase

```bash
pnpm init-supabase
```

### 3. Manual Setup

Follow the detailed setup guide in [`scripts/setup-supabase.md`](./scripts/setup-supabase.md)

## Architecture

### Authentication Flow

1. **Better Auth** handles the authentication logic and session management
2. **Supabase** provides the OAuth provider integration and optionally the database
3. **Google One Tap** provides seamless login experience

### Storage Flow

1. Files are uploaded to **Supabase Storage** buckets
2. Public URLs are generated for file access
3. Pre-signed URLs are used for large file uploads

### Database Options

You can choose between:

1. **Local PostgreSQL** (development) + **Supabase** (storage + auth)
2. **Full Supabase** (database + storage + auth)

## Components

### Storage Provider

The `SupabaseProvider` implements the storage interface:

- `uploadFile()` - Direct file upload
- `getPresignedUploadUrl()` - For large files
- `deleteFile()` - Remove files
- `createBucket()` - Initialize storage

### Authentication

- Better Auth configuration with Google OAuth
- Conditional Google One Tap based on environment variables
- Auto-newsletter subscription on signup

## Deployment

### Vercel Deployment

1. Connect your GitHub repository to Vercel
2. Add all environment variables in Vercel dashboard
3. Deploy!

The app will automatically:
- Use Supabase for storage and authentication
- Enable Google OAuth and One Tap login
- Support file uploads and sharing

### Environment Variables for Vercel

Make sure to add these in your Vercel project settings:

```bash
# Database (can be Supabase or external PostgreSQL)
DATABASE_URL="your-database-connection-string"

# Supabase
NEXT_PUBLIC_SUPABASE_URL="https://your-project.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-anon-key"
SUPABASE_SERVICE_ROLE_KEY="your-service-role-key"

# Authentication
BETTER_AUTH_SECRET="your-random-secret-key"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
NEXT_PUBLIC_GOOGLE_CLIENT_ID="your-google-client-id"

# AI Service
OPENROUTER_API_KEY="your-openrouter-api-key"

# Base URL (will be set automatically by Vercel)
NEXT_PUBLIC_BASE_URL="https://your-app.vercel.app"
```

## Benefits

### Why Supabase + Better Auth?

1. **Best of Both Worlds**: Better Auth's flexibility with Supabase's infrastructure
2. **Vercel Optimized**: Perfect for serverless deployment
3. **Scalable Storage**: Supabase handles file storage at scale
4. **Google Integration**: Seamless OAuth and One Tap login
5. **Cost Effective**: Supabase free tier is generous for startups

### Migration from S3

The project maintains backward compatibility. You can switch between storage providers by updating:

```typescript
// In src/config/website.tsx
storage: {
provider: 'supabase', // or 's3'
},
```

## Troubleshooting

### Common Issues

1. **Missing Environment Variables**: Check all variables are set correctly
2. **Google OAuth**: Ensure redirect URIs match exactly
3. **Storage Bucket**: Must be public for file sharing
4. **Database Connection**: Verify Supabase connection string format

### Support

- Check the setup guide: [`scripts/setup-supabase.md`](./scripts/setup-supabase.md)
- Run diagnostics: `pnpm init-supabase`
- View Supabase logs in the dashboard
12 changes: 7 additions & 5 deletions content-collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,13 @@ export const posts = defineCollection({
const slugAsParams = base;

// Calculate estimated reading time only if not provided in frontmatter
const estimatedTime = data.estimatedTime || (() => {
const wordCount = data.content.split(/\s+/).length;
const wordsPerMinute = 200; // average reading speed: 200 words per minute
return Math.max(Math.ceil(wordCount / wordsPerMinute), 1);
})();
const estimatedTime =
data.estimatedTime ||
(() => {
const wordCount = data.content.split(/\s+/).length;
const wordsPerMinute = 200; // average reading speed: 200 words per minute
return Math.max(Math.ceil(wordCount / wordsPerMinute), 1);
})();

return {
...data,
Expand Down
Loading