Below is a step-by-step tutorial on how to start your database_app_2.0 project, which includes both the backend (FastAPI) and the frontend (React). We’ll assume your folder structure looks like this:

~/Desktop/database_app_2.0/
    ├── backend/
    │    ├── main.py  (Your FastAPI code)
    │    ├── database.csv  (Optional original CSV)
    │    ├── ... other backend files ...
    ├── frontend/
    │    ├── src/
    │    │    ├── App.js  (Your React code)
    │    │    ├── uploadcsv.js (Optional upload component)
    │    ├── package.json
    │    ├── ... other frontend files ...
    └── ...

If your paths differ, just adjust them accordingly.


1. Start the Backend

1. Open a Terminal (on Mac, you can use Spotlight or Launchpad).

2. Navigate to your backend folder:

cd ~/Desktop/database_app_2.0/backend


3. (Optional) Activate your virtual environment if you have one:

source venv/bin/activate

You’ll see (venv) in your prompt if it’s activated.


4. Run the FastAPI server with uvicorn:

uvicorn main:app --reload --host 0.0.0.0 --port 3000

This starts your backend on http://localhost:3000.

You should see logs like:

INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)


5. Check http://localhost:3000/properties/ in your browser. If you see JSON (like [] or a list of objects), the backend is running fine.


Leave this Terminal open so the server keeps running. To stop it, press Ctrl + C.


2. Start the Frontend

1. Open a New Terminal window or tab (so the backend continues to run in the first one).

2. Navigate to your frontend folder:

cd ~/Desktop/database_app_2.0/frontend


3. Install dependencies if you haven’t already:

npm install


4. Start the React development server:

npm start

If your backend is on port 3000, Create React App usually picks port 3001 for the frontend.

If everything is correct, your default browser will open http://localhost:3000 or http://localhost:3001.

If you see a prompt like “Something is running on port 3000, run on port 3001 instead?” press Y.


3. Verify the App

Backend: http://localhost:3000/properties/ returns JSON data from FastAPI.

Frontend: Usually http://localhost:3001 if React had to pick a different port. You’ll see your React UI with tabs like “System,” “K/B,” etc.


4. Uploading Data & Checking Results

1. In your React UI, you’ll see a button or component (UploadCSV) to upload a new CSV.

2. Choose a CSV file (like TexasData.csv or database.csv).

3. After upload, open your backend logs (the Terminal where uvicorn runs) to see debug prints.

4. Go to your React app again, select the tab you want (enter the correct password if needed), and your new data should appear if it passes all filters.


5. Stopping the App

Frontend: In the Terminal where you ran npm start, press Ctrl + C.

Backend: In the Terminal where you ran uvicorn main:app –reload, press Ctrl + C.


Everything will shut down.


6. Summary

1. Backend:

cd ~/Desktop/database_app_2.0/backend
uvicorn main:app --reload --port 3000

(Activate your virtualenv if needed.)


2. Frontend (in a separate Terminal):

cd ~/Desktop/database_app_2.0/frontend
npm install
npm start


3. Open your browser to http://localhost:3001 (or whichever port React chooses) to see your UI.

4. Password-protected tabs, filters, and the new CSV upload should all work now.


That’s it! Let me know if you need any more details.

Database_app_2.0 Online

Below is a concise tutorial on how to run both your FastAPI backend and React frontend on a DigitalOcean droplet non-stop, so they continue running when you close your terminal or even reboot the server. We’ll use PM2 to manage both processes.


1. Prerequisites

You have your code on the droplet (e.g., database_app_2.0/backend and database_app_2.0/frontend).

Python is installed, along with your virtual environment for the backend.

Node.js is installed for the frontend.

PM2 is installed globally:

npm install -g pm2



2. Run the FastAPI Backend with PM2


A) Create a Start Script (Optional but Recommended)

1. Go to your backend folder:

cd ~/database_app_2.0/backend


2. Create a script start_backend.sh:

nano start_backend.sh


3. Paste:

#!/usr/bin/env bash
# Activate the Python venv
source venv/bin/activate
# Run FastAPI on port 8000
uvicorn main:app --host 0.0.0.0 --port 8000


