Choose your path
Pick the option that best describes your project to jump to the right guide.
How it works
Production embeds use a tiny public loader. You never ship the full UI as readable CDN JS/CSS.
- Your page loads
https://cdn.filestorage.io/loader.min.js(exposeswindow.FileStorageSDK). - You call
FileStorageSDK.mount({ el, apiKey, s3 | http }). - The loader checks your key + registered domain via
POST /v1/sdk/bootstrap, then mounts a sandboxed iframe fromcdn.filestorage.io/frame.html. - Inside the iframe only: encrypted assets are fetched from the API, decrypted, and injected. Your parent page never sees the product bundle in View Source.
Every production mount needs an apiKey plus one storage backend:
- S3 proxy - your server holds AWS credentials and talks to your bucket.
- HTTP API - your backend implements the list / upload / rename / move / remove contract.
- Managed - we host the bucket (Trial includes 1 GB); use the HTTP adapter from your dashboard (no AWS keys on your side).
Quick start (HTML)
Minimum working embed once you have a key, a registered website, and a storage proxy URL:
<!-- 1. Container with explicit height -->
<div id="fm" style="height: 70vh"></div>
<!-- 2. Public loader (only CDN script you need) -->
<script src="https://cdn.filestorage.io/loader.min.js"></script>
<!-- 3. Mount after the loader -->
<script>
const { unmount } = FileStorageSDK.mount({
el: '#fm',
apiKey: 'fs_live_…', // from Dashboard → Keys
s3: {
proxyBaseUrl: 'https://api.example.com/fm',
publicObjectBaseUrl: 'https://cdn.example.com',
headers: () => ({
Authorization: 'Bearer ' + (localStorage.getItem('token') || ''),
}),
},
})
// Call unmount() when leaving the page / destroying the component
</script>Install checklist
No npm package is required for production embeds. Follow these steps in order.
1. API key and website
- Create an account and pick a plan.
- In the dashboard, create an API key (
fs_live_…). - Under Websites, register every host that will call
mount()(e.g.localhost,app.example.com). Once any site is registered, unlisted hosts getDOMAIN_NOT_ALLOWED.
2. Load the CDN loader
Add the public loader once in your root layout or page (before any mount() call):
<script src="https://cdn.filestorage.io/loader.min.js"></script>Editor plugins load after the loader — see editor plugins.
3. Verify the loader
// Browser console on your site (after the script tag):
typeof FileStorageSDK.mount === 'function' // → trueSelf-host the loader (optional)
You may host loader.min.js yourself. The encrypted UI still comes from api.filestorage.io at runtime (online bootstrap is required):
curl -fsSL https://cdn.filestorage.io/loader.min.js -o loader.min.jsEmbed with mount()
Call FileStorageSDK.mount() with a container that has an explicit height, your apiKey, and either s3 or http. Pick your framework — your choice is remembered across the docs:
<div id="fm" style="height: 70vh"></div>
<script src="https://cdn.filestorage.io/loader.min.js"></script>
<script>
const { unmount } = FileStorageSDK.mount({
el: '#fm',
apiKey: 'fs_live_…',
s3: {
proxyBaseUrl: 'https://api.example.com/fm',
publicObjectBaseUrl: 'https://cdn.example.com',
},
})
</script>import { useEffect, useRef } from 'react'
export function FileManager() {
const ref = useRef<HTMLDivElement>(null)
useEffect(() => {
if (!ref.current) return
const { unmount } = window.FileStorageSDK.mount({
el: ref.current,
apiKey: import.meta.env.VITE_FILESTORAGE_API_KEY,
s3: { proxyBaseUrl: 'https://api.example.com/fm' },
})
return unmount
}, [])
return <div ref={ref} style={{ height: '70vh' }} />
}<script setup lang="ts">
import { onMounted, onBeforeUnmount, ref } from 'vue'
const host = ref<HTMLElement | null>(null)
let unmount: (() => void) | undefined
onMounted(() => {
if (!host.value) return
unmount = window.FileStorageSDK.mount({
el: host.value,
apiKey: import.meta.env.VITE_FILESTORAGE_API_KEY,
s3: { proxyBaseUrl: 'https://api.example.com/fm' },
}).unmount
})
onBeforeUnmount(() => unmount?.())
</script>
<template>
<div ref="host" style="height: 70vh" />
</template>import { AfterViewInit, Component, ElementRef, OnDestroy, ViewChild } from '@angular/core'
@Component({
selector: 'app-file-manager',
standalone: true,
template: '<div #host style="height: 70vh"></div>',
})
export class FileManagerComponent implements AfterViewInit, OnDestroy {
@ViewChild('host') host!: ElementRef<HTMLDivElement>
private unmount?: () => void
ngAfterViewInit() {
this.unmount = (window as any).FileStorageSDK.mount({
el: this.host.nativeElement,
apiKey: environment.fileStorageApiKey,
s3: { proxyBaseUrl: 'https://api.example.com/fm' },
}).unmount
}
ngOnDestroy() {
this.unmount?.()
}
}CSP, iframe, and layout
The UI runs in a cross-origin sandboxed iframe. Give the host element a real height and allow the CDN + API in your Content Security Policy:
| Directive | Allow |
|---|---|
script-src | https://cdn.filestorage.io (loader + optional editor plugins) |
frame-src / child-src | https://cdn.filestorage.io (frame.html) |
connect-src | https://api.filestorage.io (bootstrap + encrypted assets) and your S3 proxy / HTTP API origin |
Configuration
Pass store options (s3 / http), optional widget, and accessMode at mount time. Auth headers can be functions — the loader refreshes them over postMessage when the iframe needs them. Full option reference: Integration guide → mount().
S3 proxy
The SDK repo includes a reference Node proxy in examples/s3-proxy/. yarn dev starts it on port 3847 together with the demo UI. It exposes POST /list, /upload, /folder, /rename, /move, /remove, /search, and optional /listByType.
Local demo environment variables
Only needed when running the SDK repository demo locally. Copy env.example → .env in the SDK repo root. Production embeds do not use DEMO_* - pass options to mount() instead.
| Variables | Read by |
|---|---|
AWS_*, S3_*, PORT, REKOGNITION_REGION | S3 proxy only (server-side) |
DEMO_* | Vite demo - inlined into the browser bundle |
# Browser demo (public)
DEMO_STORE=s3
DEMO_S3_PROXY_BASE_URL=http://localhost:3847
DEMO_S3_PUBLIC_BASE_URL=https://your-bucket.s3.us-east-2.amazonaws.com
DEMO_FM_MAX_CONCURRENT_FETCHES=30
# S3 proxy (secret)
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-2
AWS_BUCKET=
PORT=3847