Skip to content

nicovalerian/studium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Studium

AI-Powered Study Workspace

Next.js TypeScript Supabase License: MIT

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


✨ Features

🎯 Core Capabilities

  • πŸ“„ 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

πŸ” Authentication & Security

  • Multiple Auth Methods - Email/password or Google OAuth
  • Email Verification - Required before accessing protected features
  • Secure Storage - Private document storage with Row Level Security

πŸš€ Document Processing Pipeline

  1. Parse - Extract text from PDF/DOCX files
  2. Chunk - Intelligently split content into 500-character segments
  3. Embed - Generate 384-dimensional vectors using HuggingFace
  4. Index - Store in Supabase pgvector for fast similarity search
  5. Retrieve - Power chat with context-aware responses

πŸ› οΈ Stack

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

πŸš€ Quick Start

Prerequisites

Note: Google OAuth is optional. The app fully supports email/password authentication with email confirmation.

Installation

1. Clone the repository

git clone https://github.com/nicovalerian/studium.git
cd studium

2. Install dependencies

npm install

3. Configure environment variables

cp .env.local.example .env.local

Fill 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-v2

Optional for local UI and test work:

MOCK_EXTERNAL_APIS=1

πŸ’‘ Tip: Set MOCK_EXTERNAL_APIS=1 to bypass external AI calls during local UI development.

4. Set up Supabase

  1. Run supabase/schema.sql in the Supabase SQL editor.
  2. Create a private storage bucket named documents.
  3. Run supabase/storage-policies.sql.
  4. In Supabase Auth, set the site URL to your app origin.
  5. Add these redirect URLs:
    • http://localhost:3000/auth/callback
    • http://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 dev

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

πŸ“– Documentation

πŸ“œ Available Scripts

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

πŸ“ Project Structure

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

🀝 Contributing

Contributions are welcome! Please read CONTRIBUTING.md for development guidelines, testing practices, and code conventions.

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests and linting (npm run lint && npm run test:run)
  5. Commit your changes (git commit -m 'feat: add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments


⬆ back to top

Made with ❀️ for students everywhere

About

AI-powered study workspace with document chat and automated flashcard generation. Built with Next.js, Supabase, and RAG.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors