Sanjay Azhagan Logo
← Back to Projects

πŸŽ“ StudySphere β€” Collaborative Notes Sharing with Token Economy

2026-03-01
RAGGeminiPineconeLangChainNode.jsExpressPostgreSQLVector DatabaseAI Auto-GradingFull-StackMulti-TenancyPeer Learningfull-stackaicloud

StudySphere is a decentralized, pool-based notes-sharing and RAG (Retrieval-Augmented Generation) platform that turns passive note-taking into an active, rewarded learning ecosystem. It bridges the gap between individual effort and collective knowledge by solving the "freeloader" problem through an AI-driven token economy.

StudySphere

Collaborative Notes Sharing with Token Economy

Tags: EdTech Β· RAG Β· Token Economy Β· Gemini Β· Pinecone Β· LangChain Β· Node.js Β· Express Β· PostgreSQL Β· Vector Database Β· AI Auto-Grading Β· Full-Stack Β· Multi-Tenancy Β· Peer Learning

StudySphere is a decentralized, pool-based notes-sharing and RAG (Retrieval-Augmented Generation) platform that turns passive note-taking into an active, rewarded learning ecosystem. It bridges the gap between individual effort and collective knowledge by solving the "freeloader" problem through an AI-driven token economy.


Links

πŸš€ Live Demostudysphere.vercel.app
πŸŽ₯ Demo VideoWatch the Walkthrough
πŸ—ΊοΈ System ArchitectureExcalidraw ER Diagram

Hackathon Evaluators: Email delivery may be delayed in the staging environment due to third-party sandbox limitations. Use these demo credentials for immediate testing:

AccountEmailPassword
User 1user1@gmail.comkeerthivasan
User 2user2@gmail.comkeerthivasan

The Problem

Traditional digital learning environments face three structural flaws:

  • The Freeloader Problem β€” Peer-to-peer learning fails because there is no systemic incentive to reward core contributors or engage passive students.
  • Unstructured Information β€” Fast-paced, messy student notes lose context and meaning over time.
  • Inefficient Revision β€” Learners waste critical hours re-reading entire documents instead of precision-targeting missing concepts.

The Solution

  • Isolated Context Pools β€” Each subject or lecture series has its own Pool with a dedicated RAG context. The AI strictly draws answers from documents uploaded to that exact namespace, eliminating cross-subject hallucinations.
  • Token-Based Learning Economy β€” Users earn tokens by uploading high-quality study materials, and spend tokens to query the AI or generate summaries. Continuous contribution is the only path to continued access.
  • AI-Powered Auto-Grading β€” Every uploaded note is parsed for clarity and depth, with tokens dynamically allocated based on assessed value.

Tech Stack

LayerTechnologies
BackendNode.js, Express
DatabasePostgreSQL, Drizzle ORM
Vector & AIPinecone (multi-tenant namespaces), Gemini 1.5 Flash/Pro, LangChain
AuthJWT, bcrypt
File & MailMulter, Cloudinary, Nodemailer
Dev Toolsdotenv, Nodemon

Architecture

System Architecture

Upload Quality Notes βž” Earn Tokens βž” Ask Complex Questions βž” Spend Tokens βž” Repeat

How It Works

  1. Auth β€” Secure signup with mandatory email verification. Issues short-lived access tokens and HTTP-only refresh tokens.
  2. Pools β€” Users spin up subject workspaces and distribute cryptographic join codes to classmates.
  3. Note Ingestion β€” Uploads are parsed by LangChain, split into semantic chunks, assigned metadata, and upserted into isolated Pinecone namespaces.
  4. Token System β€” Tokens are stored as integer units. Uploading earns tokens (amount determined by AI grade); each AI query costs 1 token.
  5. Contextual Q&A β€” Each prompt validates the user's token balance, retrieves top-k relevant vectors, and returns source-grounded answers via Gemini.

Screenshots

Authentication

Sign Up Sign In

Dashboard

Dashboard

Pools

My Pools Create Pool Join Pool

Notes

Notes Pool Dropdown

Chat

Chats Create New Chat


API Reference

All protected routes require:

Authorization: Bearer <access_token>

Some routes use HTTP-only cookies for refresh tokens.

Authentication

MethodEndpointDescription
POST/auth/signupRegister a new account and dispatch verification email
GET/auth/verify/:tokenVerify user email address
POST/auth/signinValidate credentials and return JWT access tokens
POST/auth/refreshRotate access keys via secure refresh token cookie
POST/auth/logoutInvalidate the active session

Users & Workspaces

MethodEndpointDescription
GET/users/meFetch current user profile metadata
GET/users/me/:idFetch pool statistics for a specific user
POST/poolsCreate a new pool and generate a unique access code
POST/pools/joinJoin an existing workspace via shared code
GET/poolsList all active workspaces for the current user

Chat & RAG Engine

MethodEndpointDescription
POST/chatsInitialize an isolated conversation inside a pool
GET/chatsFetch global chat logs for the workspace
POST/chats/:chatId/askValidate token budget, query Pinecone, return AI response
GET/chats/:chatIdLoad historical message thread for a specific chat

Notes

MethodEndpointDescription
POST/notesUpload a file (multipart/form-data), run auto-grading, mint tokens
GET/notes/:poolIdList metadata for all notes in a pool
GET/notes/:noteIdRetrieve raw text and evaluation history for a note

Local Setup

1. Clone & Install

git clone <your-repository-url>
cd server
npm install

2. Environment Variables

Create a .env file in the server/ root:

PORT=8080
DATABASE_URL=postgresql://user:password@localhost:5432/studysphere

# Security
JWT_SECRET=your_super_secret_access_key
JWT_REFRESH_SECRET=your_super_secret_refresh_key
JWT_EXPIRES_IN=1d
JWT_REFRESH_EXPIRES_IN=5d

# Storage & Email
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret
EMAIL_USER=your_verified_app_email@gmail.com
EMAIL_PASS=your_gmail_app_password
BASE_URL=http://localhost:8080

# Vector & AI
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX=vashist
PINECONE_HOST=your_pinecone_host_url
GEMINI_API_KEY=your_google_gemini_api_key

3. Run

npm run seed   # Seed the database schema
npm run dev    # Start the dev server with hot reload

Hackathon Evaluation Notes

CriterionWeightApproach
Innovation20%Token economy framework designed to solve human-centric engagement bottlenecks in peer learning
Technical Implementation35%Multi-tenant RAG with isolated Pinecone namespaces and automated AI grading pipelines
Feasibility20%Production-ready architecture with integer-based token ledger optimized for classroom scale
Video Presentation15%Watch here
Deployment10%Live on Vercel

Roadmap

  • Personal Workspace Sandboxing β€” Private chat module where users can ingest personal documents and research into an exclusive vector space, independent of public pool dynamics.
  • Multimodal Note Evaluation β€” Expand the grading engine to analyze handwriting, math diagrams, and lecture screenshots via Gemini's native vision models.

Links & Resources