A FastAPI-based backend that collects and summarizes items. Reviews are stored in a PostgreSQL database, and summaries are generated using a local Ollama model mistral
.
- Submit and store detailed reviews
- Generate natural language summaries using LLM
- FastAPI for RESTful endpoints
- PostgreSQL as the backend database
- Docker support for consistent setup
Before you begin, make sure you have the following installed:
-
Ollama installed locally
-
Pull the model you'll be using:
ollama pull mistral
-
Python 3.11+ (optional, for local development)
Create a .env
file in the root directory of your project:
POSTGRES_USER=youruser
POSTGRES_PASSWORD=yourpassword
POSTGRES_DB=yourdb
DB_HOST=yourdb
DB_PORT=yourport
This is used by both the FastAPI app and the PostgreSQL database.
Run this from the root of your project:
docker-compose up --build
This will:
- Build the FastAPI container (
web
) - Start PostgreSQL using the official
postgres:16
image - Mount and initialize the database from
docker-entrypoint-initdb.d/
- Run your FastAPI app at
http://localhost:8000
- Arbitrarily set port as 15432 to avoid conflict with 5432- you may need to set a different port in yml if you're already using 15432
Ollama must be installed and running on your host machine, not inside Docker.
Start it separately:
ollama serve
Ensure you’ve pulled the required model (e.g. mistral):
ollama pull mistral
Once running:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
.
├── app/
│ ├── main.py # FastAPI routes
│ ├── db.py # DB connection and insert functions
│ └── summarize.py # Ollama summarizer logic
├── docker-entrypoint-initdb.d/
│ ├── 01-schema.sql # SQL setup
│ └── 02-seed.sql # Sample data
├── requirements.txt
├── Dockerfile
├── docker-compose.yml
├── .env
└── README.md
If you're not using Docker, you can run the app locally like this:
python -m venv venv
source venv/bin/activate # or 'venv\Scripts\activate' on Windows
pip install -r requirements.txt
uvicorn app.main:app --reload
- Add authentication (JWT, OAuth)
- Use HTTPS via reverse proxy like Nginx
- Salt + hash passwords securely
- Disable direct DB port access in production
- Data Science – James Kim
- Backend – Austin Myers
- Cybersecurity – Xavier Gutter
- Design/UX – Chavis Ferguson
This project is private and proprietary. All rights reserved.
Feel free to open issues or pull requests for improvements or bugs.