Metadata-Version: 2.4
Name: ctao-qualpipe-webapp
Version: 0.1.1
Summary: CTAO DPPS QualPipe Web Application
Author-email: Matteo Balbo <matteo.balbo@cta-consortium.org>, Mykhailo Dalchenko <mykhailo.dalchenko@cta-consortium.org>
License-Expression: BSD-3-Clause
Project-URL: repository, https://gitlab.cta-observatory.org/cta-computing/dpps/qualpipe/qualpipe-webapp
Project-URL: documentation, http://cta-computing.gitlab-pages.cta-observatory.org/dpps/qualpipe/qualpipe-webapp
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi
Requires-Dist: uvicorn
Provides-Extra: frontend
Requires-Dist: jinja2; extra == "frontend"
Requires-Dist: libsass; extra == "frontend"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pip-tools>=7.1; extra == "test"
Requires-Dist: ctao-qualpipe-webapp[frontend]; extra == "test"
Requires-Dist: httpx; extra == "test"
Requires-Dist: pytest-requirements; extra == "test"
Provides-Extra: doc
Requires-Dist: ctao-qualpipe-webapp[frontend]; extra == "doc"
Requires-Dist: sphinx; extra == "doc"
Requires-Dist: numpydoc; extra == "doc"
Requires-Dist: ctao-sphinx-theme~=0.1.2; extra == "doc"
Requires-Dist: sphinx-changelog; extra == "doc"
Provides-Extra: webdev
Requires-Dist: watchdog; extra == "webdev"
Provides-Extra: dev
Requires-Dist: setuptools_scm; extra == "dev"
Requires-Dist: towncrier; extra == "dev"
Requires-Dist: ctao-qualpipe_webapp[test,webdev]; extra == "dev"
Provides-Extra: all
Requires-Dist: ctao-qualpipe-webapp[dev,doc,test]; extra == "all"
Dynamic: license-file

# QualPipe-Webapp

<!-- ## 🚀 FastAPI + D3.js QualPipe Dashboard Project -->

The QualPipe-webapp project uses **FastAPI** as backend and frontend, plus **D3.js** for dynamic frontend visualizations, separated into clean services using **Docker Compose**.

---

## 📂 Project Structure

```bash
/qualpipe-webapp
│
├── docker-compose.dev.yml           # Docker compose for developer
├── docker-compose.yml               # Docker compose for user
├── Makefile                         # Makefile to build Backend and Frontend
│
├── docs/                            # Document folder
│
├── src/
│   └── qualpipe_webapp/             # FastAPI backend
│       ├── backend/                 # FastAPI backend
│       │   ├── main.py              # Main FastAPI app
│       │   ├── data/                # JSON data sources
│       │   ├── requirements.txt     # Backend dependencies
│       │   ├── requirements-dev.txt # Backend dependencies for developer
│       │   └── Dockerfile           # Backend container
│       │
│       ├── frontend/                # FastAPI frontend
│       │   ├── /templates/          # Template pages
│       │   ├── /static/             # Static files (css, js, lib)
│       │   ├── main.py              # Main FastAPI app
│       │   ├── requirements.txt     # Frontend dependencies
│       │   ├── requirements-dev.txt # Frontend dependencies for developer
│       │   └── Dockerfile           # Frontend container
│       │
│       ├── nginx/
│       │   ├── nginx.conf
│       │   └── ssl/                 # (optional later)
│
└── .gitignore
```

## Instructions

To run it in the background, from the project folder `qualpipe-webapp` simply execute:

```bash
make up
```

Then open your browser:

- Frontend: http://localhost/

- API: http://localhost/api/data

To stop everything, execute:

```bash
make down
```

If you also want to automatically see the logs you can then run it via docker compose

To run it the first time execute: (later on you can remove the `--build`)

```bash
docker-compose up --build
```

To stop it you can soft-kill with <kbd>CTRL-C</kbd> and shut down all the services executing `make down`.

If instead you do any modification to the `config`  while the containers are running or in case Docker caches wrong stuff, you can restart it running:

```bash
make restart
```

or

```bash
docker-compose down -v --remove-orphans
docker-compose up --build
```

## Makefile

Description of all the `Makefile` functionalities:

| Command            | What it does                                                |
| ------------------ | ----------------------------------------------------------- |
| make build         | Build the Docker images                                     |
| make up            | Build and start services (backend + frontend) in background |
| make down          | Stop all services                                           |
| make logs          | View combined logs (both frontend and backend)              |
| make logs-backend  | View only backend logs                                      |
| make logs-frontend | View only frontend logs                                     |
| make restart       | Restart the containers                                      |
| make prune         | Clean up unused Docker containers/images                    |
| ------------------ | ----------------------------------------------------------- |
| make build-dev     | Build the Docker images                                     |
| make up-dev        | Build and start services (backend + frontend) in background |

## Developers

For developers, you can build containers that automatically file changes, avoiding the need to restart the containers every time. To do so, simply execute:

```bash
make build-dev
make up-dev
```

This will automatically output also every log produced.

## Contributing

If you want to contribute in developing the code, be aware that we are using `pre-commit`, `code-spell` and `ruff` tools for automatic adherence to the code style. To enforce running these tools whenever you make a commit, setup the [`pre-commit hook`][pre-commit] executing:

```
pre-commit install
```

The `pre-commit hook` will then execute the tools with the same settings as when a merge request is checked on GitLab, and if any problems are reported the commit will be rejected. You then have to fix the reported issues before tying to commit again.


## License

This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.


[pre-commit]:https://pre-commit.com/
