2023-03-29 14:30:15 +00:00
Welcome to the OBP API Explorer II
2023-01-27 16:18:12 +00:00
=================================
# ABOUT
This application is used to explore OBP APIs and interact with the data and services in the context of the logged in user.
2023-06-29 06:21:47 +00:00
This application will gradually replace the original API Explorer. Long live the API Explorer!
2023-06-29 06:21:29 +00:00
2023-01-27 16:18:12 +00:00
2023-04-25 12:58:44 +00:00
2023-06-06 07:49:59 +00:00
## Install the Prerequisite Software
* required: { node: `>=16.14` }
* required: { npm: `>=8.0.0` }
### Development Project Setup
2023-03-29 15:22:33 +00:00
2023-06-29 07:56:00 +00:00
* Setup your .env file (see .env.example)
2023-05-05 07:09:16 +00:00
##### Install dependencies
2023-04-25 12:58:44 +00:00
2023-03-29 15:22:33 +00:00
```sh
2023-04-25 12:58:44 +00:00
yarn install
2023-03-29 15:22:33 +00:00
```
2023-05-05 07:09:16 +00:00
or
```sh
npm install
```
2023-03-29 15:22:33 +00:00
2023-05-05 07:09:16 +00:00
##### Compile and Hot-Reload for Development
2023-03-29 15:22:33 +00:00
```sh
2023-04-25 12:58:44 +00:00
yarn dev
2023-03-29 15:22:33 +00:00
```
2023-05-05 07:09:16 +00:00
or
```sh
2023-06-05 15:20:28 +00:00
npm run dev
2023-05-05 07:09:16 +00:00
```
2023-03-29 15:22:33 +00:00
2024-12-03 14:24:37 +00:00
##### Get a Consumer Key for the OBP-API
API Explorer needs a Consumer Key / Secret to access the Open Bank Project API with OAuth.
To get this Consumer, go to the Portal of OBP-API, login and "Get a Consumer Key".
The callback URL (if running locally) should be http://localhost:5173/api/callback
Copy and paste the Consumer Key and Consumer Secret and add it to your .env file here.
You can use .env.example as a basis of your .env file.
2025-03-25 11:13:22 +00:00
### Testing
2024-12-03 14:24:37 +00:00
2025-03-25 11:13:22 +00:00
Unit tests are located in `server/test` and `src/test` .
2024-12-03 14:24:37 +00:00
2025-03-25 11:13:22 +00:00
Integration tests are located in `src/test/integration`
##### Run Unit Tests with [Vitest](https://vitest.dev/)
2023-05-05 07:09:16 +00:00
< strike >
2023-03-29 15:22:33 +00:00
```sh
2025-03-25 11:13:22 +00:00
npm test
2023-03-29 15:22:33 +00:00
```
2023-05-05 07:09:16 +00:00
< / strike >
2023-03-29 15:22:33 +00:00
2025-03-26 12:59:39 +00:00
##### Run Integration Tests with [Playwright](https://playwright.dev/)
2025-03-25 11:13:22 +00:00
2023-03-29 15:22:33 +00:00
```sh
2025-03-26 12:59:39 +00:00
npx playwright test
```
or if you want a fancy testing UI to see what the browser is doing:
```sh
npx playwright test ui
2023-03-29 15:22:33 +00:00
```
2025-03-25 11:13:22 +00:00
2023-03-29 15:22:33 +00:00
2023-05-05 07:09:16 +00:00
## Compile and Minify for Production
2023-06-29 07:56:00 +00:00
##### Build
2023-05-05 07:09:16 +00:00
```sh
2023-06-29 07:56:00 +00:00
npm run build
2023-05-05 07:09:16 +00:00
```
2024-06-25 09:47:06 +00:00
##### Build Server
2024-05-09 08:49:16 +00:00
2023-05-05 07:09:16 +00:00
```sh
2024-06-25 09:47:06 +00:00
npm run build-server
2024-05-09 08:49:16 +00:00
```
2024-06-25 09:47:06 +00:00
2023-05-05 07:09:16 +00:00
##### Start the backend server
2024-05-09 08:49:16 +00:00
```sh
npx ts-node < path-to-your-install > /server/app.js
```
##### Check the status of API-Explorer II back-end
2023-05-05 07:09:16 +00:00
```
2024-05-09 08:49:16 +00:00
Please find a message at a log file similar to this one:
Backend is running. You can check a status at http://localhost:8085/api/status
and use the link to check the status
```
2023-05-05 07:09:16 +00:00
##### Nginx deployment
```config
server {
# Frontend
location / {
2023-06-29 07:56:00 +00:00
root /path_to_dist/dist;
2023-05-05 07:09:16 +00:00
try_files $uri $uri/ /index.html;
}
# Proxy API
location /api {
proxy_pass http://localhost:8085;
}
}
```
2024-12-10 12:49:32 +00:00
Note: if you have issues with session stickyness / login issues, enable #DEBUG =express-session in your .env
and if you see messages like these in the log,
```
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session no SID sent, generating session
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session saving 5JIW_dx9CG8qs0OK4iv7Pn2Kg2huZuvQ
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session not secured
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session split response
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session saving -yf0uzAZf5mP9JVYov9oMR7CxQLnO4wm
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session not secured
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session no SID sent, generating session
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session saving nballQYMYZRn_HG0enM2RIPdv7GAdzJc
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session not secured
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session no SID sent, generating session
Dec 10 12:26:18 obp-sandbox node[1060160]: Tue, 10 Dec 2024 12:26:18 GMT express-session no SID sent, generating session
```
then make sure your NGINX config includes the $scheme:
```
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
```
so that Node knows that the cookies have been sent securely over https.
2025-01-17 12:19:52 +00:00
# Running Opey
If you want to run Opey locally you'll need to have a local instance running. The repo can be found [here ](https://github.com/OpenBankProject/OBP-Opey ).
You will need to create a public-private key pair using open ssl (minimum 2048 bits).
1. create the directory ./server/cert
```
mkdir ./server/cert
cd ./server/cert
```
2. Generate the public private key pair inside the ./server/cert directory
```
openssl genrsa -out private_key.pem 2048
2025-01-20 12:32:30 +00:00
openssl rsa -in private_key.pem -pubout -out public_key.pem
2025-01-17 12:19:52 +00:00
```
3. Copy the public key to Opey top level directory
```
cp public_key.pem {path-to-your-opey-install}/
```
2024-12-10 12:49:32 +00:00
2025-02-26 12:01:55 +00:00
# Building the frontend container
As the frontend environment is read at build time, we need to reprocess the values
at container runtime.
This is done here: Dockerfiles/prestart.go
overwriting the values set here: Dockerfiles/frontend_build.env
Any newly introduced environment variables should be added to the prestart.go and frontend_build.env files accordingly.
2023-01-27 16:18:12 +00:00
# LICENSE
This project is licensed under the AGPL V3 (see NOTICE) and a commercial license from TESOBE.
2023-03-29 15:22:33 +00:00