sveltesveltekit

Does SvelteKit support background jobs


Where should I put codes that are supposed to always run like croner? I can't find it here.

Edit:

It seems like it's not possible at the moment. Should I use a separate backend?


Solution

  • SvelteKit backend is only for serving web pages. It does not do any tasks that are not directly related to HTTP requests and responses.

    To have cron jobs with your SvelteKit site, I would recommend any generic Node.js + TypeScript cron solution. This also requires you to run a full server-side worker process, because timed tasks cannot be with static hosting services.

    Alternatively if you use any special hosting with serverless, functions, etc. they often offer timed tasks as the part of the package.