Skip to content

Simple FastAPI+GraphQL (Strawberry) product service with SQLAlchemy and Postgresql, provides flexible retrieval of the entities.

License

Notifications You must be signed in to change notification settings

KERELKO/strawberry-fastapi-product-service

Repository files navigation

Product Service

Description

  • Simple product service, built with Strawberry and FastAPI
  • Strawberry is a developer friendly GraphQL library for Python, designed for modern development.
  • GraphQL 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

image

Technologies

How To Use

Requirements

  • Docker
  • Docker-compose
  • Maketools

Installation

  1. Install the project with
git clone https://github.com/KERELKO/strawberry-fastapi-product-service
  1. Move to directory with Dockerfile and create .env file based on .env.example
touch .env
cat .env.example > .env
  1. In the same directory run
docker compose up
  1. Go to http://localhost:8000/graphql in your browser and make your queries!

image

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
│   ├── common
│   │   ├── base
│   │   │   ├── dto.py
│   │   │   ├── graphql
│   │   │   │   ├── __init__.py
│   │   │   │   ├── resolvers.py
│   │   │   │   └── schemas.py
│   │   │   ├── __init__.py
│   │   │   ├── repo.py
│   │   │   └── uow.py
│   │   ├── constants.py
│   │   ├── db
│   │   │   ├── __init__.py
│   │   │   └── sqlalchemy
│   │   │       ├── base.py
│   │   │       ├── config.py
│   │   │       ├── extensions.py
│   │   │       ├── __init__.py
│   │   │       └── models.py
│   │   ├── di.py
│   │   ├── exceptions.py
│   │   ├── graphql
│   │   │   ├── mutations.py
│   │   │   ├── pagination.py
│   │   │   └── query.py
│   │   ├── __init__.py
│   │   ├── logging
│   │   │   ├── formatters.py
│   │   │   ├── handlers.py
│   │   │   ├── __init__.py
│   │   │   └── loggers.py
│   │   ├── middlewares.py
│   │   ├── settings.py
│   │   └── utils
│   │       ├── fields.py
│   │       ├── graphql.py
│   │       ├── __init__.py
│   │       └── parsers.py
│   ├── __init__.py
│   ├── main.py
│   ├── products
│   │   ├── dto.py
│   │   ├── graphql
│   │   │   ├── converters
│   │   │   │   ├── products.py
│   │   │   │   └── reviews.py
│   │   │   ├── __init__.py
│   │   │   ├── resolvers
│   │   │   │   ├── __init__.py
│   │   │   │   ├── products.py
│   │   │   │   └── reviews.py
│   │   │   └── schemas
│   │   │       ├── __init__.py
│   │   │       ├── products
│   │   │       │   ├── __init__.py
│   │   │       │   ├── inputs.py
│   │   │       │   ├── mutations.py
│   │   │       │   └── queries.py
│   │   │       └── reviews
│   │   │           ├── __init__.py
│   │   │           ├── inputs.py
│   │   │           ├── mutations.py
│   │   │           └── queries.py
│   │   ├── repositories
│   │   │   ├── base.py
│   │   │   └── sqlalchemy
│   │   │       ├── products
│   │   │       │   ├── __init__.py
│   │   │       │   ├── repo.py
│   │   │       │   └── uow.py
│   │   │       └── reviews
│   │   │           ├── __init__.py
│   │   │           ├── repo.py
│   │   │           └── uow.py
│   │   └── services
│   │       ├── products.py
│   │       └── reviews.py
│   └── users
│       ├── dto.py
│       ├── graphql
│       │   ├── converter.py
│       │   ├── __init__.py
│       │   ├── resolver.py
│       │   └── schemas
│       │       ├── __init__.py
│       │       ├── inputs.py
│       │       ├── mutations.py
│       │       └── queries.py
│       ├── __init__.py
│       ├── repositories
│       │   ├── base.py
│       │   ├── __init__.py
│       │   └── sqlalchemy
│       │       ├── __init__.py
│       │       ├── repo.py
│       │       └── uow.py
│       └── service.py
└── tests

TODO

  • Tests
  • Mutations
  • Logging
  • Pointer-based Pagination
  • At least partly solve the N+1 problem
  • Remake folder structure

About

Simple FastAPI+GraphQL (Strawberry) product service with SQLAlchemy and Postgresql, provides flexible retrieval of the entities.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages