A full-stack application with a Next.js frontend and Python FastAPI backend, designed to help users improve their handwriting through AI-powered photo analysis and personalized practice exercises.
- AI-Powered Photo Analysis: Upload photos of your handwriting for instant feedback
- Letter Detection: Identifies specific letters that need improvement
- Quality Assessment: Provides scores and detailed feedback on spacing, consistency, and readability
- Personalized Suggestions: AI-generated improvement tips tailored to your writing
- Smart Practice Sentences: OpenAI-generated sentences with frequent target letter occurrences
- Difficulty Levels: Beginner, Intermediate, and Advanced practice content
- Personalized Practice Plans: Focus on letters that need the most improvement
- Practice Tips: AI-generated guidance for better handwriting
- Secure Authentication: JWT-based login system with Supabase
- Progress Tracking: Monitor your handwriting improvement over time
- Sample History: Keep track of all your uploaded handwriting samples
- Responsive Design: Works perfectly on desktop, tablet, and mobile
- Beautiful Interface: Clean, modern design with smooth animations
- Intuitive Navigation: Easy-to-use dashboard and practice interface
letterbuddy/
βββ frontend/ # Next.js 15 Frontend Application
β βββ src/
β β βββ app/ # App Router pages
β β β βββ (auth)/ # Authentication pages
β β β βββ (dashboard)/ # Protected dashboard pages
β β β βββ upload/ # Handwriting upload
β β βββ components/ # Reusable UI components
β β βββ context/ # React context providers
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utility functions and API
β β βββ styles/ # Global styles and Tailwind CSS
β βββ public/ # Static assets and favicon
β βββ package.json # Node.js dependencies
β βββ Dockerfile # Frontend container
βββ backend/ # Python FastAPI Backend
β βββ app/
β β βββ routes/ # API endpoints
β β β βββ auth.py # Authentication routes
β β β βββ handwriting.py # Handwriting analysis & practice
β β β βββ letters.py # Letter management
β β β βββ users.py # User management
β β βββ __init__.py
β βββ requirements.txt # Python dependencies
β βββ main.py # FastAPI application
β βββ Dockerfile # Backend container
βββ docker-compose.yml # Multi-service orchestration
βββ README.md # This file
- Docker Desktop
- Docker Compose
git clone <repository-url>
cd letterbuddyCreate a .env file in the root directory:
# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Database Configuration
DATABASE_URL=postgresql://letterbuddy:letterbuddy123@localhost:5432/letterbuddy
# Secret Key for JWT tokens
SECRET_KEY=your-secret-key-here-change-in-production
# Environment
ENVIRONMENT=development# Load environment variables and start services
source .env && docker-compose up --build -dThis will start:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- PostgreSQL: localhost:5432
- Open http://localhost:3000 in your browser
- API documentation available at http://localhost:8000/docs
cd frontend
npm install
npm run devcd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Database Configuration
DATABASE_URL=postgresql://letterbuddy:letterbuddy123@localhost:5432/letterbuddy
# Secret Key for JWT tokens
SECRET_KEY=your-secret-key-here-change-in-production
# Environment
ENVIRONMENT=developmentNEXT_PUBLIC_API_URL=http://localhost:8000Once the backend is running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
POST /auth/register- User registrationPOST /auth/login- User authentication
POST /handwriting/analyze- Analyze handwriting from photoPOST /handwriting/practice-sentences- Generate AI practice sentencesGET /handwriting/demo- Get demo analysis response
GET /users/me- Get current user infoPUT /users/me- Update user profile
GET /letters- Get user lettersPOST /letters- Create new letter
The application uses PostgreSQL with the following main tables:
- users - User accounts and authentication
- user_uploads - Handwriting samples and analysis results
- user_letters_to_improve - Letters that need practice
- letters - User-created letters
Database migrations are handled automatically on startup.
# Start all services in background
docker-compose up -d
# Start with rebuild
docker-compose up --build -d
# View logs
docker-compose logs -f [service-name]
# Stop all services
docker-compose down
# Restart specific service
docker-compose restart [service-name]# Check status
docker-compose ps
# View logs for specific service
docker logs letterbuddy-backend-1 -f
docker logs letterbuddy-frontend-1 -f
docker logs letterbuddy-postgres-1 -fcd backend
pytestcd frontend
npm testdocker-compose -f docker-compose.prod.yml up -d# Backend only
docker-compose up backend
# Frontend only
docker-compose up frontend- JWT-based authentication with Supabase
- Password hashing with bcrypt
- CORS configuration for production domains
- Environment-based configuration
- Input validation with Pydantic
- Secure file upload handling
- Next.js 15 - React framework with App Router
- Tailwind CSS - Utility-first CSS framework
- Supabase - Authentication and database
- React Context - State management
- FastAPI - Modern Python web framework
- OpenAI GPT-4 - AI-powered content generation
- PostgreSQL - Reliable database
- Pillow - Image processing
- Uvicorn - ASGI server
- Docker - Containerization
- Docker Compose - Multi-service orchestration
- PostgreSQL - Database service
- AI-powered handwriting analysis β
- Personalized practice sentences β
- User authentication system β
- Progress tracking β
- Modern responsive UI β
- Letter templates
- Export functionality
- Mobile app
- Advanced analytics
- Social features
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests if applicable
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
For support and questions:
- Create an issue in the repository
- Check the API documentation at http://localhost:8000/docs
- Review the code examples in the source code
- Sign Up: Create your LetterBuddy account
- Upload Sample: Take a photo of your handwriting and upload it
- Get Analysis: Receive AI-powered feedback on your writing
- Practice: Use AI-generated sentences to improve specific letters
- Track Progress: Monitor your improvement over time
- Upload Again: Submit new samples to see your progress
Start your handwriting improvement journey today! π