> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/backend-sdk/backend1n/release_notes/4.5.0_release_notes.md).

# 4.5.0

This version adds support for PostgreSQL databases. Optional JWT authentication has also been added, configurable through `config.json` or through environment variables `FACEPHI_BACKEND1N_REST_*`.

**There are no changes to the contract** for the endpoints. The existing MongoDB support has also not been changed. The service determines which database technology to use at startup, based on the connection string:

```bash
# Accepted MongoDB prefixes.
# mongodb://
# mongodb+srv://
export DATABASE_CONNECT_STRING=mongodb://user:pass@localhost:32902/?directConnection=true&serverSelectionTimeoutMS=5000

# Accepted PostgreSQL prefixes.
# postgres://
# postgresql://
export DATABASE_CONNECT_STRING=postgresql://user:pass@localhost:32903/db_backend
```

## About the databases

For MongoDB, the service itself will create a database named `db-backend`, if it does not already exist. It will store two collections in it:

* `media` to store images.
* `patterns` to store biometric patterns.

PostgreSQL is slightly different. A database named `db_backend` must be created beforehand by the system administrator. PostgreSQL makes it difficult to create databases from the client itself. An example of the commands the administrator should run beforehand is:

```bash
sudo -u postgres psql -c "CREATE ROLE backend1n WITH LOGIN PASSWORD 'backend1n';"
sudo -u postgres psql -c "CREATE DATABASE db_backend OWNER backend1n;"
sudo -u postgres psql -d db_backend -c "GRANT ALL ON SCHEMA public TO backend1n;"
```

Within the PostgreSQL database, the service will create two tables, just as it did with MongoDB:

* `media` to store images.
* `patterns` to store biometric patterns.

> **Important:** Connection strings must include the username/password information or any additional information that allows the service to access the database with read/write permissions.

## Added

* Optional JWT authentication, configurable through `config.json` or through environment variables `FACEPHI_BACKEND1N_REST_*`.
* Support for `PostgreSQL`.
* Integration test coverage for public and protected endpoints when JWT authentication is enabled.
* Integration test coverage for the MongoDB and PostgreSQL backends.
