This is a generic backend server for web applications. It stores JSON documents and blobs (byte sequences, files), converts SVG files to PDF, concatenates PDF files, and sends emails.
Using a generic backend, the application logic is implemented entirely in the frontend. Access rights are granted by sharing 32-hexdigit tokens.
The server runs on Debian, Ubuntu, and most other Linux distributions.
Download the latest version, and place it on your server.
wget 'https://viereck.ch/backend/generic-backend-server.tar.gz' tar xfz generic-backend-server.tar.gz
Install NodeJS:
sudo apt install nodejs
To send emails, you also need to install a mail transfer agent (MTA) such as OpenSMTPD:
sudo apt install opensmtpd
To convert SVG files to PDF, you need to install Inkscape:
sudo apt install inkscape
and to concatenate PDF files, you need Poppler (pdfunite):
sudo apt install poppler-utils
The server comes with the following configuration
file:
data, logs, and temporary files specify the folder where the documents, blobs, log files and temporary files are stored. The server will create these folders if necessary.
HTTP port specifies the TCP port on which the server listens for connections. The server accepts HTTP requests, but usually resides behind a high-performance web server, and therefore uses a non-standard port.
If you are using NginX as your main web server, configure the /backend/
location as follows:
server { server_name your-server.com; ... location /backend/ { proxy_pass http://127.0.0.1:2115; proxy_set_header Host $host; client_max_body_size 1G; } }
To quickly test the server, you can start it from the command line using:
./generic-backend-server
and stop it by pressing Ctrl-C.
The first time the server starts, it creates an empty data set. To show the root token, type:
cat var/data/root
You can copy this root token into the document editor to edit the root document.
To use the server in a production environment, it is highly recommended to set it up as a systemd service. To create a service description file, type:
./create-systemd-service
This will generate GenericBackendService.service
, and tell you how to install and use it.
If you are running multiple instances of the Generic Backend Server on the same machine, repeat the above procedure, but choose a different name and configuration folder for each instance, e.g.
./create-systemd-service --name ViereckGenericBackendServer --wd /srv/viereck.ch/generic-backend
You can include a simple client library into your HTML page as follows:
<script src="/backend/js/Backend.js"></script>