Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9b7945f
Bump ethers from 6.13.4 to 6.13.5
dependabot[bot] Jan 6, 2025
6537790
Bump @testing-library/user-event from 14.5.2 to 14.6.1
dependabot[bot] Feb 3, 2025
60322b8
Bump react-i18next from 15.4.0 to 15.4.1
dependabot[bot] Feb 24, 2025
a017a50
Bump @fontsource/roboto from 5.1.1 to 5.2.5
dependabot[bot] Mar 10, 2025
5d3dde2
Bump typescript from 5.7.2 to 5.8.2
dependabot[bot] Mar 10, 2025
bff3799
Bump @reduxjs/toolkit from 2.5.0 to 2.6.1
dependabot[bot] Mar 10, 2025
ebc6cd3
Bump ua-parser-js from 2.0.0 to 2.0.3
dependabot[bot] Mar 17, 2025
ef8a5e3
Bump axios from 1.7.9 to 1.8.4
dependabot[bot] Mar 24, 2025
db80bd7
Bump nanoid from 5.0.9 to 5.1.5
dependabot[bot] Mar 24, 2025
f798fa2
Bump i18next from 24.2.0 to 24.2.3
dependabot[bot] Mar 24, 2025
037107e
Bump @mui/x-data-grid from 7.23.5 to 7.28.2
dependabot[bot] Mar 31, 2025
d043504
Merge pull request #337 from etherisc/dependabot/npm_and_yarn/i18next…
christoph2806 Dec 8, 2025
99265f1
Merge pull request #335 from etherisc/dependabot/npm_and_yarn/nanoid-…
christoph2806 Dec 8, 2025
6c876a9
Merge pull request #334 from etherisc/dependabot/npm_and_yarn/axios-1…
christoph2806 Dec 8, 2025
06cddd2
Merge pull request #328 from etherisc/dependabot/npm_and_yarn/ua-pars…
christoph2806 Dec 8, 2025
eeab902
Merge pull request #324 from etherisc/dependabot/npm_and_yarn/reduxjs…
christoph2806 Dec 8, 2025
8b13757
Merge pull request #322 from etherisc/dependabot/npm_and_yarn/typescr…
christoph2806 Dec 8, 2025
e055b2c
Merge pull request #320 from etherisc/dependabot/npm_and_yarn/fontsou…
christoph2806 Dec 8, 2025
988cb9a
Merge pull request #315 from etherisc/dependabot/npm_and_yarn/react-i…
christoph2806 Dec 8, 2025
eaff59e
Merge pull request #300 from etherisc/dependabot/npm_and_yarn/testing…
christoph2806 Dec 8, 2025
ab1ad93
Merge pull request #273 from etherisc/dependabot/npm_and_yarn/ethers-…
christoph2806 Dec 8, 2025
4af14b3
Merge pull request #339 from etherisc/dependabot/npm_and_yarn/mui/x-d…
christoph2806 Dec 8, 2025
d297201
fix(security): update Next.js to 15.5.7 for CVE-2025-55182
christoph2806 Dec 8, 2025
106ccfb
chore(deps): update MUI, types/node, and testing-library
christoph2806 Dec 8, 2025
485d485
chore(deps): bump the npm_and_yarn group across 1 directory with 8 up…
dependabot[bot] Mar 12, 2026
3063963
fix(security): update Next.js to 15.5.12 for CVE follow-ups (CVE-2026…
christoph2806 Mar 12, 2026
f96d230
fix(security): resolve remaining npm audit vulnerabilities
christoph2806 Mar 12, 2026
c70e4ed
fix(test): add jest setup for Next.js 15 compatibility
christoph2806 Mar 12, 2026
d1c6874
fix: auto-resolved issue #275 via BISNESS FLY.AI Swarm
Apr 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "flightdelay-ui",
"dockerComposeFile": "docker-compose.yaml",
"initializeCommand": "docker pull mcr.microsoft.com/devcontainers/typescript-node:22",
"initializeCommand": "docker pull mcr.microsoft.com/devcontainers/typescript-node:22-bookworm",
"service": "webapp",
"workspaceFolder": "/workspaces/flightdelay-ui",

Expand Down Expand Up @@ -43,7 +43,8 @@
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},

