Skip to content

docs(solidstart): add cron jobs guide using Nitro Tasks API#1534

Open
harshagarwalnyu wants to merge 2 commits into
solidjs:mainfrom
harshagarwalnyu:docs/solidstart-cron-jobs-guide
Open

docs(solidstart): add cron jobs guide using Nitro Tasks API#1534
harshagarwalnyu wants to merge 2 commits into
solidjs:mainfrom
harshagarwalnyu:docs/solidstart-cron-jobs-guide

Conversation

@harshagarwalnyu
Copy link
Copy Markdown
Contributor

Adds a new cron jobs guide to the SolidStart guides section, addressing #964.

The guide covers:

  • Enabling the experimental tasks feature in app.config.ts
  • Setting up cron expressions for scheduled runs
  • Creating a task file in the tasks/ directory (not src/tasks/)
  • The defineTask API from nitropack/runtime
  • Manually triggering tasks via /_nitro/tasks/<name> for testing
  • A note about the supported Nitro presets (dev, node-server, bun, deno-server)

Content is based on the working example shared in the issue. The guide also clarifies the nitropack dev dependency situation since it's a transitive dep that TypeScript sometimes can't resolve without an explicit install.

Closes #964

Documents how to set up scheduled background tasks in SolidStart
using Nitro's Tasks API. Covers configuration in app.config.ts,
task file structure in tasks/ directory, and manual triggering
via the Nitro task endpoint.

Closes solidjs#964
Copilot AI review requested due to automatic review settings June 1, 2026 12:42
@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 1, 2026

Deploy Preview for solid-docs ready!

Name Link
🔨 Latest commit 0a0bd4f
🔍 Latest deploy log https://app.netlify.com/projects/solid-docs/deploys/6a1d7fe7eb6912000857f5a2
😎 Deploy Preview https://deploy-preview-1534--solid-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new SolidStart guide explaining how to schedule and run cron-like background jobs using Nitro’s Tasks API.

Changes:

  • Introduces documentation for enabling Nitro tasks in app.config.ts and mapping cron expressions via scheduledTasks.
  • Documents creating a task in the root tasks/ directory with a minimal defineTask example.
  • Describes triggering tasks manually via the Nitro tasks endpoint for development/testing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


## Running tasks on demand

You can trigger a task manually by calling the Nitro task endpoint during development:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Addressed in 0a0bd4f by adding a :::caution block right after the endpoint example, warning that /_nitro/tasks/* executes server-side code on demand and is publicly reachable by default in the production presets (node-server, bun, deno-server). It now tells readers to protect it behind auth, IP allowlisting, or route-level middleware before deploying.

## Running tasks on demand

You can trigger a task manually by calling the Nitro task endpoint during development:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0a0bd4f. Swapped the bare /_nitro/tasks/cron line for a sh fenced curl http://localhost:3000/_nitro/tasks/cron example so the GET method and full URL are explicit.

- Add caution block warning that /_nitro/tasks/* is publicly accessible
  in production (node-server, bun, deno-server) and should be protected
- Add curl example with explicit GET method for task triggering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation Guide on CronJobs (Nitro Tasks)

2 participants