Skip to content

linardsb/thinking_partner

Repository files navigation

Thinking Partner

An AI-powered thinking partner application that helps users work through problems and ideas through structured conversation with Claude AI.

Features

  • User authentication via Supabase magic links
  • Create and manage thinking sessions
  • Real-time chat interface with Claude AI
  • Persistent conversation history
  • User profiles
  • Mobile-responsive design following professional design principles

Tech Stack

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • Database & Auth: Supabase
  • AI: Anthropic Claude API
  • Deployment: Vercel (recommended)

Prerequisites

  • Node.js 18+ installed
  • Supabase account
  • Anthropic API key

Setup Instructions

1. Install Dependencies

npm install

2. Set Up Supabase

  1. Create a new project at supabase.com
  2. Go to SQL Editor and run the schema from supabase/schema.sql
  3. Copy your project URL and anon key from Settings > API

3. Set Up Environment Variables

Create a .env.local file in the root directory:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
ANTHROPIC_API_KEY=your_anthropic_api_key

4. Run Development Server

npm run dev

Open http://localhost:3000 in your browser.

Database Schema

Tables

profiles

  • id (UUID, references auth.users)
  • display_name (TEXT)
  • occupation (TEXT)
  • bio (TEXT)
  • created_at (TIMESTAMPTZ)
  • updated_at (TIMESTAMPTZ)

sessions

  • id (UUID, primary key)
  • user_id (UUID, references auth.users)
  • title (TEXT)
  • initial_problem (TEXT)
  • status ('active' | 'completed')
  • created_at (TIMESTAMPTZ)
  • updated_at (TIMESTAMPTZ)

messages

  • id (UUID, primary key)
  • session_id (UUID, references sessions)
  • role ('user' | 'assistant')
  • content (TEXT)
  • created_at (TIMESTAMPTZ)

Project Structure

thinking-partner/
├── app/
│   ├── api/
│   │   └── chat/
│   │       └── route.ts          # Claude API integration
│   ├── auth/
│   │   ├── signin/
│   │   │   └── page.tsx          # Sign in page
│   │   └── callback/
│   │       └── route.ts          # Auth callback handler
│   ├── dashboard/
│   │   ├── page.tsx              # Sessions dashboard
│   │   ├── new/
│   │   │   └── page.tsx          # Create new session
│   │   └── session/[id]/
│   │       └── page.tsx          # Chat interface
│   ├── profile/
│   │   └── page.tsx              # User profile
│   ├── page.tsx                  # Landing page
│   ├── layout.tsx                # Root layout
│   └── globals.css               # Global styles
├── components/
│   ├── ui/
│   │   ├── Button.tsx
│   │   ├── Input.tsx
│   │   ├── Textarea.tsx
│   │   ├── Card.tsx
│   │   └── Loading.tsx
│   └── Header.tsx                # App header
├── lib/
│   └── supabase/
│       ├── client.ts             # Client-side Supabase
│       ├── server.ts             # Server-side Supabase
│       └── middleware.ts         # Auth middleware
├── types/
│   └── database.types.ts         # TypeScript types
├── supabase/
│   └── schema.sql                # Database schema
└── middleware.ts                 # Next.js middleware

Key Features Implementation

Authentication

  • Magic link authentication via Supabase
  • Automatic session refresh with middleware
  • Protected routes for authenticated users

Chat System

  • Real-time messaging with Claude AI
  • Conversation history persistence
  • Automatic scrolling to latest message
  • Typing indicators
  • Error handling and retry logic

Design System

  • Mobile-first responsive design
  • Consistent spacing (8px grid system)
  • Typography: Baskerville (body) + Raleway (headers)
  • Color palette: Neutral grays + Teal accent
  • Accessible UI with proper contrast ratios

Deployment to Vercel

  1. Push your code to GitHub
  2. Connect your repository to Vercel
  3. Add environment variables in Vercel dashboard
  4. Deploy

Make sure to configure your Supabase redirect URLs:

  • Development: http://localhost:3000/auth/callback
  • Production: https://your-domain.vercel.app/auth/callback

Design Principles

This project follows a professional design system with:

  • Clean, minimal aesthetics
  • Consistent 8px grid spacing
  • High-contrast, readable typography
  • Subtle shadows and depth
  • Mobile-first responsive layouts
  • Comprehensive loading and error states

See DESIGN_SPEC.md for complete design guidelines.

Environment Variables

Variable Description Required
NEXT_PUBLIC_SUPABASE_URL Your Supabase project URL Yes
NEXT_PUBLIC_SUPABASE_ANON_KEY Your Supabase anonymous key Yes
ANTHROPIC_API_KEY Your Anthropic API key Yes

Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint

Contributing

This is an MVP built to specification. Future enhancements could include:

  • Session templates
  • Export conversation history
  • Analytics dashboard
  • Email notifications
  • Advanced search
  • Session sharing
  • Admin panel

License

MIT

Support

For issues or questions, please open an issue on GitHub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •