A smart, plant-only AI assistant for plant care, Q&A, and management. PlantPal helps you keep your plants healthy with personalized care recommendations, AI-powered diagnosis, and comprehensive plant management tools.
- Plant Profiles: Create detailed profiles for each plant with species, location, and care requirements
- Care Tracking: Log watering, fertilizing, pruning, and other care activities
- Photo Storage: Upload and store plant photos for diagnosis and history
- Care Scheduling: Set up automated care reminders and tasks
- Plant Diagnosis: Analyze uploaded photos via AI (RAG-supported)
- Care Recommendations: Personalized, context-aware care advice
- Q&A Chat: Conversational assistant with session-aware context
- Conversation History: Persistent sessions for better continuity
- Overview: See all plants and their status at a glance
- Care History: Track activities and health over time
- Task Management: Create/complete scheduled care tasks
- Auth: Registration, login, and logout
- Profiles: Store user preferences and location
PlantPal is built with FastAPI following a layered architecture.
plantpal_app/
├── alembic/ # Database migrations
├── forms/ # Form parsing/validation
├── models/ # SQLAlchemy ORM models
├── plant_pal_bot/ # AI bot + RAG pipeline
├── repositories/ # Data access layer
├── routers/ # Feature routers (FastAPI)
├── schemas/ # Pydantic models (I/O)
├── services/ # Business logic
├── static/ # CSS, images, JS
├── templates/ # Jinja2 templates (UI)
├── utils/ # Helpers, logging, markdown
├── database.py # DB session + engine
├── main.py # FastAPI application
├── settings.py # App config (env-based)
└── requirements.txt # Python dependencies
- Python 3.10+
- PostgreSQL 12+
- OpenAI API key
-
Clone the repository
git clone <repository-url> cd plantpal_app
-
Create a virtual environment
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment
- Copy
example.envto.envand fill values:
# Database db_hostname=localhost db_port=5432 db_username=your_username db_password=your_password db_name=plantpal # Security secret_key=your_secret_key_here algorithm=HS256 access_token_expire_minutes=720 # OpenAI / Embeddings open_ai_key=your_openai_api_key open_ai_model=gpt-4o-mini # example embedding_model=text-embedding-3-small embedding_dim=1536 # Storage gallery_dir=static/gallery thumbnail_dir=static/gallery/thumbnails
- Copy
-
Initialize database
createdb plantpal alembic upgrade head
-
Run the app
uvicorn main:app --reload --host 0.0.0.0 --port 8000
-
Access
- UI Home: http://localhost:8000
- Login: http://localhost:8000/login
- Dashboard: http://localhost:8000/dashboard
- AI Chat: http://localhost:8000/ai_chat
- Photo Gallery: http://localhost:8000/photo_gallery
- API Docs: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
GET /register- Registration formPOST /register- Register userGET /login- Login formPOST /login- Authenticate userGET /logout- Logout
GET /dashboard/- Dashboard pagePOST /dashboard/tasks- Create care task (JSON)POST /dashboard/tasks/{task_id}/complete- Complete task (JSON)POST /dashboard/add_plant- Add plant (form)
GET /plants/- List current user's plantsGET /plants/{plant_id}- Get plant detailsPUT /plants/{plant_id}- Update plantDELETE /plants/{plant_id}- Delete plant
GET /ai_chat- Chat page (renders history, plants)POST /ai_chat- Send message (supports optional photo upload; AJAX JSON supported)
GET /photo_gallery- Photo gallery pagePOST /analyze_photo/{photo_id}- Analyze a specific photo (returns JSON)DELETE /delete_photo/{photo_id}- Delete a photoGET /photo/{photo_id}/diagnosis- Get diagnosis JSON for a photo
GET /api/user_photos?limit=20- List recent photos with diagnosis flagsPOST /api/quick_analyze- Quick analyze most recent photo
- Models (
models/): SQLAlchemy entities - Schemas (
schemas/): Pydantic v2 models - Routers (
routers/): Route handlers per feature - Services (
services/): Orchestrate domain logic - Repositories (
repositories/): DB CRUD and queries - Templates/Static: UI pages and assets
users,plants,plant_photoscare_logs,plant_care_tasks,task_completion_historyai_logs,ai_responses,conversation_sessionsphoto_diagnoses,photo_embeddings,diagnosis_feedback
| Variable | Description | Example/Default |
|---|---|---|
db_hostname |
DB host | Required |
db_port |
DB port | Required |
db_username |
DB user | Required |
db_password |
DB password | Required |
db_name |
DB name | Required |
secret_key |
JWT secret | Required |
algorithm |
JWT algorithm | HS256 |
access_token_expire_minutes |
Token TTL | 720 |
open_ai_key |
OpenAI API key | Required |
open_ai_model |
Chat model | gpt-4o-mini |
embedding_model |
Embedding model | text-embedding-3-small |
embedding_dim |
Embedding size | 1536 |
gallery_dir |
Photos folder | static/gallery |
thumbnail_dir |
Thumbs folder | static/gallery/thumbnails |
- Fork the repository
- Create a feature branch (
git checkout -b feature/<name>) - Commit (
git commit -m "feat: ..."), push, open a PR
- Follow PEP 8 and add type hints
- Write docstrings and tests for new features
- Keep routes thin; prefer services/repositories
MIT (see LICENSE)
- Docs at
/docs - Open issues for bugs/requests
Made with ❤️ for plant lovers everywhere