A simple full-stack API project built with Flask and MariaDB — containerized using Docker Compose and deployable to a Raspberry Pi. Includes REST and SOAP endpoints and auto-seeded database. Two HTML dashboards included for REST and SOAP testing.
Using as I brush up on some skills with my Raspberry Pi.
- REST API built with Flask
- SOAP API using Spyne (accessible at
/soap) - Data stored in MariaDB
- Containerized with Docker Compose
.envsupport for secure credentials- Auto-creates & seeds a greetings table
- HTML dashboards for REST and SOAP
- Tested on Raspberry Pi (ARMv8)
Clone using SSH:
git clone git@github.com:mbulkeley/flask-api.git
cd flask-apiOr with HTTPS:
git clone https://github.com/mbulkeley/flask-api.git
cd flask-apiMYSQL_ROOT_PASSWORD=yourpassword
MYSQL_DATABASE=flaskdb
MYSQL_USER=flaskuser
MYSQL_PASSWORD=yourpassword
DB_HOST=dbDon't commit your
.envfile — it's in.gitignore.
docker compose up --buildhttp://<pi-ip>:5000/
http://<pi-ip>:5000/soap-ui
Replace
<pi-ip>with your Raspberry Pi’s IP address.
| Route | Method | Description |
|---|---|---|
/greet |
GET | Returns all greetings |
/greet |
POST | Add a new greeting |
/health |
GET | Simple health check |
| Path | Method | Description |
|---|---|---|
/soap |
POST | SOAP greeting method |
/soap/?wsdl |
GET | SOAP WSDL (service definition) |
The SOAP method
say_hello(name)returns a greeting based on the latest message stored.
curl -X POST http://<pi-ip>:5000/greet \
-H "Content-Type: application/json" \
-d '{"message": "Hello, world!"}'Use in Postman or the /soap-ui HTML form:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:hel="spyne.greetings.soap">
<soapenv:Header/>
<soapenv:Body>
<hel:say_hello>
<hel:name>Alice</hel:name>
</hel:say_hello>
</soapenv:Body>
</soapenv:Envelope>On first run, init.sql:
- Creates the
greetingstable - Inserts sample messages (including personalized ones)
This project is licensed under the MIT License. See LICENSE for details.
- CI pipeline with GitHub Actions
- GitHub Container Registry (GHCR) publishing
- Pi-to-Pi GitOps deployment
- K3s / Kubernetes multi-node deployment
- Add tests using
pytest - Webhook-based auto-deploy