### Install AirTrail Locally with Bash Script Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/one-click.mdx Use this command to download and execute the installation script for a local setup. It creates a directory, downloads configuration files, and starts services with Docker Compose. ```bash bash <(curl -o- https://raw.githubusercontent.com/JohanOhly/AirTrail/main/scripts/install.sh) ``` -------------------------------- ### Start the AirTrail Server Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/manual.mdx Start the AirTrail application server after installation and setup. ```bash node ./build ``` -------------------------------- ### Copy Environment Example File Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/manual.mdx Copy the example environment file to create a new .env file for configuration. ```bash cp .env.example .env ``` -------------------------------- ### Install Dependencies with Bun Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/manual.mdx Install all project dependencies using the Bun package manager. ```bash bun install ``` -------------------------------- ### Build the App for Manual Installation Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/updating.mdx Rebuild the application after updating dependencies and code. ```bash bun run build ``` -------------------------------- ### Manual Installation Outbound Proxy Configuration Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/administration/outbound-proxy.mdx Set these environment variables before starting the AirTrail process manually to direct outbound traffic through a proxy. ```bash NODE_USE_ENV_PROXY=1 \ HTTPS_PROXY=http://proxy.example.com:8080 \ HTTP_PROXY=http://proxy.example.com:8080 \ NO_PROXY=localhost,127.0.0.1 \ node ./build ``` -------------------------------- ### Pull Latest Changes for Manual Installation Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/updating.mdx Navigate to your AirTrail installation directory and run this command to fetch the latest code from the repository. ```bash git pull ``` -------------------------------- ### Start AirTrail Application with Docker Compose Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/docker-compose.mdx Starts the AirTrail application in detached mode using Docker Compose. Ensure you are in the directory containing `docker-compose.yml` and `.env`. ```bash docker compose up -d ``` -------------------------------- ### Run Database Migrations for Manual Installation Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/updating.mdx Execute database migrations to ensure your database schema is up-to-date with the latest version. This is crucial to avoid data loss. ```bash bun run db:migrate-deploy ``` -------------------------------- ### Aircraft Data Schema Example Source: https://github.com/johanohly/airtrail/blob/main/data/README.md Example structure for an aircraft entry in `aircraft.json`. Includes fields for ID, name, and ICAO type designator. ```json { "id": "boeing-737-800", "name": "Boeing 737-800", "icao": "B738" } ``` -------------------------------- ### Running E2E Tests with Bun Source: https://github.com/johanohly/airtrail/blob/main/tests/e2e/README.md The command to execute all end-to-end tests using the Bun runtime. Ensure tests are run sequentially after setup tests. ```bash bun run test:e2e ``` -------------------------------- ### Airline Data Schema Example Source: https://github.com/johanohly/airtrail/blob/main/data/README.md Example structure for an airline entry in `airlines.json`. Includes fields for ID, name, ICAO, IATA, and defunct status. ```json { "id": "american-airlines", "name": "American Airlines", "icao": "AAL", "iata": "AA", "defunct": false } ``` -------------------------------- ### GET /flight/list Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/api/flight/list-flights.mdx Lists flights visible to the authenticated API key. Regular users can only list their own flights. Admins and owners can also request a specific user's flights or all flights. ```APIDOC ## GET /flight/list ### Description List flights visible to the authenticated API key. Regular users can only list their own flights. Admins and owners can also request a specific user's flights or all flights. ### Method GET ### Endpoint /flight/list ``` -------------------------------- ### Get Flight by ID Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/api/flight/get-flight.mdx Fetches the details of a specific flight using its unique identifier. ```APIDOC ## GET /flight/get/{id} ### Description Get details of a specific flight by ID. ### Method GET ### Endpoint /flight/get/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the flight. ``` -------------------------------- ### Build and Migrate Database Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/manual.mdx Build the project and deploy the database migrations. ```bash bun run build bun run db:migrate-deploy ``` -------------------------------- ### Download Docker Compose and Environment Files Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/docker-compose.mdx Downloads the `docker-compose.yml` and `.env.example` files from the AirTrail GitHub repository using wget. The `.env.example` file should be renamed to `.env` if downloaded manually. ```bash wget -O docker-compose.yml https://raw.githubusercontent.com/JohanOhly/AirTrail/main/docker/production/compose.yml wget -O .env https://raw.githubusercontent.com/JohanOhly/AirTrail/main/.env.example ``` -------------------------------- ### Create AirTrail Directory and Navigate Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/docker-compose.mdx Creates a new directory named 'airtrail' and changes the current directory to it. This is the first step in setting up the AirTrail environment. ```bash mkdir airtrail cd airtrail ``` -------------------------------- ### List Available Commands Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/administration/admin-cli.mdx Run this command to see all available commands for the `airtrail-admin` CLI. ```bash docker exec -it airtrail airtrail-admin help ``` -------------------------------- ### Display AirTrail Version Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/administration/admin-cli.mdx Prints the current version of the AirTrail instance. This is useful for checking compatibility or reporting issues. ```bash docker exec -it airtrail airtrail-admin version ``` -------------------------------- ### Clone AirTrail Repository Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/manual.mdx Clone the AirTrail project repository and navigate into the project directory. ```bash git clone https://github.com/JohanOhly/AirTrail.git cd AirTrail ``` -------------------------------- ### Data Formatting and Checking Commands Source: https://github.com/johanohly/airtrail/blob/main/data/README.md Commands to format and check the data files. `bun run data:format` sorts and formats JSON files, while `bun run data:check` verifies formatting. ```bash bun run data:format # Format files ``` ```bash bun run data:check # Check formatting ``` -------------------------------- ### List Users Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/administration/admin-cli.mdx Lists all users, their roles, and account details. This command provides an overview of the user base within AirTrail. ```bash docker exec -it airtrail airtrail-admin list-users ``` -------------------------------- ### Airline Icon Naming Convention Source: https://github.com/johanohly/airtrail/blob/main/data/README.md Illustrates the naming convention for airline icon files. Icons should be named according to the airline's `id` field. ```text icons/airlines/american-airlines.svg ``` -------------------------------- ### Grant Admin Role Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/administration/admin-cli.mdx Promotes a regular user to the admin role. This command prompts for the username and only works on users with the 'user' role, not the 'owner' role. ```bash docker exec -it airtrail airtrail-admin grant-admin ``` -------------------------------- ### Update AirTrail with Docker Compose Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/install/updating.mdx Use this command to pull the latest Docker image and restart the AirTrail containers. ```bash docker compose pull && docker compose up -d ``` -------------------------------- ### Basic E2E Test Structure in TypeScript Source: https://github.com/johanohly/airtrail/blob/main/tests/e2e/README.md Illustrates the fundamental structure of an end-to-end test using TypeScript, including necessary imports for factories, helpers, and the testing framework. This pattern is used for individual tests within the 'tests/' directory. ```typescript import { usersFactory } from '@test/factories/users'; import { login } from '@test/helpers/auth'; import { expect, test } from '@test/index'; test.describe('Feature Name', () => { test('test description', async ({ page }) => { const { user } = await usersFactory.create(); await login(page, user); await page.goto('/'); await expect(page).toHaveURL('/'); }); }); ``` -------------------------------- ### POST /flight/save Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/api/flight/save-flight.mdx Create a new flight or update an existing one. If the `id` field is present, the flight will be updated. Otherwise, a new flight will be created. ```APIDOC ## POST /flight/save ### Description Create a new flight or update an existing one. If the `id` field is present, the flight will be updated. Otherwise, a new flight will be created. ### Method POST ### Endpoint /flight/save ### Request Body - **id** (string) - Optional - The unique identifier of the flight to update. If not provided, a new flight will be created. ### Response #### Success Response (200) - **flight** (object) - The created or updated flight object. ``` -------------------------------- ### Docker Compose Outbound Proxy Configuration Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/administration/outbound-proxy.mdx Set these environment variables in your Docker Compose file or .env file to enable outbound proxy support for the AirTrail service. ```bash NODE_USE_ENV_PROXY=1 HTTPS_PROXY=http://proxy.example.com:8080 HTTP_PROXY=http://proxy.example.com:8080 NO_PROXY=localhost,127.0.0.1,db,airtrail_db ``` -------------------------------- ### Saving a Flight with Custom Fields via API Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/features/custom-fields.mdx Demonstrates how to include custom field data when saving or updating a flight using the POST /flight/save endpoint. The 'customFields' object should be keyed by the field's unique identifier. ```json { "from": "KJFK", "to": "EGLL", "departure": "2026-02-20", "seats": [{ "userId": "" }], "customFields": { "booking_reference": "ABC123", "delay_minutes": 15 } } ``` -------------------------------- ### Contribution Flow Diagram Source: https://github.com/johanohly/airtrail/blob/main/CONTRIBUTING.md Visual representation of the ideal contribution flow for the AirTrail project, from opening an issue to merging changes. ```text ┌───────────────────────┐ │ │ │ Open an issue │ │ (a bug report or a │ │ feature request) │ │ │ └───────────────────────┘ ⇩ ┌───────────────────────┐ │ │ │ Open a Pull Request │ │ (only after issue │ │ is approved) │ │ │ └───────────────────────┘ ⇩ ┌───────────────────────┐ │ │ │ Your changes will │ │ be merged and │ │ published on the next │ │ release │ │ │ └───────────────────────┘ ``` -------------------------------- ### TLS Inspection CA Certificate Configuration Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/administration/outbound-proxy.mdx If your proxy performs TLS inspection, set this environment variable to the path of your organization's certificate authority file so Node.js can trust the intercepted traffic. ```bash NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem ``` -------------------------------- ### Reset User Password Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/administration/admin-cli.mdx Interactively resets a user's password. Requires the `-it` flags for terminal interaction. The new password must be at least 8 characters long. ```bash docker exec -it airtrail airtrail-admin reset-password ``` -------------------------------- ### JSON Export Format Structure Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/features/export.mdx This is the structure for exporting flight data in JSON format. It includes user and flight details, suitable for reimporting into AirTrail or integrating with other systems. ```json { "users": [ { "id": "user_id", "displayName": "User Name", "username": "username" } ], "flights": [ { "date": "YYYY-MM-DD", "from": "ICAO_CODE", "to": "ICAO_CODE", "departure": "ISO_8601_DATETIME", "arrival": "ISO_8601_DATETIME", "duration": flight_duration_in_seconds, "flightNumber": "FLIGHT_NUMBER", "flightReason": "FLIGHT_REASON", "airline": "ICAO_AIRLINE_CODE", "aircraft": "ICAO_AIRCRAFT_TYPE", "aircraftReg": "AIRCRAFT_REGISTRATION", "note": "FLIGHT_NOTE", "seats": [ { "userId": "USER_ID", "guestName": "GUEST_NAME", "seat": "SEAT_TYPE", "seatNumber": "SEAT_NUMBER", "seatClass": "SEAT_CLASS" } ] } ] } ``` -------------------------------- ### Revoke Admin Role Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/administration/admin-cli.mdx Demotes an admin user back to a regular user. This command prompts for the username of the admin to be demoted. ```bash docker exec -it airtrail airtrail-admin revoke-admin ``` -------------------------------- ### Delete Flight Source: https://github.com/johanohly/airtrail/blob/main/docs/content/docs/api/flight/delete-flight.mdx Deletes a flight by its unique identifier. ```APIDOC ## POST /flight/delete ### Description Delete a flight by ID. ### Method POST ### Endpoint /flight/delete ### Request Body - **id** (string) - Required - The unique identifier of the flight to delete. ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the flight was deleted successfully. #### Response Example ```json { "message": "Flight deleted successfully" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.