This application consists of a React frontend and a Flask backend for translating slang terms and sentences.
- Node.js (v18 or later)
- Python (v3.7 or later)
- pip (Python package manager)
-
Navigate to the backend directory:
cd backend
-
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required Python packages:
pip install -r requirements.txt
-
Start the Flask server:
python app.py
The backend server should now be running on
http://localhost:5555
.
-
Open a new terminal window and navigate to the frontend directory:
cd frontend
-
Install the required npm packages:
npm install
-
Start the development server:
npm run dev
The frontend application should now be running on
http://localhost:5173
.
Open your web browser and go to http://localhost:5173
to use the Slang Translator application.
To run the application using Docker Compose:
-
Make sure you have Docker and Docker Compose installed on your system.
-
Navigate to the root directory of the project (where the
docker-compose.yml
file is located). -
Build and start the containers:
docker-compose up --build
-
Once the containers are up and running, you can access the application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:5555
-
To stop the application, press
Ctrl + C
in the terminal where docker-compose is running, or run:docker-compose down
This method will start both the frontend and backend services in containers, making it easy to run the entire application stack with a single command.
To stop the application:
- In the terminal running the frontend, press
Ctrl + C
. - In the terminal running the backend, press
Ctrl + C
. - If you created a virtual environment for the backend, deactivate it:
deactivate
The frontend uses an environment variable for the API URL. If you need to change the backend URL, create a .env
file in the frontend
directory with the following content: