https://github.com/kerelko/strawberry-fastapi-graphql-api
Simple FastAPI+GraphQL (Strawberry) API with SQLAlchemy and Postgresql, provides flexible retrieval of the entities.
https://github.com/kerelko/strawberry-fastapi-graphql-api
fastapi graphql postges postgresql python python3 sqlalchemy strawberry strawberry-graphql
Last synced: 6 months ago
JSON representation
Simple FastAPI+GraphQL (Strawberry) API with SQLAlchemy and Postgresql, provides flexible retrieval of the entities.
- Host: GitHub
- URL: https://github.com/kerelko/strawberry-fastapi-graphql-api
- Owner: KERELKO
- License: mit
- Created: 2024-05-19T11:08:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-30T15:35:16.000Z (6 months ago)
- Last Synced: 2025-03-30T16:28:59.301Z (6 months ago)
- Topics: fastapi, graphql, postges, postgresql, python, python3, sqlalchemy, strawberry, strawberry-graphql
- Language: Python
- Homepage:
- Size: 695 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphQL API
## Description
- __Simple GraphQL API, built with [Strawberry](https://strawberry.rocks/) and [FastAPI](https://fastapi.tiangolo.com/)__
- __[Strawberry](https://strawberry.rocks/) is a developer friendly [GraphQL](https://graphql.org/) library for Python, designed for modern development.__
- __[GraphQL](https://graphql.org/) is a query language for APIs and a runtime for fulfilling queries with existing data. GraphQL provides a complete and understandable description of the data in API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.__## Brief overview

## Technologies
- [FastAPI](https://fastapi.tiangolo.com/)
- [Postgresql](https://www.postgresql.org/)
- [Docker](https://www.docker.com/)
- [SQLAlchemy](https://www.sqlalchemy.org/)
- [Strawberry](https://strawberry.rocks/)
- [Alembic](https://alembic.sqlalchemy.org/en/latest/)
- [GraphQL](https://graphql.org/)## How To Use
### Requirements
- Docker
- Docker-compose
- Maketools
### Installation
1. Install the project with
```
git clone https://github.com/KERELKO/strawberry-fastapi-graphql-api
```
2. Move to directory with __Dockerfile__ and create **.env** file based on **.env.example**
```
touch .env
cat .env.example > .env
```
3. In the same directory run
```
docker compose up
```
4. Go to http://localhost:8000/graphql in your browser and make your queries!
## Contributing
If you'd like to contribute to this project, feel free to fork the repository and submit a pull request. Please follow the existing code style and ensure that all tests pass before submitting your changes.
## Project structure
```
.
├── alembic.ini
├── docker-compose.yaml
├── Dockerfile
├── entrypoint.sh
├── LICENSE
├── Makefile
├── poetry.lock
├── pyproject.toml
├── README.md
├── src
│ ├── api
│ │ ├── graphql
│ │ │ ├── __init__.py
│ │ │ └── v1
│ │ │ ├── converters
│ │ │ │ ├── __init__.py
│ │ │ │ ├── product.py
│ │ │ │ ├── review.py
│ │ │ │ └── user.py
│ │ │ ├── exceptions.py
│ │ │ ├── __init__.py
│ │ │ ├── interfaces.py
│ │ │ ├── mutations
│ │ │ │ ├── __init__.py
│ │ │ │ ├── inputs.py
│ │ │ │ ├── mutation.py
│ │ │ │ ├── product.py
│ │ │ │ ├── review.py
│ │ │ │ └── user.py
│ │ │ ├── queries
│ │ │ │ ├── __init__.py
│ │ │ │ ├── product.py
│ │ │ │ ├── query.py
│ │ │ │ ├── review.py
│ │ │ │ └── user.py
│ │ │ ├── resolvers
│ │ │ │ ├── base.py
│ │ │ │ ├── __init__.py
│ │ │ │ ├── product.py
│ │ │ │ ├── review.py
│ │ │ │ └── user.py
│ │ │ └── utils.py
│ │ └── __init__.py
│ ├── core
│ │ ├── constants.py
│ │ ├── db
│ │ │ ├── __init__.py
│ │ │ └── sqlalchemy
│ │ │ ├── base.py
│ │ │ ├── extensions.py
│ │ │ ├── __init__.py
│ │ │ └── models.py
│ │ ├── di.py
│ │ ├── dto.py
│ │ ├── exceptions.py
│ │ ├── __init__.py
│ │ ├── settings.py
│ │ └── utils.py
│ ├── __init__.py
│ ├── main.py
│ └── repositories
│ ├── base.py
│ ├── __init__.py
│ └── sqlalchemy
│ ├── __init__.py
│ ├── product.py
│ ├── review.py
│ └── user.py
└── tests
```## TODO
- [ ] Tests
- [x] Mutations
- [ ] Logging
- [ ] Pointer-based Pagination
- [x] At least partly solve the N+1 problem
- [x] Remake folder structure