A serverless learning platform for German language learners. Read stories and test your understanding with interactive quizzes.
- Frontend: Gatsby.js with React, TypeScript, and TailwindCSS
- UI Components: Production-grade atom components with shadcn/ui
- Backend: Go Lambda Functions (Netlify Functions)
- Database: MongoDB
- Deployment: Netlify
- π Read German stories at different difficulty levels (A1-C2 CEFR)
- β Take quizzes to test comprehension
- π View quiz results and scores
- π€ AI-Powered Content Generation - Auto-generate questions and quizzes using OpenAI GPT-4o
- π₯ Multi-user system with role-based access (Admin, Reviewer, Creator)
- π Content workflow with draft, preview, ready, and published states
- π¨ Modern, responsive UI with production-grade atom components
- π¨ Global theme system with light/dark mode support
- βΏ Accessible components following WCAG guidelines
- π§ Health monitoring with
/api/healthendpoint - β‘ Optimized MongoDB connection pooling for serverless
This platform includes an intelligent AI-powered content generation system that uses OpenAI's GPT-4o model to automatically create high-quality German learning materials.
Key Features:
- Generate 8-12 contextually relevant questions per story
- Automatic quiz metadata generation
- Support for comprehension, vocabulary, and grammar questions
- CEFR level-appropriate content (A1-C2)
- Draft status workflow for admin review
For detailed setup and usage instructions, see AI_GENERATION_GUIDE.md
This project features a production-grade UI component library built with:
- Tailwind CSS for utility-first styling
- shadcn/ui principles for consistent, reusable components
- Radix UI primitives for accessibility
- CSS Variables for flexible theming
- Button (7 variants, 4 sizes)
- Card (with Header, Title, Description, Content, Footer)
- Badge (6 variants for status indicators)
- Input & Textarea (accessible form components)
- Label (semantic form labels)
- Alert (4 variants for notifications)
- Separator (horizontal/vertical dividers)
- Component Library Documentation - Comprehensive guide with examples
- Live Showcase - Interactive demonstration of all components
import { Button, Card, CardHeader, CardTitle, CardContent } from "@/components/ui";
<Card>
<CardHeader>
<CardTitle>German Story</CardTitle>
</CardHeader>
<CardContent>
<p>Learn through engaging content...</p>
<Button variant="default">Read Story</Button>
</CardContent>
</Card>This project implements several optimizations for MongoDB in serverless environments:
- Connection Reuse: Uses singleton pattern with
sync.Onceto reuse connections across lambda invocations - Connection Pooling: Configured with optimal pool settings for serverless:
- MaxPoolSize: 10 (limit concurrent connections)
- MinPoolSize: 0 (no minimum, serverless-friendly)
- MaxConnIdleTime: 30s (close idle connections quickly)
- Health Checks: Automatic connection health monitoring and reconnection
- Error Handling: Graceful degradation and retry mechanisms
The /api/health endpoint provides comprehensive health monitoring:
GET /api/healthResponse Example:
{
"status": "healthy",
"timestamp": "2025-11-12T10:30:00Z",
"services": {
"mongodb": "healthy"
},
"version": "1.0.0"
}MongoDB Status Values:
healthy: All systems operationalconnection_failed: Cannot establish connectionping_failed: Connection exists but ping faileddatabase_access_failed: Cannot access database collections
.
βββ src/
β βββ components/ # React components
β βββ pages/ # Gatsby pages
β βββ styles/ # Global styles
βββ netlify/
β βββ functions/ # Go Lambda functions
β βββ stories/ # Story CRUD operations
β βββ quiz/ # Quiz retrieval and submission
β βββ questions/ # Question management
βββ models/ # Go data models
βββ db/ # MongoDB connection
βββ netlify.toml # Netlify configuration
- Node.js 18+
- Go 1.21+
- MongoDB (local or cloud instance)
- Install Node.js dependencies:
npm install- Install Go dependencies:
go mod download- Set up environment variables:
Create a
.envfile in the root directory:
# Copy the example file
cp .env.example .envEdit .env with your configuration:
# MongoDB Configuration
MONGODB_URI=mongodb://localhost:27017
MONGODB_DATABASE=egaldeutsch
# OpenAI Configuration (Required for AI Generation)
OPENAI_API_KEY=your_openai_api_key_here
# Application Settings
GATSBY_API_URL=http://localhost:8888/.netlify/functionsNote: Get your OpenAI API key from https://platform.openai.com/api-keys
For Netlify deployment, add these as environment variables in the Netlify dashboard.
-
Start MongoDB (if running locally)
-
Start Gatsby development server:
npm run develop- For local Lambda function testing, use Netlify Dev:
netlify devid: ObjectIDtitle: stringcontent: stringlevel: string (A1, A2, B1, B2, etc.)wordCount: numbercreatedAt: timestampupdatedAt: timestamp
id: ObjectIDstoryId: ObjectIDquestion: stringoptions: array of stringscorrectAnswer: number (index of correct option)explanation: stringcreatedAt: timestamp
id: ObjectIDstoryId: ObjectIDanswers: array of numbersscore: numbertotalQuestions: numbersubmittedAt: timestamp
GET /.netlify/functions/stories- Get all storiesGET /.netlify/functions/stories/:id- Get story by IDPOST /.netlify/functions/stories- Create new story
GET /.netlify/functions/quiz/:storyId- Get quiz for a storyPOST /.netlify/functions/quiz- Submit quiz answers
GET /.netlify/functions/questions/:storyId- Get questions for a storyPOST /.netlify/functions/questions- Create new question
- Build the project:
npm run build- Deploy to Netlify:
- Connect your repository to Netlify
- Set environment variables in Netlify dashboard
- Netlify will automatically build and deploy
You can add sample stories and questions through the API endpoints or directly to MongoDB. Each story should have 10 questions for the quiz.
MIT