A production-ready, commercial-grade crossword puzzle generator that demonstrates AI/LLM capabilities through an interactive web application. Users can input topics (e.g., "The Office", "Basketball", "Pixar Characters") and receive fully playable crossword puzzles with generated clues.
- AI-Powered Word Generation: Generates themed words and clues using multiple LLM providers
- Robust Crossword Algorithm: Creates valid crosswords with proper word intersections
- Interactive Grid: Professional crossword interface with click/type interaction
- Multi-Provider LLM Support: OpenAI, Anthropic, Ollama, and mock fallback
- Production Ready: Docker containerization with health checks
- Comprehensive Testing: Full test suite with 80%+ coverage
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Backend β β LLM APIs β
β (React/TS) βββββΊβ (FastAPI) βββββΊβ Multi-providerβ
β Port: 3000 β β Port: 8000 β β External APIs β
β Nginx Proxy β β Python β β + Local Ollamaβ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
-
Clone and setup:
git clone <repository> cd faster_dynamic_crossword cp .env.template .env
-
Configure environment (edit
.env
):LLM_PROVIDER=anthropic # or openai, ollama, mock ANTHROPIC_API_KEY=your_key_here OPENAI_API_KEY=your_key_here
-
Start the application:
docker-compose up --build
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- Health Check: http://localhost:8000/health
cd backend
pip install -r requirements.txt
python start_server.py
cd frontend
npm install
npm start
cd backend
pytest tests/ -v
- Crossword generation algorithm validation
- LLM integration with multiple providers
- API endpoint functionality
- Error handling and edge cases
- FastAPI Application: RESTful API with CORS support
- Crossword Generator: Robust algorithm preventing invalid word formations
- LLM Service: Multi-provider integration with fallback
- Comprehensive Tests: pytest suite with mocking
- React TypeScript: Modern component architecture
- Interactive Grid: Professional crossword interface
- Tab System: Topic generation vs. custom words
- Responsive Design: Mobile-friendly with touch support
POST /generate-from-topic
- Generate words from topicPOST /generate-crossword
- Create crossword from word listGET /clues/{crossword_id}
- Retrieve stored cluesGET /health
- Health check
Variable | Description | Default |
---|---|---|
LLM_PROVIDER |
LLM provider (openai/anthropic/ollama/mock) | mock |
OPENAI_API_KEY |
OpenAI API key | - |
ANTHROPIC_API_KEY |
Anthropic API key | - |
OLLAMA_BASE_URL |
Ollama server URL | http://localhost:11434 |
- OpenAI: GPT-3.5-turbo for word generation
- Anthropic: Claude Haiku for word generation
- Ollama: Local LLM support (llama2)
- Mock: Fallback with curated word lists
The crossword generation engine implements:
- Intersection Validation: Ensures proper word connections
- Boundary Checking: Prevents word merging and overflow
- Perpendicular Word Validation: Avoids creating invalid words
- Connectivity Requirements: All words must connect to main structure
- Quality Filtering: Professional crossword standards
- API Key Management: Environment-based configuration
- CORS Protection: Proper cross-origin headers
- Input Validation: Sanitized user inputs
- Container Security: Non-root users, minimal images
- Health Monitoring: Built-in health checks
- Topic Input: Enter any topic (e.g., "Basketball")
- Word Generation: AI generates 30 themed words with clues
- Crossword Creation: Algorithm creates valid puzzle structure
- Interactive Solving: Click cells, type letters, navigate with arrows
- Validation: Check answers or reveal solution
- Completion Tracking: Real-time progress indication
CORS Errors: Ensure backend is running and CORS is configured LLM API Failures: Check API keys and network connectivity Docker Build Failures: Verify Docker and docker-compose versions Frontend Build Issues: Clear npm cache and reinstall dependencies
# Backend with debug logging
cd backend
uvicorn src.api:app --reload --log-level debug
# Frontend with detailed errors
cd frontend
npm start
- Set production environment variables
- Use production Docker configurations
- Configure reverse proxy (nginx)
- Set up monitoring and logging
- Implement backup strategies
- Stateless backend design for horizontal scaling
- Session storage can be moved to Redis/database
- CDN for frontend assets
- Load balancing for multiple backend instances
- Backend Response: < 2 seconds for crossword generation
- Frontend Rendering: 60fps animations, smooth interactions
- LLM Calls: Timeout handling with fallback
- Docker Images: Optimized with multi-stage builds
- Fork the repository
- Create feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit pull request
This project is built for demonstration purposes and showcases AI integration patterns for crossword generation.
Built with AI-powered crossword generation π§©