Wildlife Sightings Tracker

This repository contains the code for a project with separate directories for the backend and frontend components. The backend is built using Flask, a Python web framework, while the frontend is developed using React Js.

Installation

Backend

  1. Clone the repository:
$ git clone https://github.com/AMuriuki/wildlife_sightings_tracker
  1. Navigate to the backend directory
$ cd wildlife_sightings_tracker/backend
  1. Create a virtual environment
$ python3 -m venv venv
  1. Activate the virtual environment:
  • For Windows:
$ venv\Scripts\activate
  • For macOS/Linux:
$ source venv/bin/activate
  1. Install the required Python packages
$ pip install -r requirements.txt
  1. Run DB migrations
$ flask db upgrade #(uses sqlite as default DB)
  1. Seed DB with dummy data
$ flask dummy load-data
  1. Run the development server
$ flask run

The backend server should now be running on http://localhost:5000, copy and paste the url on your browser to view the API's documentation.

Frontend

Open a different terminal and follow these steps:

  1. Navigate to the frontend directory:
$ cd wildlife_sightings_tracker/frontend
  1. Install Node.js and npm if not already installed

  2. create and populate the .env file.

$ echo "REACT_APP_BASE_API_URL=http://localhost:5000" > .env
  1. Install the project dependencies:
$ npm install
  1. Start the development server:
$ npm start

Usage

Once both the backend and frontend servers are running, you can interact with the application by accessing http://localhost:3000 in your web browser. The frontend communicates with the backend through API endpoints provided by the Flask server.