Four moving parts. That’s it.
Filestack handles the file plane. The app is a thin Next.js UI on top, with a single SQLite table tracking shares.
Four Steps From Drop to Shareable Link
Every share follows the same path: drop, upload, save, share. The browser talks to Filestack directly, and the Next.js API just mints the code.
User picks one file
The dropzone catches a drag event or opens the native file picker. One file at a time, capped client-side at 500 KB.
Direct POST to Filestack
An XHR sends the file straight to filestackapi.com/api/store/S3 with the public API key. Progress is streamed back into the UI.
Mint a 10-char code
The browser POSTs the Filestack handle, URL, and a device fingerprint to /api/share. The server rate-limits per fingerprint and inserts a row keyed by nanoid(10).
Copy the /s/<code> URL
The success card surfaces a one-click copy button. Visiting /s/<code> renders a preview page powered by Filestack transformations.
One XHR to Filestack, one POST to your API
No SDK. The Uploader posts the raw file straight to Filestack’s store endpoint, watches progress, then sends the returned handle to /api/share to mint a code.
Validation, rate limiting, and a 10-char code
The save route doesn’t sign anything — it leans on Filestack’s CDN being the source of truth. Instead it validates the URL shape, rate-limits per device, and stores the handle under a short nanoid code.
How Fireshare Works Under the Hood
What database does the demo use?
Turso (libSQL / SQLite) via Drizzle ORM. There’s a single shares table with indexes on code and fingerprint. Swap lib/db/index.ts for any Drizzle adapter — Postgres, MySQL, or a local SQLite file — and the rest of the app keeps working.
How are uploads kept secure?
The demo doesn’t sign Filestack policies. The browser uploads directly with the public API key, and /api/share validates the returned URL against a regex that requires cdn.filestackcontent.com. For production sharing you’d want to layer signed policies on top — the docs cover the pattern.
What's the maximum file size?
500 KB. The cap is enforced both client-side in the Uploader and server-side in the share route via MAX_FILE_BYTES in lib/utils.ts. Filestack itself supports much larger files — bump the constant and the limit moves with you.
Does it support file previews?
Yes — the /s/[code] page renders a Transformations component that uses Filestack’s image transformations to show inline previews.
Is there rate limiting?
Yes — 10 shares per 24 hours per device. The browser sends a base64-encoded fingerprint (user agent + locale + screen + timezone) on each save, and the API counts recent rows for that fingerprint before inserting.