Quickstart
Use this pre-built prompt to get started faster with Svelte.
Alternatively, follow these steps to manually add ExpressCSV to a Svelte app and receive imports in your existing backend.
-
Install the SDK
-
Backend: create a session endpoint 🔒
Keep your ExpressCSV secret key on the backend, call the session-creation endpoint, and return only the short-lived importer session token to the frontend.
For example, in a Koa backend:
-
Frontend: configure and open the importer
This code runs in your Svelte app. The
getSessionTokencallback calls the backend session endpoint we made earlier right before opening the importer. -
Render the button in your app
-
Backend: receive webhook 📦
Here's an example Koa backend. In a real app, keep your schema in a shared or
corepackage, import it into both the frontend and your backend, and use@expresscsv/schemasto infer the webhook payload type:Return a
2xxresponse for each chunk.5xxand429responses are retried automatically, while other4xxresponses are treated as permanent failures.
What's Next
- Types — define field types, validation rules, and TypeScript types
- Styling — theme the importer to match your app
- Webhooks — deliver records to your backend
- API Reference — full constructor,
open(), and lifecycle reference