Browser quickstart
Create an Eazip Cloud job directly from React or browser JavaScript with a public key.
Use the browser integration when your frontend already knows which file URLs belong in the ZIP. Eazip.js creates the Cloud job without a backend endpoint.
Create a public key
Sign in to Eazip, open Public keys, and select Create public key. It asks two questions:
- Where will your app run? The origin your frontend is served from. It
starts as
http://localhost:3000. - Where are your files? Paste a link to one of your files, such as
https://cdn.acme.example/photos/1.jpg. The key can then fetch files from that host.
Test source reachability
Eazip fetches files from its servers. Test with a real URL from each source host, even if that URL already works in your browser.
To add more sites or file hosts later, such as your production domain, open the key's menu and select Edit.
Copy the key and install Eazip.js
Select Create public key. The next screen shows your pk_ez_... key and a
snippet that already uses it. Install the package for your application:
npm install @eazip/reactnpm install @eazip/coreCreate your first Cloud job
Pass the public key, file URLs, and strategy: 'cloud':
'use client';
import { useEazip, EazipTray } from '@eazip/react';
export default function App({ urls }: { urls: string[] }) {
const zip = useEazip();
return (
<>
<button
onClick={() =>
zip.download({
strategy: 'cloud',
publicKey: process.env.NEXT_PUBLIC_EAZIP_KEY,
files: urls,
})
}
>
Download as ZIP
</button>
<EazipTray />
</>
);
}import { createZip } from '@eazip/core';
const urls = [
'https://cdn.acme.example/report.pdf',
'https://cdn.acme.example/photos.zip',
];
document.querySelector('#download').addEventListener('click', async () => {
const result = await createZip({
strategy: 'cloud',
publicKey: import.meta.env.VITE_EAZIP_KEY,
files: urls,
});
result.download();
});Public keys are browser-safe
A pk_ez_... key only works from the sites and file hosts you allowed for
it. Never use a secret zk_... API key in frontend code.
Troubleshooting
| Symptom | Check |
|---|---|
| Origin error before a job starts | Add the exact browser origin, including its port. |
| Job starts but fetching fails | Confirm the file host is allowed and reachable from Eazip. |
| Request is rejected by policy | Select Edit in the key's menu and check the delivery modes and limits under Advanced settings. |
Next, read Public keys and origins or the Jobs API.