Download StackBlitz projects programmatically
While StackBlitz provides an API to fetch project data, there’s no built-in way to download projects as zip files. This tool makes it easy to download reproductions for issues quickly.
[!IMPORTANT]
This project is not affiliated with or endorsed by StackBlitz in any way. Users are responsible for ensuring their use of this tool complies with StackBlitz’s Terms of Service. Please review their terms before using this tool.
The easiest way to download a StackBlitz project is at stackblitz.zipundefined
Simply replace stackblitz.com with stackblitz.zip in any StackBlitz edit URL:
Original: https://stackblitz.com/edit/nuxt-starter-k7spa3r4
Download: https://stackblitz.zip/edit/nuxt-starter-k7spa3r4
# download a project
npx stackblitz-zip https://stackblitz.com/edit/nuxt-starter-k7spa3r4
# specify output path
npx stackblitz-zip https://stackblitz.com/edit/nuxt-starter-k7spa3r4 my-project.zip
Install the package:
npm install stackblitz-zip
import { downloadToFile, parseUrl } from 'stackblitz-zip'
// download from a URL
const projectId = parseUrl('https://stackblitz.com/edit/nuxt-starter-k7spa3r4')
await downloadToFile({ projectId, outputPath: './output.zip' })
// download by project ID
await downloadToFile({
projectId: 'nuxt-starter-k7spa3r4',
outputPath: './my-project.zip',
})
import { downloadToBlob, parseUrl } from 'stackblitz-zip'
// download as Blob (browser-friendly)
const projectId = parseUrl('https://stackblitz.com/edit/nuxt-starter-k7spa3r4')
const blob = await downloadToBlob({ projectId })
// trigger browser download
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = `${projectId}.zip`
a.click()
URL.revokeObjectURL(url)
[!NOTE]
Direct browser usage may be blocked by CORS when fetching from stackblitz.com.
[!NOTE]
The APIs use Web standards (fetch, ArrayBuffer, Blob) but direct fetching from stackblitz.com may be blocked by CORS.
Self-host the web service using the included Nitro app:
cd app
pnpm install
pnpm build
pnpm preview
Deploy to any platform using Nitro’s deployment presets - supports Vercel, Netlify, Cloudflare Pages, AWS, Azure, Node.js, and many more.
downloadToFile(options: DownloadOptions): Promise<string>Downloads a StackBlitz project and returns the path to the created zip file.
undefinedOptions:undefined
projectId (string, required): The StackBlitz project IDoutputPath (string, optional): Path where the zip file should be saved. Defaults to <project-id>.ziptimeout (number, optional): Timeout in milliseconds for loading the project. Defaults to 30000 (30 seconds)maxFileSize (number, optional): Maximum size per file in bytes. Defaults to 10485760 (10MB)maxTotalSize (number, optional): Maximum total project size in bytes. Defaults to 104857600 (100MB)verbose (boolean, optional): Enable console logging. Defaults to falsedownloadToBuffer(options): Promise<ArrayBuffer>Downloads a StackBlitz project and returns it as an ArrayBuffer (universal).
undefinedOptions: Same as downloadToFile except outputPath
downloadToBlob(options): Promise<Blob>Downloads a StackBlitz project and returns it as a Blob (browser-friendly).
undefinedOptions: Same as downloadToFile except outputPath
parseUrl(url: string): stringParse a StackBlitz URL and extract the project ID.
undefinedParameters:undefined
url (string, required): Full StackBlitz project URL (e.g., https://stackblitz.com/edit/project-id)undefinedReturns: The project ID
# clone this repository
git clone https://github.com/danielroe/stackblitz-clone
# install dependencies
corepack enable
pnpm install
# run interactive tests
pnpm dev
# build for production
pnpm build
Made with ❤️
Published under MIT License.
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.