Prerequisites
Before you begin, ensure you have the following installed on your system:- Node.js 20+ - For the frontend application
- Python 3.9+ - For the backend API
- PostgreSQL 15 - Database server
- Git - For cloning the repository
If you prefer using Docker, see the Docker Setup guide for containerized development.
Cloning the Repository
Clone the SmartEat AI repository to your local machine:Environment Configuration
Copy the example environment file and configure your local settings:.env file with your local credentials. See the Environment Variables reference for detailed descriptions of each variable.
Make sure to update the
SECRET_KEY with a secure random string before running in production.Backend Installation
Install Python dependencies
- FastAPI - Web framework
- SQLAlchemy - Database ORM
- Alembic - Database migrations
- scikit-learn, joblib - ML models
- LangChain, LangGraph - AI agents
(Optional) Seed the database
Populate the database with sample data:This inserts users, categories, profiles, recipes, and meal plans.
Start the backend server
- API: http://localhost:8000
- Swagger Docs: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Backend Health Check
Verify the backend is running correctly:Frontend Installation
Install Node dependencies
- Next.js - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- React Context API - State management
Start the development server
Verification
Once both services are running, you should be able to:- Access the frontend at http://localhost:3000
- Create a new user account
- Log in and complete your profile
- View the dashboard and interact with the chat
The frontend needs the backend API to be running to function properly. Make sure both services are started.
Database Migrations
Whenever you modify database models, create and apply migrations:Development Tools
API Documentation
- Swagger UI: http://localhost:8000/docs - Interactive API documentation
- ReDoc: http://localhost:8000/redoc - Alternative API documentation
Code Quality
The frontend includes ESLint and Prettier for code quality:Troubleshooting
Backend Issues
Database connection errors- Verify PostgreSQL is running
- Check
DATABASE_URLin.envmatches your PostgreSQL credentials - Ensure the database exists:
createdb smarteatai
- Delete the
alembic/versionsfolder and start fresh - Check for model conflicts in
backend/app/models/
Frontend Issues
Port already in useNext Steps
- Configure Docker Setup for containerized development
- Review Environment Variables for advanced configuration
- Explore the API documentation at http://localhost:8000/docs
