Skip to content

feat(presets): add platformatic preset - #4554

Draft
p-dubovitsky wants to merge 3 commits into
nitrojs:mainfrom
p-dubovitsky:platformatic-preset
Draft

p-dubovitsky wants to merge 3 commits into
nitrojs:mainfrom
p-dubovitsky:platformatic-preset

Conversation

@p-dubovitsky

Copy link
Copy Markdown
Contributor

🔗 Linked issue

#4553

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Adds a built-in platformatic preset.

The preset extends node-server and loads @platformatic/nitro/scheduler when scheduledTasks are configured. Applications without scheduled tasks are unaffected, and experimental.tasks remains an explicit opt-in.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@p-dubovitsky
p-dubovitsky requested a review from pi0 as a code owner August 24, 2026 12:14
@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

@p-dubovitsky is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 44b904cd-cb5c-4dae-a13f-373654137419
📥 Commits

Reviewing files that changed from the base of the PR and between 9d45f87 and ea76687.

📒 Files selected for processing (4)
  • docs/2.deploy/0.index.md
  • docs/2.deploy/20.providers/platformatic.md
  • src/presets/_all.gen.ts
  • src/presets/_types.gen.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/2.deploy/0.index.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

📝 Walkthrough

The PR adds a Platformatic Nitro preset with platformatic and watt aliases. It registers the preset, installs scheduler support when scheduled tasks are configured, adds unit tests, and documents configuration and build commands.

Changes: Platformatic Nitro integration

Layer / File(s) Summary
Preset registration and scheduler hook
src/presets/_types.gen.ts, src/presets/platformatic/preset.ts, src/presets/_all.gen.ts, test/unit/platformatic-preset.test.ts
The preset extends node-server, supports the platformatic and watt names, and installs the scheduler module when scheduled tasks exist. Unit tests cover cases with and without scheduled tasks.
Platformatic provider documentation
docs/2.deploy/0.index.md, docs/2.deploy/20.providers/platformatic.md
The deployment documentation lists Platformatic and describes aliases, configuration, build commands, and scheduler behavior when scheduled tasks are configured or empty.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to ea766

The Platformatic preset’s scheduler setup is conditional, and applications using scheduled tasks are told to install its integration package. No actionable merge-blocking risk remains in the reviewed changes.

Security architecture risk: 🔵 Low · up to ea766

The integration is selected through application build configuration, and scheduler installation requires configured schedules. No introduced security bypass was established. Risk remains low rather than minimal because the external scheduler’s runtime exposure and recovery behavior could not be verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The newly reachable dependency executes setup with the Nitro instance inside the application’s build process. A compromised scheduler dependency would inherit that process’s available authority. Effective worker, tenant, credential, or data-store exposure cannot be bounded further without the external implementation and deployment configuration.

Trust Boundaries and Controls

  • observed — The inspected consumers select presets during initialization from application configuration, environment, and CLI values. The added type literals do not themselves create an HTTP-controlled preset-selection path. Scheduler installation additionally requires nonempty build-configured schedules.
  • observed — The local task pipeline filters scheduled task names against configured tasks and rejects unknown names before loading configured handlers. This bounds the inspected Nitro task path, but does not prove equivalent enforcement in external scheduler entrypoints.

Hardening Proposals

  • proposed — For stronger lifecycle guarantees, track pending setup promises separately from successful installation and define failure cleanup before allowing retries. Validate the external scheduler’s close behavior and any runtime entrypoint authorization before relying on it for worker coordination.
Pre-merge checks · Passed 5
Passed Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title follows the Conventional Commits format and clearly describes the addition of the Platformatic preset.
Description check Passed The description is directly related to the changes. It explains the new preset, scheduler behavior, documentation updates, and linked discussion.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4554

commit: ea76687

@p-dubovitsky
p-dubovitsky deleted the platformatic-preset branch August 24, 2026 12:17
@p-dubovitsky
p-dubovitsky restored the platformatic-preset branch August 24, 2026 12:20
@p-dubovitsky p-dubovitsky reopened this Aug 24, 2026
@pi0x pi0x added enhancement New feature or improvement (PRs; issues use the Feature type) preset Deployment presets in general v3 labels Sep 2, 2026
if (Object.keys(nitro.options.scheduledTasks).length === 0) {
return;
}
await installModules(nitro, ["@platformatic/nitro/scheduler"]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need make this a built-in feature. Nitro presets do not require external dependencies.

@pi0x

pi0x commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

I rebased this onto latest main locally. The only conflict was docs/2.deploy/0.index.md, where main had recapitalised the provider names; I kept that and added Platformatic to the list. Typecheck, lint and test/unit/platformatic-preset.test.ts all pass. I could not push, so the branch here is unchanged.

@pi0's review point is still the blocker: the preset installs @platformatic/nitro/scheduler, an external package, so it is not self-contained. That needs resolving before this can land.

One thing I fixed: the docs used defineNitroConfig from nitro/config. In v3 it is import { defineConfig } from "nitro".

Note: #4025, #3970 and #3554 also add presets and touch the same generated files, so whoever lands first forces the rest to rebase.

This comment was written by an AI assistant on behalf of the Nitro maintainers. Please double-check anything that looks wrong.

pi0 added 2 commits October 13, 2026 13:38
# Conflicts:
#	docs/2.deploy/0.index.md
#	src/presets/_all.gen.ts
#	src/presets/_types.gen.ts
@pi0
pi0 marked this pull request as draft October 13, 2026 14:30
@pi0x pi0x removed the v3 label Nov 10, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement (PRs; issues use the Feature type) preset Deployment presets in general

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants