The backend for the Business Search Tool, built with Python and the FastAPI framework. This backend serves as the API for the frontend to retrieve information about businesses in a specific area of the US.
The backend API performs the following steps to retrieve information about businesses in a specific area:
- Calls the Google Places textsearch API with a text search string based on frontend queries to get back a list of businesses that have place IDs and a little bit of other information.
- Filters the list by total number of reviews.
- Calls the Google Place Details API for each place ID to get the business's website.
- Returns the list of websites and number of reviews associated with each place to the frontend.
Follow these steps to get the backend API up and running on your local machine.
- Clone the repository
- Navigate to the backend directory
- Install the dependencies:
pip install -r requirements.txt
- Set the Google Places API Key as an environment variable:
export API_KEY="your_api_key_here"
- Start the development server:
uvicorn main:app --reload
- Access the API at
http://localhost:8000/docs
The backend is hosted on Google Cloud Run via a Docker container. Follow the documentation for Google Cloud Run to deploy the backend API. Ensure you have a correctly written Dockerfile in your source directory. ALSO when deploying the container to any cloud service, check the service settings to ensure it is listening on the correct HTTP (10000) to match the container.
This project is open for contributions. Feel free to open an issue or submit a pull request.