AI-Powered Study Workspace
Transform your study materials into an interactive AI-powered workspace. Upload documents, chat with your content using retrieval-augmented generation, and generate flashcards automatically.
Features β’ Quick Start β’ Stack β’ Documentation
- π Document Upload - Support for PDF and DOCX files (up to 10 MB)
- π€ AI-Powered Chat - Context-aware conversations using RAG (Retrieval-Augmented Generation)
- π΄ Flashcard Generation - Automatically create study flashcards from your documents
- ποΈ Guest Preview - Explore the dashboard before signing in
- Multiple Auth Methods - Email/password or Google OAuth
- Email Verification - Required before accessing protected features
- Secure Storage - Private document storage with Row Level Security
- Parse - Extract text from PDF/DOCX files
- Chunk - Intelligently split content into 500-character segments
- Embed - Generate 384-dimensional vectors using HuggingFace
- Index - Store in Supabase pgvector for fast similarity search
- Retrieve - Power chat with context-aware responses
| Category | Technologies |
|---|---|
| Frontend | Next.js 14 (App Router), React 18, TypeScript (strict mode) |
| Styling | Tailwind CSS, Radix UI (shadcn/ui components) |
| Backend | Supabase (Auth, Postgres, Storage, SSR) |
| AI/ML | DigitalOcean Gradient AI, HuggingFace Inference API |
| Database | PostgreSQL with pgvector extension |
| Testing | Vitest (unit), Playwright (E2E), Lighthouse CI |
| Code Quality | ESLint, Prettier |
- Node.js 18+ with npm
- Supabase project (create one free)
- DigitalOcean Gradient API key (get started)
- HuggingFace access token (create token)
Note: Google OAuth is optional. The app fully supports email/password authentication with email confirmation.
1. Clone the repository
git clone https://github.com/nicovalerian/studium.git
cd studium2. Install dependencies
npm install3. Configure environment variables
cp .env.local.example .env.localFill in the values in .env.local:
NEXT_PUBLIC_SITE_URL=http://localhost:3000
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
DO_GRADIENT_API_KEY=your-do-gradient-api-key
DO_GRADIENT_CHAT_MODEL=llama3.3-70b-instruct
HUGGINGFACE_API_KEY=hf_your-token
HUGGINGFACE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2Optional for local UI and test work:
MOCK_EXTERNAL_APIS=1π‘ Tip: Set
MOCK_EXTERNAL_APIS=1to bypass external AI calls during local UI development.
4. Set up Supabase
- Run
supabase/schema.sqlin the Supabase SQL editor. - Create a private storage bucket named
documents. - Run
supabase/storage-policies.sql. - In Supabase Auth, set the site URL to your app origin.
- Add these redirect URLs:
http://localhost:3000/auth/callbackhttp://localhost:3000/auth/confirm
Optional: Configure Google OAuth provider in Supabase and use the email template at supabase/templates/confirmation.html.
5. Start the development server
npm run devOpen http://localhost:3000 in your browser.
- CONTRIBUTING.md - Development guidelines and testing practices
- DEPLOYMENT.md - Production deployment guide
- Supabase Schema - Complete database schema
| Command | Description |
|---|---|
npm run dev |
Start the Next.js dev server |
npm run build |
Build the production app |
npm run start |
Start the production server |
npm run lint |
Run Next.js linting |
npm run format |
Format the repo with Prettier |
npm run format:check |
Check Prettier formatting |
npm run test |
Run Vitest in watch mode |
npm run test:run |
Run Vitest once |
npm run test:coverage |
Run Vitest with coverage |
npm run e2e |
Run Playwright end-to-end tests |
npm run e2e:ui |
Open Playwright UI mode |
npm run lighthouse |
Run Lighthouse CI |
studium/
βββ src/
β βββ app/
β β βββ api/ # API routes (upload, chat, flashcards, documents)
β β βββ auth/ # OAuth and email confirmation handlers
β β βββ class/ # Main study workspace
β β βββ dashboard/ # Guest preview and class bootstrap
β β βββ login/ # Sign-in and sign-up flow
β βββ components/
β β βββ auth/ # Authentication components
β β βββ chat/ # Chat interface
β β βββ documents/ # Document management
β β βββ flashcards/ # Flashcard UI
β β βββ landing/ # Landing page
β β βββ ui/ # Radix UI components (shadcn/ui)
β βββ hooks/ # Custom React hooks
β βββ lib/
β β βββ ai/ # AI provider abstraction
β β βββ auth/ # Auth helpers and access control
β β βββ embeddings/ # Text chunking and embedding generation
β β βββ file-processing/ # PDF/DOCX parsers
β β βββ flashcards/ # Flashcard generation logic
β β βββ supabase/ # Supabase client utilities
β βββ test/ # Test utilities and setup
β βββ types/ # TypeScript type definitions
βββ supabase/
β βββ schema.sql # Database schema
β βββ storage-policies.sql # Storage RLS policies
β βββ templates/ # Email templates
βββ e2e/ # Playwright end-to-end tests
βββ scripts/ # Build and utility scripts
Contributions are welcome! Please read CONTRIBUTING.md for development guidelines, testing practices, and code conventions.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and linting (
npm run lint && npm run test:run) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Next.js and Supabase
- UI components from shadcn/ui
- AI powered by DigitalOcean Gradient and HuggingFace
Made with β€οΈ for students everywhere