This codebase was created to demonstrate a fully fledged backend application built with Quart including CRUD operations, authentication, routing, pagination, and more.
We've gone to great lengths to adhere to the Quart community styleguides & best practices.
For more information on how to this works with other frontends/backends, head over to the RealWorld repo.
- Install Docker.
- Install GNU Make. It is used to run scripts.
- Install Poetry.
- Run poetry install.
To start the server, you can run:
make run
It will stand up a PostgreSQL container using Docker Compose and run the Quart application using Poetry.
The approach I followed is this:
- I only test the external API.
- I don't mock things that are under my control, such as databases.
I believe that doing so allow for:
- More opportunities for refactoring. Testing only the external API and not any of the internals allowed me more freedom to move things around, provided the tests keep green.
- More confidence that the application actually works.
To run the tests, you can run:
make test
It uses pytest with pytest-asyncio as the test runner.
You can also run the API tests from the realworld repository by running:
make api-test
It requires that you install Node.js.
- HTTPS Load Balancer.
- A Cloud Run service running the application as a Docker container.
- A Cloud SQL instance running PostgreSQL.
- Install terraform.
- Install openssl. The deployment generates and uses certificates to connect with the Cloud SQL using SSL/TLS and run migrations using flyway.
- Have registered domain. You will need to connect your domain to set up HTTPS.
cd
into deployment/google-cloud/terraform.- Run
terraform init
. - Run
terraform apply
.