Skip to content

sfbrigade/datasci-earthquake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a project of SF Civic Tech https://www.sfcivictech.org/

Introduction

This is a hybrid Next.js + Python app that uses Next.js as the frontend and FastAPI as the API backend.

Getting Started

First, install the dependencies:

npm install
# or
yarn
# or
pnpm install

Then, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open https://localhost:3000 with your browser to see the result.

The FastApi server will be running on https://127.0.0.1:8000 – feel free to change the port in package.json (you'll also need to update it in next.config.js).

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!


Docker

This project uses Docker and Docker Compose to run the application, which includes the frontend, backend, and postgres database.

Prerequisites

  • Docker: Make sure Docker is installed on your machine. Get Docker.
  • Docker Compose: Ensure Docker Compose is installed (usually included with Docker Desktop).

Starting the Application

  1. Run Docker Compose: From the project root directory (where the docker-compose.yml file is located), run: docker-compose up -d This will:
  • Build the necessary Docker images (if not already built).
  • Start all services defined in the docker-compose.yml file (e.g., frontend, backend, database).
  1. Access the Application:

Shutting Down the Application

To stop and shut down the application:

  1. Stop Docker Compose: In the same directory where the docker-compose.yml file is located, press Ctrl + C in the terminal where the app is running.

  2. Bring Down the Containers: If you want to stop and remove the containers completely, run: docker-compose down This will:

    • Stop all services.
    • Remove the containers, but it will not delete volumes (so the database data will persist).

Configuration of environment variables

The .env.local file contains environment variables used in the application to configure settings for both the backend and frontend components. If it contains sensitive information, .env.local should not be checked into version control for security reasons. Right now there is no sensitive information but later secret management tools will be introduced. The file is organized into three main sections:

  • Postgres Environment Variables. This section contains the credentials to connect to the PostgreSQL database, such as the username, password, and the name of the database.
  • Backend Environment Variables. These variables are used by the backend (i.e., FastAPI) to configure its behavior and to connect to the database and the frontend application.
  • Frontend Environment Variables. This section contains the base URL for API calls to the backend and NODE_ENV variable that determines in which environment the Node.js application is running.

Disclaimer

Some versions of this code contain a streamlit app that uses an imprecise measure which may introduce errors in the output. The streamlit app should not be relied upon to determine any property’s safety or compliance with the soft story program. Please consult DataSF for most up to date information.