NomAI is a powerful Agent that brings nutrition and food intelligence to life using AI. Whether you're analyzing meals through images or chatting with an AI assistant about health, NomAI handles the heavy lifting.
- 🧠 AI Nutrition Analysis — Understand food composition from text or food description.
- 💬 Conversational AI Chatbot — Talk about food, health, and lifestyle.
- 🔗 RESTful APIs — Simple and scalable endpoints for frontend integration.
- 🛢️ Database-Driven — PostgreSQL for chat storage.
git clone https://github.com/Pavel401/nomai-backend.git
cd nomai-backend
uv sync
cp env_template .env
Fill in the values:
OPENAI_API_KEY=your_openai_key
POSTGRESQL_DB_URL=your_db_url
DB_KEY=your_db_secret
SUPABASE_URL=your_supabase_url
PROD=false # use true for production
uvicorn main:app --host 0.0.0.0 --port 8080 --reload
POST /nutrition/get
→ Analyze food input (image or text) and return nutritional breakdown.
-
GET /chat/
→ Web-based chat interface (TypeScript powered). -
GET /chat/messages
→ Fetch chat history (stored in Supabase). -
POST /chat/messages
→ Send and store a new chat message.
nomai-backend/
├── app/
│ ├── agent/ # Core AI agent logic
│ ├── config/ # App settings & env
│ ├── endpoints/ # API route handlers
│ ├── exceptions/ # Custom error handling
│ ├── middleware/ # FastAPI middleware
│ ├── models/ # Pydantic data models
│ ├── services/ # Business logic layer
│ ├── static/ # Frontend files (HTML, TypeScript)
│ ├── tools/ # AI tools & utilities
│ └── utils/ # Helpers and shared utilities
├── main.py # App entrypoint
├── env_template # Sample env vars
├── Procfile # Heroku deployment
├── runtime.txt # Python runtime version
├── railway.json # Railway deployment config
└── README.md # Project documentation
Tech | Use Case |
---|---|
FastAPI | API framework |
OpenAI GPT-4 | Chat & nutrition analysis |
Pydantic-AI | Agent management & orchestration |
PostgreSQL | Primary database |
Supabase | Chat message storage |
TypeScript | Chat frontend |
Python 3.13+ | Core backend language |