diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..db32eba2 --- /dev/null +++ b/404.html @@ -0,0 +1 @@ +
Kwik features
Kwik gives you the following features:
Dependency injection
ORM support for Soft Delete pattern and automatic Audit.
Documentation: https://kwik.rocks
Repository: https://github.com/dmezzogori/kwik
Kwik is a web framework for building modern, batteries-included, RESTful backends with Python 3.10+. Kwik is based on FastAPI, builds upon it and delivers an opinionated concise, business-oriented API.
The key features are:
Warning
While Kwik is in active development, and already used for production, it is still in a pre-release state.
The API is subject to change, and the documentation is not complete yet.
Python 3.10+
Kwik stands on the shoulder of a couple of giants:
$ pip install kwik
+---> 100%
+Installed
+
It will install kwik and all its dependencies.
$ python -m kwik
+Uvicorn running on http://localhost:8080 (Press CTRL+C to quit)
+
If kwik is started in this way, it automatically creates a development server on port 8080
, with hot-reloading enabled
Open your browser at http://localhost:8080/docs.
You will see the automatic interactive API documentation, showing the built-in endpoints and schemas.
This project is licensed under the terms of the MIT license.
Documentation: https://kwik.rocks
Repository: https://github.com/dmezzogori/kwik
Kwik is a web framework for building modern, batteries-included, RESTful backends with Python 3.10+. Kwik is based on FastAPI, builds upon it and delivers an opinionated concise, business-oriented API.
The key features are:
Warning
While Kwik is in active development, and already used for production, it is still in a pre-release state.
The API is subject to change, and the documentation is not complete yet.
"},{"location":"#acknowledgments","title":"Acknowledgments","text":"Python 3.10+
Kwik stands on the shoulder of a couple of giants:
$ pip install kwik\n---> 100%\nInstalled\n
It will install kwik and all its dependencies.
"},{"location":"#example","title":"Example","text":""},{"location":"#run-it","title":"Run it","text":"$ python -m kwik\nUvicorn running on http://localhost:8080 (Press CTRL+C to quit)\n
If kwik is started in this way, it automatically creates a development server on port 8080
, with hot-reloading enabled
Open your browser at http://localhost:8080/docs.
You will see the automatic interactive API documentation, showing the built-in endpoints and schemas.
"},{"location":"#license","title":"License","text":"This project is licensed under the terms of the MIT license.
"},{"location":"features/","title":"Features","text":"Kwik features
Kwik gives you the following features:
Dependency injection
ORM support for Soft Delete pattern and automatic Audit.
Kwik is meant to be a batteries-included web framework for building modern, RESTful backends with Python 3.10+.
As such, it handles automatically many of the tedious aspects of building a web application, such as:
The objective of Kwik is to provide a concise API, which is easy to learn and use, and which is also easy to extend. Kwik is operationally extensible with any existing FastAPI application.
The objective of Kwik is to uplift the developer experience, by providing a framework which is easy to use, and which is also easy to extend.
In the simplest of the cases, the developer just need to define the SQL models that represent the data, and the Kwik framework will automatically provide the RESTful APIs for CRUD operations.
Kwik also aims at enabling the developer to follow efficiently the best practices of the industry, such as Test-Driven Development. Kwik is designed to be easily testable, and it provides a set of fixtures that can be used to test the application.
Kwik is 100% tested.
"},{"location":"tutorial/auditing/","title":"Auditing","text":""},{"location":"tutorial/configuration/","title":"Configuration","text":"The configuration of a Kwik application is done through the use of environment variables.
The handling of the configuration is done by the Pydantic library, which is used by Kwik to validate the settings.
Warning
The configuration is done through environment variables, which are not secure. You should not use them to store sensitive information, like passwords, tokens, etc.
Instead, you should use the SecretStr type, which will read the values from environment variables, but will not show them in the documentation.
The following are the main configuration variables available, and corresponding default values:
SERVER_NAME
: backend
- The name of the server/service on which the application is running (i.e. docker service name).HOST
: localhost
- The hostname on which the application is running.PORT
: 8080
- The port on which the application is running.API_V1_STR
: /api/v1
- The base path for the API.PROJECT_NAME
: kwik
- The name of the project being developed.POSTGRES_SERVER
: db
- The hostname of the database server.POSTGRES_DB
: db
- The name of the database.POSTGRES_USER
: postgres
- The username to use to connect to the database.POSTGRES_PASSWORD
: root
- The password to use to connect to the database.ENABLE_SOFT_DELETE
: False
- A flag to enable/disable soft delete.SMTP_HOST
SMTP_PORT
SMTP_USER
SMTP_PASSWORD
SMTP_TLS
FIRST_SUPERUSER
: admin@example.com
- The email address of the admin superuser.FIRST_SUPERUSER_PASSWORD
: admin
- The password of the admin superuser.DEBUG
: True
- A flag to enable/disable debug mode.HOTRELOAD
: True
- A flag to enable/disable hot reloading.WEBSOCKET_ENABLED
: False
- A flag to enable/disable websocket support.Note
The default values are used only for development purposes. In production, you should always override them with the appropriate values.
Moreover, you should be aware that environment variables names are case sensitive.
"},{"location":"tutorial/database/","title":"Database","text":""},{"location":"tutorial/endpoints/","title":"Endpoints","text":""},{"location":"tutorial/first-steps/","title":"First steps","text":"To run your first Kwik application, once you have installed it all you need to do is to create a file named app.py
with the following content:
from kwik import Kwik, run\nfrom kwik.api.api import api_router\n\napp = Kwik(api_router)\n\nrun(app)\n
Then run it with:
$ python app.py\n\nKwikApp ready\nKwikApp running on http://localhost:8080\nSwagger available at http://localhost:8080/docs\n
The run()
function will start a development server on port 8080
, with hot-reloading enabled.
Just point your browser to http://localhost:8080/docs, and you will see the automatic interactive API documentation.
"},{"location":"tutorial/first-steps/#what-just-happened","title":"What just happened?","text":"The Kwik
class is the main entry point for your application.
It takes a list of routers, which are the components that define the endpoints of your application.
In this case, we are using the api_router
from kwik.api.api
, which is the default router for the built-in endpoints. The default endpoints, as they can be seen in the above picture, are:
/api/v1/login
: to handle user authentication and token generation./api/v1/users
: to handle user management./api/v1/roles
: to handle role management./api/v1/permissions
: to handle permission management.Now that you have your first Kwik application running, you are probabily interested in the following:
The configuration of a Kwik application is done through the use of environment variables.
The handling of the configuration is done by the Pydantic library, which is used by Kwik to validate the settings.
Warning
The configuration is done through environment variables, which are not secure. You should not use them to store sensitive information, like passwords, tokens, etc.
Instead, you should use the SecretStr type, which will read the values from environment variables, but will not show them in the documentation.
The following are the main configuration variables available, and corresponding default values:
SERVER_NAME
: backend
- The name of the server/service on which the application is running (i.e. docker service name).HOST
: localhost
- The hostname on which the application is running.PORT
: 8080
- The port on which the application is running.API_V1_STR
: /api/v1
- The base path for the API.PROJECT_NAME
: kwik
- The name of the project being developed.POSTGRES_SERVER
: db
- The hostname of the database server.POSTGRES_DB
: db
- The name of the database.POSTGRES_USER
: postgres
- The username to use to connect to the database.POSTGRES_PASSWORD
: root
- The password to use to connect to the database.ENABLE_SOFT_DELETE
: False
- A flag to enable/disable soft delete.SMTP_HOST
SMTP_PORT
SMTP_USER
SMTP_PASSWORD
SMTP_TLS
FIRST_SUPERUSER
: admin@example.com
- The email address of the admin superuser.FIRST_SUPERUSER_PASSWORD
: admin
- The password of the admin superuser.DEBUG
: True
- A flag to enable/disable debug mode.HOTRELOAD
: True
- A flag to enable/disable hot reloading.WEBSOCKET_ENABLED
: False
- A flag to enable/disable websocket support.Note
The default values are used only for development purposes. In production, you should always override them with the appropriate values.
Moreover, you should be aware that environment variables names are case sensitive.
To run your first Kwik application, once you have installed it all you need to do is to create a file named app.py
with the following content:
from kwik import Kwik, run
+from kwik.api.api import api_router
+
+app = Kwik(api_router)
+
+run(app)
+
Then run it with:
$ python app.py
+
+KwikApp ready
+KwikApp running on http://localhost:8080
+Swagger available at http://localhost:8080/docs
+
The run()
function will start a development server on port 8080
, with hot-reloading enabled.
Just point your browser to http://localhost:8080/docs, and you will see the automatic interactive API documentation.
The Kwik
class is the main entry point for your application.
It takes a list of routers, which are the components that define the endpoints of your application.
In this case, we are using the api_router
from kwik.api.api
, which is the default router for the built-in endpoints. The default endpoints, as they can be seen in the above picture, are:
/api/v1/login
: to handle user authentication and token generation./api/v1/users
: to handle user management./api/v1/roles
: to handle role management./api/v1/permissions
: to handle permission management.Now that you have your first Kwik application running, you are probabily interested in the following:
Kwik is meant to be a batteries-included web framework for building modern, RESTful backends with Python 3.10+.
As such, it handles automatically many of the tedious aspects of building a web application, such as:
The objective of Kwik is to provide a concise API, which is easy to learn and use, and which is also easy to extend. Kwik is operationally extensible with any existing FastAPI application.
The objective of Kwik is to uplift the developer experience, by providing a framework which is easy to use, and which is also easy to extend.
In the simplest of the cases, the developer just need to define the SQL models that represent the data, and the Kwik framework will automatically provide the RESTful APIs for CRUD operations.
Kwik also aims at enabling the developer to follow efficiently the best practices of the industry, such as Test-Driven Development. Kwik is designed to be easily testable, and it provides a set of fixtures that can be used to test the application.
Kwik is 100% tested.