Skip to content

Commit

Permalink
feat: add bash script to clean, install, and run easily
Browse files Browse the repository at this point in the history
  • Loading branch information
berdal84 committed Jan 19, 2024
1 parent 245a0cc commit 895bceb
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@

This project consists on a front and backend to manage Biotech Data.

The front and back end are present in [`./frontend`](./frontend) and [`./backend`](./backend) folders respectively.
## Quick Start

Prerequisites: a GNU/Linux Operating System, postgresql 14+, node 14+, python 3.12

To install and run both front and back end, run the following commands:

```
./install.sh
./run.sh
```

Then, browse [localhost:3000](http://localhost:3000) to open the app.
Or browse [localhost:8000/docs](http://localhost:8000/docs) to access backend documentation.

For more information, read all the README files.
The front and back end are located in [`./frontend`](./frontend) and [`./backend`](./backend) folders respectively.


## [Backend](./backend)

Expand Down
4 changes: 4 additions & 0 deletions backend/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
echo "Cleaning backend..."
cd backend
rm -rf venv || ( echo "Unable to delete venv folder!" && exit 1)
echo "Backend cleaned"
8 changes: 8 additions & 0 deletions backend/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
echo "Installing Backend..."
cd backend
echo "Creating an environment under ./venv folder..."
python -m venv venv || (echo "Unable to create enviroment" && exit 1)
source venv/bin/activate
echo "Installing requirements..."
pip install -r requirements_dev.txt || (echo "Unable to install requirements" && exit 1)
echo "Backend installed"
3 changes: 3 additions & 0 deletions backend/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd backend
source venv/bin/activate
uvicorn main:app --reload
5 changes: 5 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
echo "Cleaning..."
(./backend/clean.sh || ( echo "-- Unable to clean backend!" && exit 1)) &
(./frontend/clean.sh || ( echo "-- Unable to clean frontend!" && exit 1)) &
wait
echo "Cleaned"
4 changes: 4 additions & 0 deletions frontend/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
echo "Cleaning frontend..."
cd frontend
rm -rf node_modules || (echo "Unable to delete node_modules!" && exit 1)
echo "Frontend cleaned"
4 changes: 4 additions & 0 deletions frontend/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
echo "Installing Frontend..."
cd frontend
npm install || ( echo "Unable to install!" && exit 1)
echo "Frontend installed"
3 changes: 3 additions & 0 deletions frontend/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
echo "Running frontend..."
cd frontend
npm run dev
7 changes: 7 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
echo "Installing..."
./backend/install.sh || (echo "Backend install failed" && exit 1)
./frontend/install.sh || (echo "Frontend install failed" && exit 1)
echo "Install done"
echo ""
echo "note: Don't forget to create your .env file in ./backend/ and a database in postgres"
echo " Read ./backend/README.md for more information."
5 changes: 5 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
echo "Running..."
(./backend/run.sh || (echo "Backend couldn't start" && exit 1)) &
(./frontend/run.sh || (echo "Frontend couldn't start" && exit 1)) &
wait
echo "Stopped"

0 comments on commit 895bceb

Please sign in to comment.