Skip to content

w9labs/vocai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

============================================================

VOCAI: Vocab+AI β€” README

============================================================

Vocai Logo

Vocai: Vocab+AI

AI-powered vocabulary learning with spaced repetition

License: MIT Rust W9 Labs


🎯 Features

  • πŸ€– AI Flashcard Generation β€” Powered by NVIDIA AI for text + Pollinations for save-time mnemonic images
  • 🧠 Spaced Repetition System (SRS) β€” Hybrid SM-2 + Leitner algorithm for optimal memory retention
  • 🏝️ Vocabulary Islands β€” Learn words in contextual topics (cooking, politics, tech, etc.)
  • πŸ“Š Smart Analytics β€” Track your learning progress, streaks, and mastered words
  • πŸ” OAuth Authentication β€” Secure login via W9 Labs unified auth system
  • 🎨 Modern UI β€” 2026 trending color palette with 8-bit voxel arcade elements

πŸ› οΈ Tech Stack

  • Backend: Rust 1.94 + Axum 0.7 + tokio
  • Database: PostgreSQL 16 (shared with W9 Labs ecosystem)
  • AI: NVIDIA API for text generation + Pollinations for image generation
  • Authentication: OAuth 2.0 via w9-db
  • Deployment: Docker + Docker Compose + Caddy reverse proxy
  • Frontend: Server-rendered HTML + vanilla JavaScript

πŸš€ Quick Start

Local Development

# Clone the repository
git clone https://github.com/w9labs/vocai.git
cd vocai

# Copy environment file
cp .env.example .env

# Start PostgreSQL (or use existing w9-postgres)
# Create database: CREATE DATABASE w9_vocabai;

# Run the server
cd server
cargo run

Docker Compose

docker compose up -d

πŸ“ Project Structure

vocai/
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ Cargo.toml          # Rust dependencies
β”‚   └── src/
β”‚       β”œβ”€β”€ main.rs         # Application entry point
β”‚       β”œβ”€β”€ db.rs           # Database connection & migrations
β”‚       β”œβ”€β”€ models.rs       # Data models
β”‚       β”œβ”€β”€ handlers/       # Route handlers
β”‚       β”‚   β”œβ”€β”€ mod.rs
β”‚       β”‚   β”œβ”€β”€ auth.rs     # OAuth authentication
β”‚       β”‚   β”œβ”€β”€ flashcards.rs # Flashcard CRUD & generation
β”‚       β”‚   β”œβ”€β”€ islands.rs  # Vocabulary islands
β”‚       β”‚   └── review.rs   # SRS review sessions
β”‚       β”œβ”€β”€ nvidia.rs       # NVIDIA AI integration
β”‚       β”œβ”€β”€ srs.rs          # Spaced repetition algorithms
β”‚       β”œβ”€β”€ auth.rs         # OAuth callback & login
β”‚       └── session.rs      # Session management
β”œβ”€β”€ public/
β”‚   └── assets/
β”‚       β”œβ”€β”€ css/vocai.css   # 2026 color palette + voxel theme
β”‚       └── js/vocai.js     # Frontend interactions
β”œβ”€β”€ Dockerfile              # Multi-stage Docker build
β”œβ”€β”€ docker-compose.yml      # Docker Compose config
└── .env.example            # Environment template

🧠 Spaced Repetition Algorithm

Vocai uses a hybrid SRS combining:

  1. SM-2 Algorithm (SuperMemo) β€” Calculates optimal review intervals based on recall quality
  2. Leitner System β€” Moves mastered words to less frequent review boxes

Review Quality Scale

Rating Meaning Interval Effect
0 Complete blackout Reset to 1m
1 Incorrect response Reset to 1m
2 Correct recalled, hard Short interval
3 Correct recalled, difficult Normal interval
4 Perfect response Extended interval
5 Perfect + trivial Maximum interval

Leitner Boxes

Box Review Interval Description
1 Every day New/difficult words
2 Every 3 days Learning words
3 Every 7 days Familiar words
4 Every 14 days Well-known words
5 Every 30 days Mastered words

🌐 Deployment

VPS (W9 Labs Server)

Vocai deploys to the W9 Labs VPS alongside other services:

# SSH to server
ssh -p 22001 root@ffm.w9.nu

# Navigate to deployment directory
cd /opt/w9-labs

# Pull latest and redeploy
docker compose pull vocai && docker compose up -d vocai

Caddy Configuration

Add to /etc/caddy/Caddyfile:

vocai.top {
    reverse_proxy vocai:3010
}

Cloudflare Pages (Alternative)

For static frontend:

wrangler pages deploy public --project-name=vocai

πŸ“Š Database Schema

Tables

  • users β€” User accounts (synced with w9-db OAuth)
  • vocabulary_islands β€” Topic-based word collections
  • flashcards β€” Individual vocabulary cards, image prompts, and Pollinations image URLs
  • srs_reviews β€” Spaced repetition progress
  • study_sessions β€” Review history
  • user_stats β€” Aggregated learning statistics

πŸ” OAuth Integration

Vocai uses the W9 Labs unified OAuth 2.0 system:

  1. User clicks "Login with W9" on vocai.top
  2. Redirect to db.w9.nu/oauth/authorize
  3. User authenticates via w9-db
  4. Callback to vocai.top/auth/callback with auth code
  5. Exchange code for token via /oauth/token
  6. Session created, user redirected to dashboard

Image Generation Flow

  1. The text model generates flashcards and an image_prompt for each card.
  2. Pollinations renders the image only when the user saves a card.
  3. Vocai stores the returned image URL plus prompt/model metadata in PostgreSQL.
  4. If image generation fails, the flashcard still saves so study flow is never blocked.

🎨 Design System

2026 Trending Color Palette

  • Primary: Electric Indigo (#6366F1)
  • Secondary: Neo Mint (#A7F3D0)
  • Accent: Digital Lavender (#E9D5FF)
  • Background: Deep Space (#0F172A)
  • Success: Cyber Green (#22D3EE)
  • Warning: Solar Orange (#FB923C)
  • Error: Crimson Glitch (#F43F5E)

Typography

  • Headings: Space Grotesk (geometric, modern)
  • Body: Inter (clean, readable)
  • Code/Accent: JetBrains Mono (technical)

πŸ“ License

MIT License β€” see LICENSE for details.

🀝 Contributing

Contributions welcome! Please read our Contributing Guide first.

πŸ’œ Built with love by W9 Labs

Part of the W9 Network ecosystem. Learn more at w9.nu

About

Vocai: Vocab+AI - AI-powered vocabulary flashcard app with spaced repetition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors