Simple and small python service designed to generate and read Barcode, QRCode, Aztec Code, DataMatrix.
https://barcode.adrox.xyz/api/v1/
https://barcode.adrox.xyz/api/v1/docs
The website was written using Python 3.8 and FastAPI.
The dependencies are listed in the pyproject.toml
file.
By default, the application is served on port 8000.
To run the application locally, install the dependencies using poetry
poetry install
file and then execute the command
uvicorn app.main:app --reload
in the application's root directory.
Run the container from the available registry.
docker run -p 8000:8000 adrixop95/barcodegenerator:latest
If you want, you can maintain the consistency of the generated codes by mounting the following folders:
- /app/aztec
- /app/barcode
- /app/qrcode
- /app/datamatrix
The service does not have any environment variables.
To run the application on localhost from docker-compose, go to the deployment/docker-compose
folder and execute the command:
Windows:
$env:URL="localhost"; docker-compose -f docker-compose.yml up
Linux, macOS:
URL="localhost" docker-compose -f .\docker-compose.yml up
Traefik automatically manages the SSL certificate generating the let's encrypt certificate. The certificate is generated for example@example.com
, please change if necessary.
After launch, it will be available at https://localhost/api/v1/
Running the application using kubernetes requires having installed helm and installing a traefik with it.
Installation of the traefik can be performed using the following commands:
$ helm repo add traefik https://containous.github.io/traefik-helm-chart
$ helm repo update
$ helm install traefik traefik/traefik
Then go to the deployment/kubernetes
folder and execute the following commands:
$ helm upgrade traefik traefik/traefik --values 000-values.yaml
$ kubectl apply -f 001-deployment.yaml
Traefik automatically manages the SSL certificate generating the let's encrypt certificate. The certificate is generated for example@example.com
, please change if necessary.
In order for the application to be launched on an address other than localhost
, localhost addresses should be changed in the 001-deployment.yaml
file to the target address of your choice.
Without changing the configuration and parameters, the application will be available at: https://localhost
.
Swagger is available at /docs
path.
Request type: post
Request path: /api/v1/barcode/generate
Data:
barcode_type: str [values: EAN8,EAN13,EAN14,UPCA,JAN,ISBN10,ISBN13,ISSN,Code39,Code128,PZN]
barcode_message: str [Just a message]
Request type: post
Request path: /api/v1/qrcode/generate
Data:
qrcode_scale: int [Image scale between 1 to int constraint]
qrcode_message: str [Just a message]
qrcode_error_correct: Optional[str] = None [L (7% compression), M (15% compression), Q (25% compression), H (30% compression) or just remove this parameter from request]
Request type: post
Request path: /api/v1/qrcode/decrypt
Data:
file: string($binary) [Just a file]
Request type: post
Request path: /api/v1/aztec/generate
Data:
aztec_code_scale: int [Image scale between 1 to int constraint]
aztec_code_message: str [Just a message]
Request type: post
Request path: /api/v1/datamatrix/generate
Data:
data_matrix_message: str [Just a message]
Request type: post
Request path: /api/v1/datamatrix/decrypt
Data:
file: string($binary) [Just a file]
The application is available under the GNU GENERAL PUBLIC LICENSE.