Prerequisites
Before you begin, ensure you have the following installed on your system:Docker
Docker 20.10+ for container management
Docker Compose
Docker Compose v2.0+ for orchestration
Git
Git for cloning the repository
Node.js (Optional)
Node 20+ if developing outside Docker
For GPU acceleration with Ollama (optional), you’ll need:
- NVIDIA GPU with 8GB+ VRAM
- NVIDIA Docker runtime installed
Installation
Configure Environment Variables
Copy the example environment file and configure your settings:Edit the
.env file with your preferred settings:.env
Build Docker Containers
Build all the Docker images for the application:This will build the following services:
- Backend - FastAPI application with Python dependencies
- Frontend - Next.js application with Node.js
- PostgreSQL - Database server
- Ollama - LLM inference engine
- Adminer - Database management interface
Start the Application
Launch all services using Docker Compose:Wait for all services to start. You should see logs indicating:
- PostgreSQL is ready to accept connections
- FastAPI server is running
- Next.js has compiled successfully
Download the Ollama Model
In a new terminal, download the required LLM model inside the Ollama container:Verify the model was downloaded:
The first download may take several minutes depending on your internet connection. The model is approximately 4-5GB.
Run Database Migrations
Apply database migrations to set up the schema:This creates all necessary tables for users, recipes, meal plans, and more.
Accessing the Application
Once all services are running, you can access SmartEat AI through the following URLs:Frontend Application
http://localhost:3000Main user interface for SmartEat AI
Backend API
http://localhost:8000FastAPI backend service
API Documentation
http://localhost:8000/docsInteractive Swagger UI for API testing
Database Admin
http://localhost:8080Adminer interface for database management
API Endpoints
Test the backend health:Using SmartEat AI
Create an Account
Navigate to http://localhost:3000 and register a new account with your email and password.
Complete Your Profile
After logging in, you’ll be prompted to complete your profile with:
- Biometric data (weight, height, age, gender)
- Activity level (sedentary, moderate, active)
- Nutritional goals (weight loss, maintenance, muscle gain)
- Dietary preferences and restrictions (vegan, allergies, etc.)
- Number of meals per day
Generate Your Meal Plan
Use the Chat feature to interact with Smarty and request a personalized meal plan:
“Create a weekly meal plan for me based on my profile”The AI will generate a complete weekly plan with breakfast, lunch, dinner, and snacks tailored to your needs.
View Your Dashboard
The Dashboard displays today’s meals. Mark meals as consumed to track your daily nutritional progress with real-time updates.
Docker Container Management
Viewing Logs
Monitor logs for specific services:Stopping the Application
Stop all services:Restarting Services
Restart a specific service without rebuilding:Development Workflow
Backend Development
If you prefer to develop the backend outside Docker:Frontend Development
For frontend development outside Docker:When developing outside Docker, update your
.env file to point to localhost instead of Docker service names:DATABASE_URL=postgresql://smarteatai:smarteatai@localhost:5432/smarteataiOLLAMA_BASE_URL=http://localhost:11434
Troubleshooting
Ollama fails to start with GPU
Ollama fails to start with GPU
If you don’t have an NVIDIA GPU or proper drivers, comment out the
deploy section in docker-compose.yml under the ollama service to use CPU-only mode.Database connection errors
Database connection errors
Ensure PostgreSQL is fully started before running migrations. Wait for the log message:
Port conflicts
Port conflicts
If ports 3000, 8000, 8080, 5432, or 11434 are already in use, modify the port mappings in
docker-compose.yml:Model download fails
Model download fails
If
ollama pull fails, check your internet connection and try:Next Steps
Now that you have SmartEat AI running, explore these resources:API Reference
Explore the complete API documentation
Architecture
Learn about the system architecture
Machine Learning
Understand the ML recommendation pipeline
GitHub Repository
View source code and contribute
For additional help, refer to the detailed README files in the
backend/ and frontend/ directories, or check the project presentation.