Note: This repository now contains boilerplate code. The custom adapter is available as an npm package: adapter-foundry.
This repository provides a SvelteKit 2 / Svelte 5 template for building UI extensions inside CrowdStrike Falcon Foundry. It handles asset path resolution, hash routing, and SDK initialization for the Foundry sandboxed iframe environment.
Follow these steps to integrate the Foundry template into your project.
If you don't have a SvelteKit project yet, create one using the Skeleton template:
npm create svelte@latest my-foundry-app
# Choose: Skeleton project, TypeScript, Svelte 5
cd my-foundry-app
Note: If using TypeScript, ensure your tsconfig.json sets "moduleResolution": "bundler" (or higher) to correctly resolve Svelte modules.
The adapter is available as an npm package:
npm install --save-dev adapter-foundry
The template requires the official CrowdStrike Foundry JS SDK:
npm install @crowdstrike/foundry-js
svelte.config.jsReplace your svelte.config.js with the one from the boilerplate/ folder. It enables two critical settings:
# for navigation because Foundry controls the URL pathname./_app/ paths to relative ./_app/ paths so assets load correctly in the Foundry iframe.Copy boilerplate/falcon.svelte.ts to src/lib/falcon.svelte.ts.
This module creates a reactive global singleton using Svelte 5 $state runes. It manages the connection state (ready) and provides access to the FalconApi instance via getFalcon().
Copy boilerplate/+layout.svelte to src/routes/+layout.svelte.
The layout performs three vital roles:
initFalcon() on mount to establish the handshake with the Foundry parent frame.falcon.navigation.navigateTo(). It uses /falcon/ and /internal/ path prefixes to distinguish between navigation types.getFalcon() is safe to use in any child component.static/loading.gif to provide visual feedback while the SDK handshake is in progress.Copy static/loading.gif to your project's static/ folder. This image is required by the root layout to provide a loading state while the Foundry JS SDK initializes.
Copy boilerplate/+page.svelte to src/routes/+page.svelte.
This provides a functional example of a Foundry-style Query Editor with a sidebar for selection. It demonstrates Svelte 5 reactivity for handling UI state within a Foundry application.
adapter-foundry)src="/_app/..."). In Foundry's sandboxed environment, your app is accessed via a URL pattern like /foundry/page/<uuid>?path=<path>. Absolute paths resolve to the Foundry domain root (falcon.crowdstrike.com/_app/...) and result in 404s. This adapter rewrites every /_app/ reference to ./_app/ so that assets always resolve relative to your app's index page.svelte.config.js)#) for its internal router.#fragment while leaving the rest of the URL to Foundry.falcon.svelte.ts)@crowdstrike/foundry-js SDK using Svelte 5 $state runes..svelte.ts file, we create a reactive singleton. Any component can import ready or getFalcon() and automatically re-render when the connection status changes. This avoids the need for complex context providers and ensures the SDK is available even in non-component logic like SvelteKit load functions.+layout.svelte)beforeNavigate hook to intercept all internal link clicks and route them through the Falcon SDK./internal/*: Used for navigation within your application. In production, this calls navigateTo with type: 'internal'. In local dev, it is automatically converted to hash-based routing (/#/*)./falcon/*: Used for navigation to other areas of the Falcon console. In production, this calls navigateTo with type: 'falcon'.https://google.com) is automatically intercepted and opened in a new tab via the Falcon SDK (using target: '_blank' internally).+layout.svelte){#if ready} block in the root layout.ready is true, we guarantee that any child component can call getFalcon() immediately in its initialization logic without checking for null or handling "unconnected" states.To ensure navigation works correctly both in local development and within the Falcon console, follow these linking conventions. Note that while hash-based routing is enabled to handle initial page loads, all subsequent navigation must go through the Falcon Navigation API (via the prefix system below) to keep the browser URL in sync.
/internal/ prefix for all links within your application.<a href="/internal/my-page">Go to My Page</a>
/falcon/ prefix to navigate to other pages in the Falcon console.<a href="/falcon/investigate/events">View Events</a>
target="_blank" on these links.<a href="https://docs.crowdstrike.com">Documentation</a>
[!IMPORTANT]
Avoidtarget="_blank": Do not addtarget="_blank"to your links. The template's navigation handler automatically manages opening external links in new tabs using the Falcon SDK. Manually addingtarget="_blank"will bypass this handler and break external routing within the Falcon console.
npm run build
/build directory. Zip the contents of this folder and upload it as your UI bundle in the CrowdStrike Falcon console.MIT — Mullaney Strategic Systems LLC
CrowdStrike and Falcon are trademarks or registered trademarks of CrowdStrike, Inc. in the United States and other countries. This project is not affiliated with, sponsored by, or endorsed by CrowdStrike, Inc.