Transform your study materials into AI-powered summaries, flashcards, and quizzes
Features β’ Demo β’ Installation β’ Configuration β’ Deployment
Studia is a modern, full-stack SaaS application that leverages AI to help students and professionals transform their study materials into multiple learning formats. Upload text or PDF files and instantly generate:
- π Summaries - Concise overviews of your content
- π Bullet Points - Key takeaways and important points
- π΄ Flashcards - Interactive study cards with flip animations
- π Quizzes - Multiple-choice questions to test knowledge
Built with the latest web technologies and designed for scalability, reliability, and an exceptional user experience.
- π€ AI-Powered Generation - Multiple output formats from a single input
- π PDF Support - Upload and process PDF documents
- πΎ History Management - Access and manage all your generated notes
- π Advanced Filtering - Filter by type, status, and search by content
- π₯ Export Options - Download notes as PDF or copy to clipboard
- π¨ Interactive UI - Beautiful, animated components with smooth transitions
- π Secure Authentication - Powered by Clerk with social login support
- π― Type-Safe - Full TypeScript implementation
- π± Responsive Design - Works seamlessly on all devices
- π Dark Mode - Complete dark theme support with next-themes
- β‘ Fast Performance - Optimized with Next.js 16 App Router
- π Smart AI Fallback - 4 free AI models with automatic fallback
- π³ Optional Paid Models - Support for premium AI models
- π Custom Cursor - Engaging custom cursor animation
- βΏ Accessible - Built with accessibility best practices
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- UI Library: React 19
- Styling: Tailwind CSS 4
- Animations: Framer Motion
- Icons: Lucide React
- Components: Radix UI
- Theme: next-themes
- Database: PostgreSQL
- ORM: Prisma
- Authentication: Clerk
- AI Provider: OpenRouter
- PDF Processing: pdf2json
- PDF Generation: jsPDF
- Package Manager: pnpm
- Linting: ESLint
- Code Formatting: Prettier (implicit via ESLint config)
Before you begin, ensure you have the following installed:
- Node.js 20.x or higher
- pnpm (recommended) or npm/yarn
- PostgreSQL database
- Git
-
Clone the repository
git clone https://github.com/Mahdi-jafari-CS/ai-notes-saas.git cd ai-notes-saas -
Install dependencies
pnpm install
-
Set up environment variables
cp .env.example .env
-
Configure your
.envfile (see Configuration below) -
Set up the database
# Push the Prisma schema to your database pnpm prisma db push # Generate Prisma Client pnpm prisma generate
-
Run the development server
pnpm dev
-
Open your browser Navigate to http://localhost:3000
Create a .env file in the root directory with the following variables:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/studia_db"
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
CLERK_SECRET_KEY="sk_test_..."
# OpenRouter AI
OPENROUTER_API_KEY="sk-or-v1-..."
# Optional: Use a paid model for better reliability
# OPENROUTER_PREFERRED_MODEL="google/gemini-pro"- Local: Install PostgreSQL and create a database
- Cloud: Use services like:
- Sign up at clerk.com
- Create a new application
- Copy your publishable and secret keys
- Configure sign-in/sign-up pages in Clerk dashboard
- Sign up at openrouter.ai
- Add credits or use free models
- Generate an API key from your dashboard
Free Models Available:
meta-llama/llama-3.2-3b-instruct:freegoogle/gemma-2-9b-it:freemicrosoft/phi-3-mini-128k-instruct:freeqwen/qwen-2-7b-instruct:free
Recommended Paid Models:
google/gemini-pro(Fast, affordable, high quality)anthropic/claude-3-5-sonnet(Best quality)openai/gpt-4o(Excellent quality)
ai-notes-saas/
βββ app/ # Next.js App Router
β βββ api/ # API Routes
β β βββ ai/generate/ # AI generation endpoint
β β βββ history/ # Fetch user history
β β βββ notes/ # CRUD operations for notes
β β βββ parse-pdf/ # PDF parsing endpoint
β βββ dashboard/ # Protected dashboard pages
β β βββ history/ # History view page
β β βββ page.tsx # Main dashboard
β βββ sign-in/ # Clerk sign-in page
β βββ sign-up/ # Clerk sign-up page
β βββ layout.tsx # Root layout
β βββ page.tsx # Landing page
β βββ globals.css # Global styles
β
βββ components/ # React components
β βββ dashboard/ # Dashboard-specific components
β β βββ DashboardClient.tsx
β β βββ DashboardNavbar.tsx
β β βββ FlashcardsDisplay.tsx
β β βββ QuizDisplay.tsx
β β βββ HistorySection/
β βββ landing/ # Landing page sections
β β βββ HeroSection.tsx
β β βββ FeaturesSection.tsx
β β βββ ...
β βββ ui/ # Reusable UI components
β β βββ button.tsx
β β βββ input.tsx
β β βββ pointer.tsx # Custom cursor
β β βββ ...
β βββ theme-provider.tsx # Dark mode provider
β
βββ lib/ # Utility functions & services
β βββ db.ts # Prisma client
β βββ openrouter.ts # AI service with fallback
β βββ notes-service.ts # Notes CRUD operations
β βββ pdf-parser.ts # PDF processing
β βββ pdf-generator.ts # PDF export
β βββ utils.ts # Helper functions
β
βββ prisma/
β βββ schema.prisma # Database schema
β
βββ public/ # Static assets
βββ middleware.ts # Clerk authentication middleware
βββ package.json
βββ tsconfig.json
βββ tailwind.config.ts
Generate AI content from input text.
Request Body:
{
"inputText": "Your study material here...",
"outputType": "summary" | "bullets" | "flashcards" | "quiz"
}Response:
{
"success": true,
"output": "Generated content...",
"model": "meta-llama/llama-3.2-3b-instruct:free"
}Parse PDF file and extract text content.
Request: FormData with file field
Create a new note in the database.
Fetch all notes for authenticated user.
model User {
id String @id @default(cuid())
clerkUserId String @unique
email String @unique
name String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
notes Note[]
}
model Note {
id String @id @default(cuid())
userId String
title String?
inputText String
inputType String // "text" or "pdf"
fileName String?
outputType String? // "summary", "bullets", "flashcards", "quiz"
outputText String?
status String @default("pending")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
}-
Push to GitHub
git add . git commit -m "Ready for deployment" git push origin main
-
Import to Vercel
- Go to vercel.com
- Click "Import Project"
- Select your repository
- Configure environment variables
- Deploy!
-
Set Environment Variables Add all variables from your
.envfile to Vercel's environment settings. -
Update Clerk URLs In your Clerk dashboard, add your Vercel domain to allowed origins.
See DEPLOYMENT.md for detailed deployment instructions for:
- Railway
- Render
- DigitalOcean
- AWS
pnpm dev # Start development server
pnpm build # Build for production
pnpm start # Start production server
pnpm lint # Run ESLint
pnpm prisma studio # Open Prisma Studio (database GUI)pnpm prisma generate # Generate Prisma Client
pnpm prisma db push # Push schema changes to database
pnpm prisma studio # Open database GUI
pnpm prisma migrate dev # Create and apply migrations1. "Module '@prisma/client' has no exported member 'Note'"
pnpm prisma generate2. Database connection errors
- Check your
DATABASE_URLin.env - Ensure PostgreSQL is running
- Verify database credentials
3. Clerk authentication not working
- Verify API keys are correct
- Check that domain is added to Clerk dashboard
- Ensure middleware is configured properly
4. AI generation fails
- Check
OPENROUTER_API_KEYis valid - Verify you have credits (for paid models)
- Try using a different model
5. Custom cursor conflicts
- Ensure
<Pointer />is only in root layout - Remove from nested layouts
For more issues, see PRODUCTION_READINESS.md
- DEPLOYMENT.md - Detailed deployment guide
- PRODUCTION_READINESS.md - Production checklist
- RATE_LIMIT_GUIDE.md - AI rate limiting info
- DARK_MODE_IMPLEMENTATION.md - Theme guide
- PROJECT_TRACKER.md - Development tracker
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is private and proprietary.
Mahdi Jafari
- GitHub: @Mahdi-jafari-CS
- Next.js - React framework
- Clerk - Authentication
- OpenRouter - AI API aggregator
- Prisma - Database ORM
- Tailwind CSS - Styling
- Vercel - Hosting platform
Built with β€οΈ using Next.js 16 and TypeScript