PhotoManagement is a photo organization app with three services:
- A Django backend for photo, album, search, and stats APIs
- A FastAPI ML engine for captioning, face detection, text embeddings, and album tagging
- A React frontend for browsing, uploading, searching, and managing photos
The app uses PostgreSQL for persistence, S3 for image storage, Pinecone for vector search, and AI services for automatic image understanding.
- Upload photos and automatically generate captions
- Detect faces and store face embeddings
- Search photos with natural language queries
- Suggest album tags from image captions
- List photos and albums from the web UI
- Fetch photo images through presigned S3 URLs
backend/- Django API and photo service logicfrontend/- React single-page appml_engine/- FastAPI service for captioning and embedding taskssetup.md- PostgreSQL bootstrap notes
- Python 3.11 or newer
- Node.js 18 or newer
- PostgreSQL
- Access to S3, Pinecone, and OpenAI credentials for full functionality
Create a .env file in backend/ for the Django service and another .env file in ml_engine/ for the ML service.
Common backend environment variables:
DJANGO_SECRETDB_NAMEDB_USERDB_PASSWORDDB_HOSTDB_PORTAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGIONS3_BUCKET_NAMEPINECONE_API_KEYPINECONE_IMAGE_INDEX_HOSTPINECONE_FACE_INDEX_HOST
Common ML engine environment variables:
OPENAI_API_KEY
The frontend uses REACT_APP_API_URL when you want to point it at a backend host other than http://localhost:9000.
The included setup.md file shows the PostgreSQL bootstrap steps used by the project. In short, create the database, user, and schema, then run Django migrations from the backend directory.
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migratecd ml_engine
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtcd frontend
npm installRun each service in its own terminal:
# Backend
cd backend
python -m uvicorn photo_backend.asgi:application --host 0.0.0.0 --port 9000 --reload
# ML engine
cd ml_engine
python -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload
# Frontend
cd frontend
npm startBy default, the frontend talks to the backend at http://localhost:9000.
Backend routes are mounted under /api/.
POST /api/query/- natural language photo searchPOST /api/upload/- upload and process an imagePOST /api/caption/- generate an image captionPOST /api/face/- detect faces in an imagePOST /api/albumization/- generate album tags from a captionGET /api/photos/- list photosGET /api/photos/<photo_id>/- get photo detailsGET /api/albums/- list albumsGET /api/albums/<album_id>/- get album detailsGET /api/albums/<album_id>/photos/- list photos in an albumGET /api/stats/- fetch dashboard statistics
- The upload flow can continue even if S3 or Pinecone operations fail, but the request will still return the processing result when possible.
- The ML engine loads large models at startup, so the first launch can take time.
- Some frontend routes depend on backend endpoints and external services being available.
See LICENSE for project licensing details.