Certainly! Below is a step-by-step guide for setting up both the backend (FastAPI) and frontend (ReactJS) of the blog application on your local machine.
git clone https://github.com/itsRkator/blog-app.git
cd blog-app
cd backend
Make sure you have Python 3 installed. You can download it from https://www.python.org/downloads/.
python3 -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
pip install -r requirements.txt
Create a .env
file in the same directory as main.py
with the following content:
DATABASE_URL=postgresql://your_username:your_password@localhost/your_database
Replace your_username
, your_password
, and your_database
with your actual Postgres credentials.
python3 main.py
The FastAPI server will be running at http://127.0.0.1:8000
.
cd frontend
Make sure you have Node.js and npm installed. You can download them from https://nodejs.org/.
npm install
In the src/api.js
file, update the apiUrl
variable with the URL of your FastAPI server:
const apiUrl = 'http://localhost:8000'; // Update with your FastAPI server URL
npm start
The React development server will be running at http://localhost:3000
.
Now, you have both the FastAPI backend and ReactJS frontend set up locally. You can access the application by visiting http://localhost:3000
in your web browser.
Feel free to customize the application and explore the features you implemented.