Master any skill with AI-powered spaced repetition learning
Loopi is a web application that enables you to learn through conversation with Claude and convert those conversations into flashcards for spaced repetition practice.
- Interactive Chat: Have meaningful conversations with Claude about any topic
- Smart Flashcard Generation: Automatically convert Claude's responses into question-answer flashcards
- Spaced Repetition: Quiz yourself using FSRS-based spaced repetition for optimal learning
- Progress Tracking: Monitor your learning journey with detailed review statistics
- Secure Authentication: Password reset and email verification with rate limiting
- Security Audit Trail: Comprehensive logging of authentication events with IP geolocation
- Framework: Next.js 15.1 with React 19 and App Router
- Language: TypeScript 5.7
- Authentication: NextAuth.js 5
- Database: Hybrid architecture
- PostgreSQL (users, conversations, messages, API keys)
- LanceDB (flashcards, review logs, vector embeddings)
- AI: Anthropic Claude API, Jina Embeddings API
- Styling: Tailwind CSS 4
- Testing: Vitest, Playwright, React Testing Library
See ARCHITECTURE.md for detailed database design rationale.
- Node.js 20 or higher
- npm or yarn
- Anthropic API key (get one here)
git clone https://github.com/nicholaspsmith/loopi.git
cd loopinpm installCreate a .env.local file in the root directory:
# Authentication
NEXTAUTH_SECRET=your-secret-key-here
NEXTAUTH_URL=http://localhost:3000
# PostgreSQL Database (Supabase or local)
DATABASE_URL=postgresql://user:pass@host:5432/database
# LanceDB (local file-based)
DATABASE_PATH=./data/lancedb
# AI Services
ANTHROPIC_API_KEY=your-anthropic-api-key
JINA_API_KEY=your-jina-api-key
# Email Configuration (SMTP)
SMTP_HOST=smtp.ethereal.email
SMTP_PORT=587
SMTP_USER=your-ethereal-username
SMTP_PASS=your-ethereal-password
SMTP_FROM=noreply@loopi.com
NEXT_PUBLIC_APP_URL=http://localhost:3000Generate a secure NEXTAUTH_SECRET:
openssl rand -base64 32Email Setup for Development:
For development, use Ethereal Email - a fake SMTP service that captures emails without sending them:
- Go to https://ethereal.email and click "Create Ethereal Account"
- Copy the SMTP credentials to your
.env.local - Password reset and verification emails will be captured at https://ethereal.email/messages
For production, configure a real SMTP provider (SendGrid, AWS SES, etc.).
Note: Users can optionally add their own Claude API key via the Settings page in the app (encrypted storage).
npm run db:initnpm run devOpen http://localhost:3000 in your browser.
npm run dev- Start development servernpm run build- Build for productionnpm start- Start production servernpm test- Run unit testsnpm run test:integration- Run integration testsnpm run test:e2e- Run end-to-end testsnpm run db:seed- Seed database with sample datanpm run lint- Run ESLintnpm run type-check- Run TypeScript compiler
loopi/
├── app/ # Next.js App Router
│ ├── (auth)/ # Authentication pages
│ ├── (protected)/ # Protected routes (chat, quiz)
│ └── api/ # API routes
├── components/ # React components
│ ├── auth/ # Authentication components
│ ├── chat/ # Chat interface components
│ ├── quiz/ # Quiz interface components
│ └── nav/ # Navigation components
├── lib/ # Shared utilities
│ ├── db/ # Database client and queries
│ ├── claude/ # Claude API integration
│ ├── auth/ # NextAuth configuration
│ └── fsrs/ # FSRS scheduling logic
├── types/ # TypeScript type definitions
└── tests/ # Test files
## Usage
### Creating an Account
1. Navigate to the signup page
2. Enter your email, password, and name
3. Click "Sign up"
### Having a Conversation
1. Go to the Chat tab
2. Type your question or topic
3. Claude will respond with detailed information
### Generating Flashcards
1. After receiving a response from Claude, click "Generate Flashcards"
2. The system will automatically create question-answer pairs
3. View confirmation of how many flashcards were created
### Studying with Flashcards
1. Go to the Quiz tab
2. Review the question, think of your answer
3. Click "Show Answer" to reveal the correct answer
4. Rate your knowledge: Again, Hard, Good, or Easy
5. The FSRS algorithm will schedule your next review
## Development
### Running Tests
```bash
# Unit tests
npm test
# Integration tests
npm run test:integration
# E2E tests
npm run test:e2e
# All tests with coverage
npm run test:coverage
# Lint code
npm run lint
# Type check
npm run type-check
# Format code
npm run formatLoopi uses Docker-based deployment with GitHub Actions CI/CD:
- Production URL: loopi.nicholaspsmith.com
- CI/CD: Automated testing and deployment on merge to main
# Local development with Docker
docker compose up -d
# Production deployment (see full guide)
./scripts/deploy.sh- Deployment Guide - VPS setup and deployment process
- Operations Runbook - Restart, rollback, backup procedures
- GitHub Secrets Setup - Required secrets configuration
- Uptime Monitoring - External monitoring setup
See CONTRIBUTING.md for development guidelines.
MIT License - see LICENSE file for details
For issues or questions, please open an issue on GitHub.