Quick implementation of a database connector with both REST endpoints and GraphQL routes.
| Tool | Version |
|---|---|
| Python | >= 3.12 |
| uv | latest |
| just | latest (optional, for the justfile recipes) |
- Clone the repository:
git clone https://github.com/Cybernetic-Ransomware/template_GraphQL_SQLAlchemy_FastAPI.git
- Install uv.
- Install dependencies (creates
.venvand installs runtime + dev dependencies):uv sync
- Run the application:
or, with just:
uv run uvicorn app.main:app --reload --port 8080
just run
- OpenAPI Documentation: http://127.0.0.1:8080/docs
- GraphQL Playground: http://127.0.0.1:8080/graphql
DATABASE_URL is read from .env (copy .env.template to get started). Supported modes:
| Mode | DATABASE_URL example |
Account required | Best for |
|---|---|---|---|
| Plain SQLite | sqlite:///./test.db |
No | Local dev, CI (default) |
| Local libSQL | sqlite+libsql:///local.db |
No | Trying the libSQL driver without a cloud account |
| Turso remote | sqlite+libsql://<db>.turso.io?secure=true |
Yes | Serverless/multi-instance deployments |
| Turso embedded replica | sqlite+libsql:///embedded.db + TURSO_DATABASE_URL |
Yes | Low-latency local reads, synced to the cloud |
| Native Turso (bonus) | sqlite+turso:///local_native.db |
No | Experimental — unrelated to Turso Cloud/libSQL |
Only the plain SQLite mode runs in CI/tests; the others need real Turso credentials
(turso db tokens create <name>) and are for manual/local use.
Set up the pre-commit hooks once after cloning:
uv run pre-commit installCommon tasks (see justfile for the full list):
just format # ruff format
just lint # ruff format + lint, ty type-check, codespell, bandit
just commit # run pre-commit, then open Commitizen for a conventional commit- SQLAlchemy: https://docs.sqlalchemy.org/en/20/
- FastAPI: https://fastapi.tiangolo.com/
- Strawberry GraphQL: https://strawberry.rocks/docs