{"id":29028423,"url":"https://github.com/leonidasdev/pixeltrivia","last_synced_at":"2026-05-08T04:32:37.791Z","repository":{"id":301005465,"uuid":"1007868548","full_name":"leonidasdev/pixeltrivia","owner":"leonidasdev","description":"A pixel art, AI-powered trivia game for students, challenging and entertaining across every subject.","archived":false,"fork":false,"pushed_at":"2025-06-24T17:11:06.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-24T17:50:13.796Z","etag":null,"topics":["educational-game","full-stack","nextjs","pixel-art","tailwindcss","trivia-game","typescript","web-game"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonidasdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-24T16:51:45.000Z","updated_at":"2025-06-24T17:37:44.000Z","dependencies_parsed_at":"2025-06-24T17:50:15.645Z","dependency_job_id":"a43a5c5f-76db-4870-b7f5-bb2ac9a35172","html_url":"https://github.com/leonidasdev/pixeltrivia","commit_stats":null,"previous_names":["leonidasdev/pixeltrivia"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leonidasdev/pixeltrivia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonidasdev%2Fpixeltrivia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonidasdev%2Fpixeltrivia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonidasdev%2Fpixeltrivia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonidasdev%2Fpixeltrivia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonidasdev","download_url":"https://codeload.github.com/leonidasdev/pixeltrivia/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonidasdev%2Fpixeltrivia/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262018884,"owners_count":23245626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["educational-game","full-stack","nextjs","pixel-art","tailwindcss","trivia-game","typescript","web-game"],"created_at":"2025-06-26T07:11:22.672Z","updated_at":"2026-05-08T04:32:37.780Z","avatar_url":"https://github.com/leonidasdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PixelTrivia\n\n\u003cdiv align=\"center\"\u003e\n\n![Next.js](https://img.shields.io/badge/Next.js-14-black?logo=next.js)\n![React](https://img.shields.io/badge/React-18-blue?logo=react)\n![TypeScript](https://img.shields.io/badge/TypeScript-5.8-blue?logo=typescript)\n![Tailwind CSS](https://img.shields.io/badge/Tailwind-3.3-38bdf8?logo=tailwindcss)\n![Supabase](https://img.shields.io/badge/Supabase-Backend-3ecf8e?logo=supabase)\n![Tests](https://img.shields.io/badge/Tests-1990%20passing-brightgreen)\n![Coverage](https://img.shields.io/badge/Coverage-86%25-brightgreen)\n\n**A retro-styled trivia game with AI-powered question generation**\n\n[Demo](#) | [Documentation](docs/) | [Report Bug](../../issues) | [Request Feature](../../issues)\n\n\u003c/div\u003e\n\n---\n\n## Features\n\n- **Pixel-Perfect Retro UI** — Nostalgic 8-bit inspired design with retro fonts and pixel borders\n- **AI-Powered Questions** — Generate custom trivia using DeepSeek AI via OpenRouter\n- **Multiple Game Modes** — Quick Play, Custom Topics, Advanced (file-based)\n- **Multiplayer Rooms** — Create and join rooms, real-time gameplay with Supabase Realtime\n- **Single-Player Mode** — Full solo gameplay with timer, scoring, streaks, and results\n- **Leaderboards \u0026 Achievements** — Local rankings with 20 unlockable achievements across 4 tiers\n- **Adaptive Difficulty** — Per-category accuracy tracking adjusts recommended difficulty\n- **Chiptune Sound System** — Web Audio API engine with 18 sound effects and procedural music\n- **Image-Based Questions** — Optional image support for richer trivia content\n- **Share Results** — Web Share API with clipboard fallback for sharing scores\n- **Touch Gestures** — Swipe navigation on mobile devices\n- **Keyboard Navigation** — Full keyboard accessibility (1-4 / A-D answer shortcuts)\n- **WCAG Accessible** — Screen reader friendly, ARIA labels, skip navigation, 44px touch targets\n- **Reduced Motion** — Respects `prefers-reduced-motion` system preference\n- **Security Hardened** — Rate limiting, input validation, XSS protection, CSP headers\n- **Responsive Design** — Works on desktop, tablet, and mobile\n\n## Quick Start\n\n### Prerequisites\n\n- Node.js 18+\n- npm or yarn\n- Supabase account (for database)\n- OpenRouter API key (for AI question generation)\n\n### Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/leonidasdev/pixeltrivia.git\ncd pixeltrivia\n\n# Install dependencies\nnpm install\n\n# Copy environment template\ncp .env.example .env.local\n```\n\n### Environment Variables\n\nCreate a `.env.local` file with:\n\n```env\n# Supabase Configuration\nNEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co\nNEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key\nSUPABASE_SERVICE_ROLE_KEY=your-service-role-key\n\n# AI Question Generation (OpenRouter)\nOPENROUTER_API_KEY=your-openrouter-api-key\n\n# Optional: Internal API key for admin endpoints\nINTERNAL_API_KEY=your-secret-key\n```\n\n### Run Development Server\n\n```bash\nnpm run dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000) in your browser.\n\n## Documentation\n\n| Document | Description |\n|----------|-------------|\n| [Architecture](docs/reference/architecture.md) | System design and component overview |\n| [Development](docs/guides/development-guide.md) | Local setup and development guide |\n| [API Reference](docs/reference/api-reference.md) | Complete API documentation |\n| [Database](docs/guides/database-guide.md) | Schema and Supabase setup |\n| [Testing](docs/guides/testing-guide.md) | Testing guide and conventions |\n| [Deployment](docs/guides/deployment-guide.md) | Production deployment guide |\n| [Contributing](CONTRIBUTING.md) | How to contribute |\n\n## Game Modes\n\n### Quick Play\nSelect from predefined categories and start a trivia game:\n- 40+ categories across Gaming, Movies, Science, History, Geography, and more\n- 5 difficulty levels from Elementary to College\n- Adaptive difficulty recommendations based on your performance\n- 5-50 questions per game\n\n### Custom Game\nCreate your own trivia experience:\n- AI generates questions based on your topic using DeepSeek\n- Provide optional context for more specific questions\n- Configurable question count and difficulty\n\n### Advanced Game\nGenerate questions from your own documents:\n- Upload PDF, DOCX, TXT, or Markdown files\n- AI creates questions based on document content\n- Input sanitization and prompt injection protection\n\n### Multiplayer\nCompete with others in real-time:\n- Create private rooms with 6-character codes\n- Up to 16 players per room\n- Host controls game flow\n- Invite links and room code sharing\n\n## Project Structure\n\n```\npixeltrivia/\n├── app/                    # Next.js App Router\n│   ├── api/               # API Routes\n│   │   ├── ai/            # AI generation endpoints\n│   │   ├── game/          # Game session endpoints\n│   │   ├── quiz/          # Quiz endpoints (quick, custom, advanced)\n│   │   └── room/          # Multiplayer room endpoints\n│   ├── components/        # React components\n│   ├── game/              # Game pages\n│   │   ├── quick/         # Quick play mode\n│   │   ├── custom/        # Custom game mode\n│   │   ├── advanced/      # Advanced configuration\n│   │   ├── play/          # Single-player gameplay\n│   │   ├── create/        # Create multiplayer room\n│   │   ├── join/          # Join multiplayer room\n│   │   ├── mode/          # Game mode selection\n│   │   ├── select/        # Category \u0026 difficulty selection\n│   │   ├── leaderboard/   # Rankings page\n│   │   ├── achievements/  # Achievement showcase\n│   │   └── stats/         # Game statistics\n│   ├── globals.css        # Global styles\n│   ├── layout.tsx         # Root layout\n│   └── page.tsx           # Home page\n├── types/                 # Shared TypeScript type definitions\n├── constants/             # Application constants (avatars, categories, game config)\n├── hooks/                 # Custom React hooks\n├── lib/                   # Utility libraries\n│   ├── errors.ts          # Custom error classes\n│   ├── validation.ts      # Zod schemas\n│   ├── security.ts        # Security middleware\n│   ├── security.core.ts   # Pure security functions\n│   ├── rateLimit.ts       # Rate limiting (in-memory + Redis)\n│   ├── apiResponse.ts     # API response helpers\n│   ├── logger.ts          # Structured logging utility\n│   ├── storage.ts         # Typed localStorage wrapper\n│   ├── soundManager.ts    # Web Audio API sound engine\n│   ├── leaderboard.ts     # Local leaderboard system\n│   ├── achievements.ts    # Achievement system\n│   ├── apiCache.ts        # SWR-based API caching\n│   └── *Api.ts            # API client functions\n├── database/              # Database schema\n├── docs/                  # Documentation\n│   ├── guides/            # Development, testing, deployment\n│   ├── reference/         # Architecture, API reference\n│   └── operations/        # Monitoring, runbook\n├── __tests__/             # Test suites (114 suites, 1990 tests)\n└── .github/               # GitHub Actions CI/CD\n```\n\n## Testing\n\n```bash\n# Run all tests\nnpm test\n\n# Run tests in watch mode\nnpm run test:watch\n\n# Run tests with coverage\nnpm run test:coverage\n\n# Type checking\nnpm run typecheck\n```\n\n**Test Coverage:** 1990 tests across 114 test suites (unit, component, page, hook, integration)\n\n## Scripts\n\n| Script | Description |\n|--------|-------------|\n| `npm run dev` | Start development server |\n| `npm run build` | Build for production |\n| `npm run start` | Start production server |\n| `npm run lint` | Run ESLint |\n| `npm run lint:fix` | Fix ESLint errors |\n| `npm run format` | Format with Prettier |\n| `npm test` | Run tests |\n| `npm run test:coverage` | Run tests with coverage |\n| `npm run typecheck` | TypeScript type checking |\n| `npm run validate` | Full validation (typecheck + lint + test) |\n\n## Security Features\n\n- **Rate Limiting** - Protects against abuse (100 req/min standard, 5 req/min for AI)\n- **Input Validation** - Zod schemas validate all API inputs\n- **XSS Protection** - Input sanitization and CSP headers\n- **CORS** - Configured allowed origins\n- **Security Headers** - X-Frame-Options, X-Content-Type-Options, etc.\n- **Request Size Limits** - Prevents oversized payloads\n\n## Contributing\n\nContributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit changes (`git commit -m 'feat: add amazing feature'`)\n4. Push to branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see [LICENSE](LICENSE) for details.\n\n## Acknowledgments\n\n- [Next.js](https://nextjs.org/) - React framework\n- [Tailwind CSS](https://tailwindcss.com/) - Styling\n- [Supabase](https://supabase.com/) - Backend\n- [OpenRouter](https://openrouter.ai/) - AI API gateway\n- [DeepSeek](https://deepseek.com/) - AI model for question generation\n\n---\n\n\u003cdiv align=\"center\"\u003e\nMade with pixels\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonidasdev%2Fpixeltrivia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonidasdev%2Fpixeltrivia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonidasdev%2Fpixeltrivia/lists"}