SmartCart is a GenAI-powered grocery assistant that helps users navigate stores, check inventory in real-time, and build shopping lists through natural language interaction. It’s built with Flask and OpenAI APIs and now fully deployed to Azure using modern IaC principles with OpenTofu.
- 🚀 Key Features
- 🏗️ Architecture
- 🛠️ Getting Started
- ☁️ Deployment (Azure w/ IaC)
- 🤝 Contributing
- 📜 License
- 🙋♂️ Authors
| Feature | Description |
|---|---|
| 🔐 User Authentication | Supports login via username/password |
| 🛠️ Admin Panel | Upload inventory via CSV, manage store profile, update agent |
| 🤖 OpenAI Assistants | Custom assistant per store, vector search via embedded inventory |
| 💬 Chatbot Interface | Persistent sessions, history stored in PostgreSQL |
| 📦 Inventory Insights | Ask about item availability, pricing, location, and list management |
| 📱 Responsive UI | Bootstrap + custom CSS |
SmartCart/
├─ app/
│ ├─ extensions.py # Flask extension setup
│ ├─ models/ # SQLAlchemy models
│ ├─ services/ # OpenAI + assistant utils
│ ├─ routes/ # Flask Blueprints
│ ├─ static/css/ # Styles
│ └─ templates/ # Jinja2 views
├─ config.py # App config loader
├─ app.py # Dev entrypoint
├─ wsgi.py # Gunicorn production entry
├─ IaC/ # OpenTofu infrastructure setup for Azure
├─ requirements.txt
├─ Dockerfile
└─ README.md
- Python ≥ 3.10
- PostgreSQL (Azure Flexible Server recommended)
- OpenAI API key
- Google OAuth credentials (optional)
git clone https://github.com/gcarson1/SmartCart.git
cd SmartCart
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtCreate a .env file with the following:
SECRET_KEY=your-secret-key
DATABASE_URL=postgresql://USER:PASSWORD@HOST:PORT/DATABASE
OPENAI_API_KEY=sk-...
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...python - << 'EOF'
from app import create_app
from app.extensions import db
app = create_app()
with app.app_context():
db.create_all()
EOFpython app.py # Development mode
# or
gunicorn -b 0.0.0.0:8080 wsgi:app # ProductionVisit http://localhost:8080 to interact with SmartCart.
Recommended: Run in a Docker container with the Dockerfile.
This project now uses OpenTofu to manage Azure resources declaratively.
- Azure App Service (Python 3.10)
- Azure PostgreSQL Flexible Server
- Azure Key Vault for secret management
- Azure Storage (optional)
- Managed Identity access
-
Clone and navigate into the
IaCdirectory:cd IaC -
Initialize and apply the infrastructure:
tofu init tofu apply
-
Set environment variables in Azure via
appsettingsor Key Vault bindings:SECRET_KEYDATABASE_URLOPENAI_API_KEY- etc.
-
Push your code to Azure via GitHub Actions, ZipDeploy, or
az webapp deployment source.
Licensed under the MIT License. See LICENSE for details.
- Gabriel Carson – Cloud Engineer Intern & CS Student – GitHub