https://github.com/webkom/kvittering
🧾 Receipt creator (kvitteringsskildrer)
https://github.com/webkom/kvittering
hacktoberfest nextjs nextui poetry
Last synced: 6 months ago
JSON representation
🧾 Receipt creator (kvitteringsskildrer)
- Host: GitHub
- URL: https://github.com/webkom/kvittering
- Owner: webkom
- License: mit
- Created: 2018-09-15T21:36:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-12T12:13:03.000Z (over 1 year ago)
- Last Synced: 2024-04-13T04:44:28.724Z (over 1 year ago)
- Topics: hacktoberfest, nextjs, nextui, poetry
- Language: TypeScript
- Homepage: https://kvittering.abakus.no
- Size: 4.82 MB
- Stars: 8
- Watchers: 19
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kvittering
[](https://ci.webkom.dev/webkom/kvittering)
[](https://dashboard.cypress.io/projects/jitps9/runs)This docker image runs as a normal docker container, but can also run as a function in [OpenFaaS](https://www.openfaas.com/). This is not recommended at this time, as the PDF creation can take to long, and it might time-out.
Running on https://kvittering.abakus.no
### Getting started
This is one docker image that serves both the python api, and the next/react frontend, this is done by building the webapp as a static site, and serving it as static files through flask.
#### Option 1) Run just the frontend:
```sh
# Install all packages
$ yarn# Start server
$ yarn dev
```#### Option 2) Run the backend (with built frontend):
Requires [Poetry](https://python-poetry.org/docs/#installation)
```sh
# Make a virtual environment
$ python -m venv venv
$ source venv/bin/activate# Install packages
$ poetry install# Export the frontend
$ yarn build# Start the server
$ python server/server.py```
> The webapp will be available on `localhost:5000`
#### OBS: Poppler
> One of the packages (`pdf2image`) will require `poppler` to work correctly with tmp files. Most linux distros come with this. For MacOS `brew install poppler`
### Environment variables
| Variable | Function |
| --------------------- | ----------------------------------------------------------------------------------- |
| `MAIL_ADDRESS` | Set the mail address for generated receipts |
| `SERVICE_ACCOUNT_STR` | Base64 encoded service account. This means the whole `.json` downloaded from google |
| `ENVIRONMENT` | Set to "production" for sentry errors |
| `SENTRY_DSN` | Ingest errors to sentry |> To create a `Base64Encoded` str use `cat .json | base64`
### Generating PDFs
It's nice to quickly generate `PDFs` when developing, without having to start up everything. To do this you can run:
```sh
$ python server/generate-example.py signature.png output.pdf image0.png image1.png ...```
Where `signature.png` and `imageN.png` are paths to image files (the latter images are optional)
### Testing
Run cypress tests
```sh
# In one shell
$ yarn dev# In another shell
$ yarn cypress
```### Deployment
New versions are automatically built and deployed when pushing to the `master` branch.