"containerEnv": {
Expand Down
142 changes: 1 addition & 141 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,141 +1 @@
# Flightdelay UI Web Application


## Webapp

### Configuration

The webapp is configured via environment variables. The following variables are available:

- `NEXT_PUBLIC_DEPARTURE_DATE_MIN_DAYS`: The minimum number of days in the future for the departure date
- `NEXT_PUBLIC_DEPARTURE_DATE_MAX_DAYS`: The maximum number of days in the future for the departure date
- `NEXT_PUBLIC_AIRPORTS_WHITELIST`: A comma-separated list of airport codes of whitelisted airports. At least the departure or the arrival airport must be in this list.
- `NEXT_PUBLIC_AIRPORTS_BLACKLIST`: A comma-separated list of airport codes of blacklisted airports. If the departure or the arrival airport is in this list, no policy can be created.
- `PREMIUM`: Set the premium in wei. Defaults to `15000000`.
- `NEXT_PUBLIC_APP_BASE_URL`: The base URL where the webapp is deployed (without trailing slash). Defaults to `https://flightdelay.app`

- `NEXT_PUBLIC_PRODUCT_CONTRACT_ADDRESS`: The address of the product contract
- `NEXT_PUBLIC_PRODUCT_TOKENHANDLER_CONTRACT_ADDRESS`: The address of the product token handler contract
- `NEXT_PUBLIC_POOL_CONTRACT_ADDRESS`: The address of the flight pool contract
- `NEXT_PUBLIC_ORACLE_CONTRACT_ADDRESS`: The address of the flight oracle contract
- `NEXT_PUBLIC_FLIGHT_NFT_CONTRACT_ADDRESS`: The address of the flight NFT contract
- `NEXT_PUBLIC_ERC20_TOKEN_CONTRACT_ADDRESS`: The address of the ERC20 token contract to pay the premium with
- `NEXT_PUBLIC_ERC20_TOKEN_VERSION`: Token version, default is "1", needs to be set to "2" for USDC on Base
- `NEXT_PUBLIC_PREMIUM_TOKEN_SYMBOL`: The symbol of the premium token
- `NEXT_PUBLIC_PREMIUM_TOKEN_DECIMALS`: The number of decimals of the premium token
- `NEXT_PUBLIC_CONTRACTS_BADGE_TEXT`: The badge text to show on the contracts page (optional). Used to indicate the environment (e.g. "test", ...)

- `STATISTICS_PROVIDER_MNEMONIC`: The mnemonic of the statistics provider. This account is used to create the policies.
- `STATISTICS_PROVIDER_MIN_BALANCE`: The minimum balance of the statistics provider. If the balance is below this value, the provider will not be able to create new policies and the readiness check will fail.
- `STATUS_PROVIDER_MIN_BALANCE`: The minimum balance of the status provider. If the balance is below this value, the provider will not be able to send oracle responses and the readiness check will fail.
- `STATUS_PROVIDER_MNEMONIC`: The mnemonic of the status provider. This account is used to send the oracle response transactions.
- `RISKPOOL_MIN_CAPACITY`: The minimum capacity of the risk pool in wei. If the capacity is below this value, the policy creation will not be possible.
- `ORACLE_ARRIVAL_CHECK_DELAY_SECONDS`: The delay in seconds for the oracle to check the arrival status after the exected arrival time
- `GAS_LIMIT`: The gas limit for oracle responses (defaults to `5000000`)
- `RISKPOOL_MAX_PAYOUT_CHECK_LOOKAHEAD_SECONDS`: The lookahead time in seconds for the risk pool maximum payout check (executed during readyness checks). Defaults to 172800 seconds (2 days).

- `NEXT_PUBLIC_EXPECTED_CHAIN_ID`: The expected chain ID
- `NEXT_PUBLIC_EXPECTED_CHAIN_NAME`: The expected chain name (optional, required for automatic chain adding)
- `NEXT_PUBLIC_EXPECTED_CHAIN_RPC_NODE_URL`: The expected chain RPC node URL (optional, required for automatic chain adding)
- `NEXT_PUBLIC_EXPECTED_CHAIN_BLOCK_EXPLORER_URL`: The expected chain block explorer URL (optional, required for automatic chain adding)
- `NEXT_PUBLIC_EXPECTED_CHAIN_TOKEN_NAME`: The expected chain native token name (optional, required for automatic chain adding)
- `NEXT_PUBLIC_EXPECTED_CHAIN_TOKEN_SYMBOL`: The expected chain native token symbol (optional, required for automatic chain adding)
- `NEXT_PUBLIC_EXPECTED_CHAIN_TOKEN_DECIMALS`: The expected chain native token decimals (optional, required for automatic chain adding)

- `FLIGHTSTATS_BASE_URL`: The base URL for the Flightstats API
- `FLIGHTSTATS_APP_ID`: The Flightstats API application ID
- `FLIGHTSTATS_APP_KEY`: The Flightstats API application key

- `LOG_API_PROXY`: set the `true` to log proxy requests on the backend
- `LOG_LEVEL`: The log level for the backend api (debug, info, warn, error)
- `NEXT_PUBLIC_GA_MEASUREMENT_ID`: The Google Analytics measurement ID. No tracking is done if this value is not set
- `NEXT_PUBLIC_GA_ENVIRONMENT_ID`: The Google Analytics environment identifier
- `CSP_ENABLED`: Set to `true` to enable the Content Security Policy

### Contract generation

The webapp uses [Typechain](https://github.com/dethcrypto/TypeChain) to generate smart contract bindings. The generated files are stored in the `src/contracts` directory (which is not commited to git, to ensure the latest artifacts are used). The generation is done automatically after running `npm install`.

Currently not all smart contracts are compiled automatically, due to the huge number of classes this would generate.
Which contracts are compiled is defined in the `package.json` file in tasks `typechainOpenzeppelinTypes`, `typechainGif` and `typechainFlight`.

### Start

```bash
npm run dev
```

**Important**: This project requires a fontawesome pro license. Please set your auth token in the `FONTAWESOME_NPM_AUTH_TOKEN` environment variable.

### Trigger oracle via curl

```
curl -X POST http://localhost:3000/api/oracle -H "Content-Type: application/json" -d {} -w " %{http_code}\n"
```

### Test

```bash
npm run test
(or)
npm run testLoop
```

### Containzerized runtime

Via container created by executing

```bash
docker build -t flightdelay-ui-webapp .
```
**Important**: This project requires a fontawesome pro license. Please set your auth token in the `FONTAWESOME_NPM_AUTH_TOKEN` environment variable.


## Branching Strategy

This repository uses [Gitflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) as branching strategy. The main branches are:

- `main`: The main branch for production releases
- `develop`: The main branch for development

Feature branches are created from `develop` and merged back into `develop` via pull requests (or git merge). Hotfix branches are created from `main` and merged back into `develop` and `main` via pull requests (or git merge).

### Git commands

#### Create a new release from develop

Assumption: the current branch is `develop` and the branch is up-to-date and contains the latest changes.

```bash
git switch main
git pull
git merge develop
```

Now the `main` branch contains the latest changes from `develop` and the production system can be updated from the `main` branch.

#### Create a hotfix branch for production

Assumption: a hotfix is required for the production system.

```bash
git switch main
git pull
git switch -c hotfix/<branch name>
# implement the hotfix on that branch
```

#### Merge a hotfix into main and develop

Assumption: the hotfix branch is up-to-date and contains the latest changes.

```bash
git switch main
git pull
git merge hotfix/<branch name>
git switch develop
git pull
git merge hotfix/<branch name>
```

Now the hotfix is merged into `main` and `develop` and the hotfix branch can be deleted. Production can be updated from the `main` branch and the development can continue on the `develop` branch.
[ERROR]: Neural Model Offline. Model: llama3:8b. timeout of 600000ms exceeded
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const createJestConfig = nextJest({
/** @type {import('jest').Config} */
const customJestConfig = {
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
setupFiles: ['<rootDir>/jest.setup.js'],
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
moduleDirectories: ['node_modules', '<rootDir>/'],
testEnvironment: 'jest-environment-jsdom',
Expand Down
18 changes: 18 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Polyfill TextEncoder/TextDecoder for Next.js 15 in Jest (jsdom lacks these)
const { TextEncoder, TextDecoder } = require('util');
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;

// Mock next-runtime-env to avoid loading Next.js server stack (next/cache, etc.)
jest.mock('next-runtime-env', () => ({
PublicEnvProvider: ({ children }) => children,
useEnvContext: () => ({
NEXT_PUBLIC_PREMIUM_TOKEN_SYMBOL: 'FUSD',
NEXT_PUBLIC_PRODUCT_CONTRACT_ADDRESS: '0x0000000000000000000000000000000000000000',
NEXT_PUBLIC_FLIGHT_NFT_CONTRACT_ADDRESS: '0x0000000000000000000000000000000000000000',
NEXT_PUBLIC_AIRPORTS_WHITELIST: '',
NEXT_PUBLIC_AIRPORTS_BLACKLIST: '',
NEXT_PUBLIC_DEPARTURE_DATE_DATE_FROM: undefined,
NEXT_PUBLIC_DEPARTURE_DATE_MIN_DAYS: '14',
}),
}));
24 changes: 24 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
/** @type {import('next').NextConfig} */

const securityHeaders = [
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
];

const nextConfig = {
reactStrictMode: true,
experimental: {
Expand All @@ -10,6 +26,14 @@ const nextConfig = {
"@fortawesome/free-solid-svg-icons",
]
},
async headers() {
return [
{
source: '/:path*',
headers: securityHeaders,
},
];
},
}

module.exports = nextConfig
Loading