A web-based educational flashcard game designed for interactive learning through gamified experiences.
Rex Game is an interactive web-based flashcard learning platform that makes education fun through gamification. Originally created as a learning tool, it features multiple game modes, progress tracking, achievements, and leaderboards to encourage continuous learning.
-
Multiple Game Modes
- Multiple Choice Quiz
- Flashcard Matching
- Fill in the Blanks
-
Progress Tracking
- Real-time scoring system
- Session history
- Performance analytics
- Personal statistics dashboard
-
Gamification
- Achievement system with unlockable badges
- Global leaderboard
- XP and level progression
- Streak tracking
-
User Management
- Secure authentication with JWT
- Email verification
- Password reset functionality
- Profile customization
-
Flashcard Management
- Custom flashcard categories
- Rich text support (Markdown)
- Image attachments
- Import/Export capabilities
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client (Browser) β
β SvelteKit 2 + Svelte 5 β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ
β REST API (JSON)
β
ββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββ
β Backend Server β
β Rust + Axum Framework β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Modules (DDD Architecture) β β
β ββββββββββββββββ¬βββββββββββββββ¬βββββββββββββββ¬ββββββββββ€ β
β β Identity β Games β Mail β Shared β β
β β (Auth) β (Scoring) β Templates β Utils β β
β ββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββ΄ββββββββββ β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββ
β SeaORM
β
ββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββ
β PostgreSQL Database β
β (Users, Flashcards, Sessions, Achievements) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
backend/
βββ entities/ # Database models (SeaORM entities)
βββ migration/ # Database migrations
βββ modules/ # Business logic modules
β βββ identity/ # Authentication & authorization
β βββ games/ # Game logic & scoring
β βββ mail_templates/ # Email templates
βββ shared/ # Shared utilities & infrastructure
βββ src/ # API handlers & routing
| Component | Technology | Version |
|---|---|---|
| Language | Rust | 1.70+ |
| Web Framework | Axum | 0.7 |
| ORM | SeaORM | 1.1 |
| Database | PostgreSQL | 15+ |
| Authentication | JWT | - |
| Resend API | - |
| Component | Technology | Version |
|---|---|---|
| Framework | SvelteKit | 2.x |
| UI Library | Svelte | 5.x |
| Styling | Bootstrap 5 | 5.3 |
| Icons | Font Awesome | 6.x |
| HTTP Client | Fetch API | - |
- CI/CD: GitHub Actions
- Deployment: Google Compute Engine
- Web Server: Nginx (reverse proxy)
- SSL: Let's Encrypt
Before you begin, ensure you have the following installed:
- Rust 1.70 or higher (Install Rust)
- Node.js 20.x or higher (Install Node)
- PostgreSQL 15 or higher (Install PostgreSQL)
- Git (Install Git)
git clone https://github.com/rex-pj/rex_game.git
cd rex_gameCreate a PostgreSQL database:
# Connect to PostgreSQL
psql -U postgres
# Create database
CREATE DATABASE rex_game_db;
# Create user (optional)
CREATE USER rex_user WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE rex_game_db TO rex_user;
# Exit
\qcd backend
# Copy environment file
cp environments/.env.example environments/.env.dev
# Edit .env.dev with your configuration
# - DATABASE_URL
# - JWT_CLIENT_SECRET (generate with: openssl rand -base64 32)
# - RESEND_API_KEY (get from https://resend.com)
# Run migrations
cargo run --bin migration
# Start the backend server
cargo runThe backend will start at http://localhost:8080
cd client-app
# Install dependencies
npm install
# Start development server
npm run devThe frontend will start at http://localhost:5173
Open your browser and navigate to:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8080
rex_game/
βββ backend/ # Rust backend
β βββ entities/ # Database entities (SeaORM models)
β βββ environments/ # Environment configuration files
β β βββ .env.example # Environment template
β β βββ .env.dev # Development config
β β βββ .env.prod # Production config
β βββ migration/ # Database migrations
β βββ modules/ # Business logic modules
β β βββ identity/ # Authentication module
β β βββ games/ # Game & scoring module
β β βββ mail_templates/ # Email templates
β βββ shared/ # Shared utilities
β β βββ domain/ # Domain logic
β β βββ infrastructure/ # Infrastructure (DB, email, etc.)
β βββ src/ # API layer
β βββ handlers/ # Request handlers
β βββ middlewares/ # Auth, CORS, etc.
β βββ routings/ # Route definitions
β
βββ client-app/ # SvelteKit frontend
β βββ src/
β β βββ components/ # Reusable UI components
β β β βββ atoms/ # Basic elements
β β β βββ molecules/ # Composite components
β β β βββ organisms/ # Complex components
β β βββ lib/ # Utilities & stores
β β β βββ api/ # API client functions
β β β βββ models/ # TypeScript types
β β β βββ stores/ # Svelte stores
β β βββ routes/ # SvelteKit routes
β β βββ (app)/ # Authenticated routes
β β βββ (auth)/ # Public routes
β βββ static/ # Static assets
β
βββ docs/ # Documentation
β βββ DEPLOYMENT.md # Deployment guide
β βββ IMPROVEMENTS_SUMMARY.md
β βββ RATE_LIMITING_IMPLEMENTATION.md
β
βββ .github/
β βββ workflows/
β βββ deploy.yml # CI/CD pipeline
β
βββ README.md # This file
| Document | Description |
|---|---|
| Deployment Guide | Complete guide for deploying to production |
| API Documentation | REST API endpoints reference |
| Database Schema | Database structure and relationships |
| Contributing Guide | How to contribute to the project |
Create backend/environments/.env.dev with the following:
# Database
DATABASE_URL=postgres://postgres:admin@localhost:5432/rex_game_db
# JWT (generate with: openssl rand -base64 32)
JWT_CLIENT_SECRET=your-generated-secret-here
# CORS
CORS_ALLOW_ORIGINS=http://localhost:5173,https://localhost:5173
# Email - Resend (https://resend.com)
EMAIL_PROVIDER=resend
RESEND_API_KEY=re_xxxxxxxxxx
EMAIL_FROM_NAME=Rex Game
EMAIL_FROM_ADDRESS=onboarding@resend.dev
# Platform URLs
PLATFORM_URL=http://localhost:5173
SIGNUP_VERIFICATION_URL=http://localhost:5173/account/confirm?token=[token]
RESET_PASSWORD_URL=http://localhost:5173/account/reset-password?token=[token]For production configuration, see Deployment Guide.
# Backend tests
cd backend
cargo test
# Frontend tests
cd client-app
npm testcd backend
cargo build --releaseThe binary will be at backend/target/release/rex_game
cd client-app
npm run buildThe build output will be in client-app/build/
For detailed deployment instructions, see Deployment Guide.
Quick deployment options:
- Google Cloud Platform (recommended, includes free tier)
- AWS EC2
- DigitalOcean Droplets
- Any VPS with Ubuntu 22.04+
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Rust naming conventions and best practices
- Write tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting PR
- Original Author - Rex-PJ
- Built with β€οΈ for educational purposes
- Inspired by the desire to make learning fun
- Thanks to the Rust and Svelte communities
For issues, questions, or suggestions:
- Open an issue on GitHub Issues
- Email: support@your-domain.com
- Mobile app (React Native)
- Multiplayer mode
- AI-generated flashcards
- Voice recognition for language learning
- Integration with popular learning platforms
- Teacher dashboard for classroom use