A Flask REST API that connects people navigating housing challenges to nearby support, AI-generated guidance, and job opportunities.
This repository contains the backend API for RiseUp AI, a social-good project aimed at supporting individuals experiencing housing insecurity. It is a single-file Flask service (app.py) that exposes JSON endpoints consumed by a separate frontend (the configured CORS origins point at a Vite dev server and a Netlify deployment).
The API combines three capabilities: locating nearby community resources through the Google Places API, generating warm, personalized guidance with Google's Gemini model, and reading/writing records in MongoDB Atlas. It is compact and experimental in nature — a working prototype rather than a hardened production service.
Resource discovery — location-based lookups powered by the Google Places Nearby Search API (each returns up to 5 results):
| Method | Endpoint | Description |
|---|---|---|
POST |
/find_shelters |
Find nearby homeless shelters for a given latitude/longitude |
POST |
/find_medicare |
Find nearby government health facilities |
POST |
/find_food_donation |
Find nearby food donation centers |
AI-generated guidance — text generation via the Gemini model, with each result stored in MongoDB history:
| Method | Endpoint | Description |
|---|---|---|
POST |
/career_help |
Suggest 5 tailored career paths and action plans from a user profile |
POST |
/awareness_bulletin |
Produce a supportive community resource guide for a given city |
Data access — MongoDB-backed reads:
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Health check confirming the server is running |
GET |
/user_history |
Return all stored AI interaction history |
POST |
/search_jobs |
Search the business/job listings collection by keyword (case-insensitive) |
- Language: Python
- Framework: Flask + Flask-CORS
- Database: MongoDB Atlas (via PyMongo)
- AI: Google Gemini (
google-generativeai) - External APIs: Google Places API (via
requests) - Server: Gunicorn (see
Procfile)
- Python 3.x and
pip - A MongoDB Atlas connection string
- A Google API key with access to the Places API and the Gemini API
# Clone the repository
git clone https://github.com/2006-sk/Flasktest.git
cd Flasktest
# (Recommended) create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtCredentials (the MongoDB connection string and the Google/Gemini API key) are set directly inside app.py. Supply your own values there before running the server.
# Development server (runs on http://0.0.0.0:5001 with debug enabled)
python app.pyFor a production-style server, use Gunicorn as defined in the Procfile:
gunicorn app:appFlasktest/
├── app.py # Flask application: routes, MongoDB, Gemini & Places integration
├── requirements.txt # Python dependencies
├── Procfile # Process definition for Gunicorn deployment
└── .gitignore