AI-Powered Document Intelligence
Reading that talks back. Think faster. Struggle less.
Upload any document and chat with it—tax forms, insurance policies, contracts, terms & conditions, research papers, manuals. Get instant answers with page citations.
- Multi-Format Support: PDF, DOCX, TXT, RTF, PPTX, CSV, EPUB, HTML (up to 50MB)
- AI Chat: Natural conversations with your documents using GPT-4
- Precise Citations: Every answer includes exact page references
- Smart Chunking: Documents intelligently split for accurate retrieval
- Collections: Organize documents by topic, project, or category
- Favorites: Quick access to your most important files
- Bookmarks: Mark important sections and pages
- Reading List: Queue documents for later review
- Recent Reads: Pick up where you left off
- PDF Reader: Clean, simplistic reader with AI chat side panel
- Chat Sessions: Save and revisit AI conversations
- Document Library: Unlimited documents, all searchable
- Next.js 15 (App Router)
- React 19
- TypeScript
- Tailwind CSS
- Lucide React (Icons)
- Next.js API Routes
- Supabase (Database & Auth)
- OpenAI GPT-4 (AI Chat)
- LangChain.js (AI Framework)
- pgvector (Vector Embeddings)
- Vercel (Deployment)
- Supabase (Backend Services)
- Edge Runtime (API Routes)
├── app/ # Next.js app directory
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication endpoints
│ │ ├── chat/ # Chat and session management
│ │ ├── papers/ # Document upload and management
│ │ ├── health/ # Health check endpoint
│ │ └── metrics/ # Application metrics
│ ├── auth/ # Authentication pages
│ ├── chat/ # Chat interface pages
│ ├── papers/ # Document management pages
│ └── profile/ # User profile pages
├── frontend/ # Frontend components
│ └── components/ # Reusable UI components
├── lib/ # Shared utilities
│ ├── db/ # Database utilities
│ ├── services/ # Business logic services
│ ├── supabase/ # Supabase clients
│ ├── types/ # TypeScript definitions
│ ├── utils/ # Helper utilities
│ └── validation/ # Input validation schemas
├── supabase/ # Database migrations
└── public/ # Static assets
- Node.js 18+
- npm or yarn
- Supabase account
- OpenAI API key
git clone <repository-url>
cd thinkfolio
npm installcp .env.example .env.localFill in .env.local:
# Supabase (Settings > API in Supabase Dashboard)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
# OpenAI (https://platform.openai.com/api-keys)
OPENAI_API_KEY=sk-...
# JWT (Generate: openssl rand -base64 32)
JWT_SECRET=your_jwt_secret_key
NODE_ENV=development- Create a Supabase project at https://supabase.com/dashboard
- Enable
pgvectorextension (Database > Extensions) - Run migrations from
supabase/migrations/ - Create
papersstorage bucket (private)
npm run dev
# Open http://localhost:3000npm run build
npm run typecheck
npm run lintPOST /api/papers/upload- Upload and process documentsPOST /api/chat/sessions/create- Create chat sessionPOST /api/chat/message- Send message to AIGET /api/chat/sessions- Get user's chat sessionsGET /api/health- Health check
- Input validation and sanitization
- Rate limiting on API endpoints
- JWT token authentication
- SQL injection prevention
- File type validation
- User authorization checks
- Secure encrypted storage
ThinkFolio - AI-Powered Document Intelligence