How saidattaputta/writewise-ai works
WriteWise AI is a full-stack professional letter-generation application. Users provide recipient, purpose, tone, and requirements; the backend validates the request, builds a prompt, calls Gemini, parses the response, and returns a letter that can be saved and later retrieved or deleted. Authentication supports registration and login with hashed passwords and JWTs. The README also documents templates and user/profile capabilities, but their frontend implementation is not represented in the supplied tree. Backend wiring is summarized from the README and module layout; only selected source files were sampled.
Main entry points: letters.py Letter endpoints · router.py Versioned API router · auth.py Auth endpoints · ai_service.py AI service
Components 21
Client
- Auth client
frontend/src/services/authService.ts - Writing UI, templates, history
API and identity
- Application entry
backend/app/main.py - Versioned API router
backend/app/api/v1/router.py - Auth endpoints
backend/app/api/v1/endpoints/auth.py - Letter endpoints
backend/app/api/v1/endpoints/letters.py - Auth service
backend/app/services/auth_service.py - JWT and password security
backend/app/auth - Auth schemas
backend/app/schemas/auth.py
Writing pipeline
- Letter schemas
backend/app/schemas/letter.py - AI service
backend/app/services/ai_service.py - Prompt builder
backend/app/ai/prompt_builder.py - Gemini client
backend/app/ai/llm_client.py - Response parser
backend/app/ai/parser.py
Persistence
- User repository
backend/app/repositories/user_repository.py - Letter repository
backend/app/repositories/letter_repository.py - User model
backend/app/models/user.py - Letter model
backend/app/models/letter.py - PostgreSQL
Other components
- User
- Gemini API
Connections 25
- User → Auth client: registers or logs in
- Auth client → Versioned API router: sends auth requests
- User → Writing UI, templates, history: provides writing inputs
- Writing UI, templates, history → Versioned API router: calls REST API
- Application entry → Versioned API router: mounts routes
- Versioned API router → Auth endpoints: dispatches auth
- Versioned API router → Letter endpoints: dispatches letters
- Auth endpoints → Auth schemas: validates requests
- Letter endpoints → Letter schemas: validates requests
- Auth endpoints → Auth service: delegates auth
- Auth service → JWT and password security: hashes and signs
- Auth service → User repository: looks up or creates
- User repository → PostgreSQL: reads and writes
- Letter endpoints → AI service: requests generation
- AI service → Prompt builder: builds prompt
- AI service → Gemini client: generates text
- Gemini client → Gemini API: sends prompt
- Gemini API → Gemini client: returns response
- AI service → Response parser: cleans response
- Letter endpoints → Letter repository: stores and retrieves
- Letter repository → PostgreSQL: reads and writes
- User repository → User model: maps user records
- Letter repository → Letter model: maps letter records
- Letter endpoints → Writing UI, templates, history: returns letter results
- Auth endpoints → Auth client: returns token or user