Simple FastAPI + React project that analyzes text with an LLM-backed backend and a lightweight frontend for submitting and browsing analyses.
- Python 3.11+
- Node.js 18+ (for local frontend development)
- Docker (optional)
cd backendcp .env.example .env(optional: edit.envto add API keys)python -m venv .venv && source .venv/bin/activatepip install -r requirements.txtuvicorn app.main:app --reload --port 8000
The API lives at http://localhost:8000/api/v1. Interactive docs: http://localhost:8000/docs.
Environment variables (see env.example):
OPENAI_API_KEY— uses OpenAI via LangChain if setANTHROPIC_API_KEY— uses Anthropic via LangChain if setGOOGLE_API_KEY— uses Google Gemini via LangChain if set- Falls back to
MockLLMif no keys are set
cd frontendcp env.example .env(optional: edit if backend URL differs)npm installnpm run dev
The app will be available at http://localhost:5173. See env.example for configuration options.
docker build -t llm-analyzer-backend ./backend
docker run --rm -p 8000:8000 llm-analyzer-backenddocker build -t llm-analyzer-frontend ./frontend
docker run --rm -p 5173:80 llm-analyzer-frontendThe frontend image serves the production build via Nginx. It expects the backend to be reachable from your browser at http://localhost:8000.
- Clean layered architecture with clear separation between API handlers, business logic (services), and data access layers
- FastAPI chosen for async capabilities, automatic OpenAPI documentation, and modern Python type hints
- React + Vite provides lightweight frontend with fast development iteration
- LangChain abstracts multiple LLM providers (OpenAI, Anthropic, Google Gemini) with MockLLM fallback for testing, enabling flexible deployment without vendor lock-in
- NLTK handles deterministic noun extraction with POS tagging to meet non-LLM keyword extraction requirements
- SQLAlchemy ORM ensures database portability from SQLite to Postgres
- Structured logging (JSON output) and comprehensive error handling (graceful LLM failures, input validation) for production readiness
- SQLite over Postgres for simplicity, though SQLAlchemy abstraction makes migration trivial
- No authentication/authorization as not specified in requirements
- Minimal frontend styling to prioritize functionality over aesthetics
- Simple confidence heuristic (keyword overlap) rather than sophisticated NLP approach
- Focused test coverage on critical paths rather than exhaustive edge cases
- Missing production features like rate limiting, response caching, and comprehensive input sanitization would need to be addressed before deployment at scale