A lightweight, modular FastAPI application with Swagger UI, Docker support, and Gunicorn + Uvicorn for production.
giswater_api_server/
│── app/
│ │── routers/ # API endpoints (organized by feature)
│ │── services/ # Business logic and processing
│ │── models/ # Pydantic models for validation
│ │── dependencies.py # Shared dependencies
│ │── config.py # Configuration settings
│ │── main.py # Entry point of the FastAPI app
│
│── tests/ # Unit and integration tests
│── .gitignore # Git ignore rules
│── requirements.txt # Python dependencies
│── Dockerfile # Dockerization setup
│── gunicorn.conf.py # Gunicorn configuration
│── README.md # Project documentation
git clone https://github.com/Giswater/giswater_api_server.git
cd giswater_api_server
python3 -m venv venv
source venv/bin/activate # for Windows PowerShell: .\venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload
📌 API Docs available at: http://127.0.0.1:8000/docs
docker build -t giswater_api_server .
docker run -d -p 8000:8000 giswater_api_server
For production, run:
gunicorn -w 4 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 app.main:app
Endpoint | Method | Description |
---|---|---|
/ |
GET | Root endpoint |
/features/getfeaturechanges |
GET | Fetch feature changes for GMAO |
/mincut/setmincut |
POST | Set mincut parameters |
/waterbalance/getdmahydrometers |
GET | Retrieve DMA hydrometers data |
/digitaltwin/getepafile |
GET | Get EPA file data |
Run tests using pytest
:
pytest
This project is free software, licensed under the GNU General Public License (GPL) version 3 or later. Refer to the LICENSE file for details.