nelkap.handle. This section shows how to add that route in your framework, from the keys to your first run.
Choose your framework
Next.js
A route handler in the App Router.
React Router
A resource route, in framework mode.
SvelteKit
A
+server.ts endpoint.Nuxt
A server route in the
server folder.Astro
An endpoint rendered on demand.
Hono
A route on a Hono app running on Node.js.
Express
A route that turns Express’s request into a standard one.
Any other framework
nelkap.handle takes a standard web Request and returns a standard Response. Any framework that gives you the incoming request in that form works the same way: add a POST route, and return what handle returns.
What happens when Nelkap calls your route
Each call carries the workflow to run, the run’s payload, and the steps already saved.handle then does three things:
- It checks that the call carries your project’s secret. If it doesn’t, it answers
401, and nothing runs. - It looks for the workflow among the ones you registered. If your app doesn’t have it, it answers
404. - It answers
202right away, then runs the workflow in the background, saving each step as it finishes.
What your endpoint needs
- A public HTTPS URL on a domain name. Nelkap calls it over the internet, so a local address won’t work.
- An answer within 30 seconds, without a redirect.
handleanswers at once, so this only matters if something runs before it. - No sign-in. If your app checks sign-in on every route, leave this one out:
handlechecks Nelkap’s secret instead.
deliveryFailed, and you can replay it once your endpoint is back.
Serverless hosts
Hosts like Vercel can stop your code as soon as the response is sent. Sincehandle answers before the workflow runs, the run would stop with it. To keep it going, pass your host’s waitUntil to handle:
waitUntil for its hosts.
These hosts also limit how long a function can run. A call runs as many steps as it can within that limit. If the host stops it first, every step already saved is kept, and Nelkap calls your app again five minutes later to go on from there. Only a single step longer than the limit can’t finish, so keep each step shorter than your host allows.
Your project’s secret
Nelkap sends your project’s secret with every call, andhandle compares it with NELKAP_SECRET. You can rotate the secret from your projects, for example if it leaked. Your endpoint then turns calls away until it has the new one, so update NELKAP_SECRET right after.