A practical pet project that uses FastAPI as backend and React as frontend
This method requires the PostgreSQL, Redis, and Python to be installed already.
⚙️ Update the environments settings
- Rename the sample.env file in /service/ to .env and update the settings
APP_SECRET_KEY='myrandomuntellsecret' # You can change to any other value if needed
REDIS_HOST='localhost' # Update with your installed redis host
REDIS_PORT=6379 # Update with your installed redis port
REDIS_PASSWORD=redis # Update with your installed redis password (leave blank if it does not have password)
UPLOAD_FOLDER='app/static/files_uploaded'
ALLOWED_EXTENSIONS={'pdf', 'png', 'jpg', 'jpeg', 'gif'}
DB_ENGINE=postgresql
DB_HOST='localhost' # Update with your installed Postgresql host
DB_USERNAME=postgres # Update with your installed Postgresql username
DB_PASSWORD=postgres # Update with your installed Postgresql password
DB_PORT=5432 # Update with your installed Postgresql port
DB_NAME='book_shop_develop_db' # You can change to any other value if needed
DEFAULT_ADMIN_PASSWORD=12345678 # You can change to any other value if needed
JWT_SECRET=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2i/bL8RBDeq6tKOdgaP0mNYpiUZIHT2QZjc8wZgvZEqQx4avnkujE92emGS1p6b6/y229oNj+vkSKXCMHJ3FUG3ytFfDNSDMMqp1gLq2n0oRJT8KKHfBApf/v/BK5aYGD9sKZ/FSEapXN79nwBywabQPpa5jpcFjLQD3cg8ezLWPfnyVS76i3mHpVWwPUABHqT4DFaz0PDXtZa2TAIYf7tMa3NNcWHA9OgRtfIbTqkimUdy6aW3w0GGav1KPdfxNMQ0m7+cOE9uc8yYR0DavyFe8b3Tz1xUKV2oKNfnyRkOWasHYTI9PZUwnnHWCa74X5LI6xJZ9myVecq/YDXw9qQIDAQAB # You can change to any other value if needed
JWT_ALGORITHM=HS256
ALLOWED_ORIGINS='http://localhost:5173' # The front-end (React) URL
- Rename the sample.env file in /client/ to .env and update the settings
VITE_API_URL=http://127.0.0.1:8000 # The API (FastAPI) URL
⚙️ Run the application
- Create virtual environment
For Window
cd src/service
py -3 -m venv .venv
.venv\Scripts\activate
cd ../..
For Linux/MacOS
cd src/service
python3 -m venv .venv
. .venv/bin/activate
cd ../..
- Run data migration
task run-migration
- Init the application
task init-backend
task init-frontend
- Run the application. Note: you may need to install the concurrently if not install it yet
task run-all
⚙️ Update the environments settings (refer the above)
👉 Direct Docker Compose
docker compose up -d --build
👉 Or run Docker Compose via Taskfile
task dc-build-up
http://localhost:5173
You can register a new account and login or use the initial credential (nguyensieuanh@gmail.com/12345678)
. Note that the password should get from the .env (DEFAULT_ADMIN_PASSWORD).