4. Make it executable:

chmod +x start_backend.sh



B) Start with PM2

pm2 start ./start_backend.sh --name my-backend

–name my-backend helps you identify the process.


C) Verify & Save

pm2 status           # See if 'my-backend' is online
pm2 logs my-backend  # View logs if needed
pm2 save             # Save process list so it restarts on reboot



3. Run the React Frontend with PM2


A) Production Build (Recommended)

1. Go to your frontend folder:

cd ~/database_app_2.0/frontend


2. Install dependencies:

npm install


3. Build the app:

npm run build


4. Install serve (if not already):

npm install -g serve


5. Create start_frontend.sh (optional but cleaner):

nano start_frontend.sh


6. Paste:

#!/usr/bin/env bash
cd /root/database_app_2.0/frontend
serve -s build -l 3000


7. Make it executable:

chmod +x start_frontend.sh



B) Start with PM2

pm2 start ./start_frontend.sh --name my-frontend

C) Verify & Save

pm2 status           # Should see my-backend & my-frontend
pm2 logs my-frontend # If you want to see logs
pm2 save

Now your frontend is served at http://YOUR_DROPLET_IP:3000.


4. Keep Everything Running on Reboot

PM2 auto-start:

pm2 startup systemd

Copy/paste the suggested command.


Save your processes:

pm2 save



If you reboot the droplet:

reboot

When it comes back up, run:

pm2 status

Both my-backend and my-frontend should show “online.”


5. Test in Your Browser

1. Backend: http://YOUR_DROPLET_IP:8000 (or /properties/ etc.).

2. Frontend: http://YOUR_DROPLET_IP:3000.

Make sure your React app fetches from http://YOUR_DROPLET_IP:8000.


6. Useful PM2 Commands

List processes:

pm2 status


View logs:

pm2 logs my-backend
pm2 logs my-frontend


Restart a process:

pm2 restart my-backend


Stop a process:

pm2 stop my-frontend


Delete a process from PM2:

pm2 delete my-backend



Summary

1. Install PM2 globally.

2. Create small start scripts for backend (start_backend.sh) and frontend (start_frontend.sh).

3. Run them with pm2 start and give them names.

4. Save PM2 (pm2 save) and set up auto-start (pm2 startup systemd).

5. Done: Both the FastAPI backend (port 8000) and React frontend (port 3000) will keep running, even after you close the terminal or reboot. Enjoy!

Here’s how you can start your datamerge_app2 project located inside the Apps folder on your Desktop:

 


 

✅ Step-by-Step Instructions (Mac)

 

  1. Open Terminal.

  2. Navigate to the project folder:

cd ~/Desktop/Apps/datamerge_app2

 

  1.  

  2. Activate the virtual environment:

    Assuming your virtual environment is named venv and is inside datamerge_app2, run:

source venv/bin/activate

 

  1. You should see the prompt change to something like (venv).

  2. Start the app:

    If you’re using app.py as your main Flask file:

python app.py

 

  1. OR (alternative if you’re using Flask CLI):

export FLASK_APP=app.py
export FLASK_DEBUG=1
flask run

 

  1.  

  2. Access the app:

    Once running, open your browser and go to:

http://127.0.0.1:5000

 

 

Absolutely — now that we’re doing it right, here’s your full path every time you want to activate and run your app:


 

FULL PATH TO START YOUR APP


1. Open Terminal


2. Go to your app folder:

cd ~/Desktop/Apps/address_matcher



3. Activate the virtual environment:

source venv/bin/activate

(You’ll see (venv) appear at the start of your terminal prompt.)


4. Run the app:

python3 app.py



5. Open it in your browser:


Go to:

http://127.0.0.1:5000

✅ You’ll see the file upload screen, ready to match addresses.


🔥 Quick Recap

Step

Command

Purpose

1

cd ~/Desktop/Apps/address_matcher

Go to your project

2

source venv/bin/activate

Activate your virtual environment

3

python3 app.py

Run your app



Would you like me to also create a start.sh script (one single command) so you can just type ./start.sh and it does all 3 steps automatically? 🚀


It’s super easy if you want it.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.