Before you begin, ensure you have met the following requirements:
- Docker: Ensure that Docker is installed on your machine. You can check this by running:
docker --version
- Docker Compose (optional but recommended for multi-container setup): Check the installation by running:
docker-compose --version
If you prefer to run the application without Docker, you will need the following:
- Python 3.x: Ensure that Python 3 is installed on your machine. You can check this by running:
python3 --version
- Pip3: Ensure that pip3 (the package installer for Python) is installed. You can check this by running:
pip3 --version
- Node.js and npm: Ensure that Node.js and npm (Node Package Manager) are installed. You can check this by running:
node --version npm --version
Before running the application, create a .env file under the backend/ directory with the following environment variables:
ORGANIZATION_ID=your_organization_id_here
OPENAI_API_KEY=your_openai_api_key_here
Replace your_organization_id_here and your_openai_api_key_here with your actual values.
-
Navigate to the frontend directory:
cd ./frontend -
Build the Docker image:
docker build -t react-frontend .-t react-frontend: Tags the image with the namereact-frontend..: Refers to the current directory where the Dockerfile is located.
-
Run the Docker container:
docker run -p 80:80 react-frontend
-p 80:80: Maps port 80 of the host to port 80 of the container, allowing you to access the React app viahttp://localhost.
-
Navigate to the backend directory:
cd ./backend -
Build the Docker image:
docker build -t python-backend .-t python-backend: Tags the image with the namepython-backend.
-
Run the Docker container:
docker run -p 5000:5000 python-backend
-p 5000:5000: Maps port 5000 of the host to port 5000 of the container, allowing you to access the backend service viahttp://localhost:5000.
If you prefer to run the application manually without Docker, follow these steps:
-
Install the required Python dependencies:
pip3 install -r requirements.txt
-
To run the backend:
python3 run.py
-
Navigate to the frontend directory and install the required Node.js dependencies:
cd frontend npm install -
To run the React frontend, start the development server:
npm start
This will start the React development server, typically on
http://localhost:3000. Open this URL in your web browser to view the application.
-
To start both services with Docker Compose:
docker-compose up
-
To stop the services:
docker-compose down
Follow the manual setup steps outlined above for the backend and frontend.
- If you encounter any issues with Docker, ensure that Docker and Docker Compose are installed and running correctly.
- For manual setup, ensure all prerequisites are installed, and environment paths are set correctly.