Skip to content

Add lazy workflow and step discovery in Next.js - #640

Merged
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery
Dec 23, 2025
Merged

Add lazy workflow and step discovery in Next.js#640
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery

Conversation

@ijjk

@ijjkijjk commented Dec 17, 2025

Copy link
Copy Markdown
Member

This re-architects the integration with workflows and Next.js to no longer need to do a pass over all entry points to discover workflows/steps. Instead workflows/steps will be discovered as Next.js is processing files via the configured loader automatically. Then once the loader is done being called we compile the workflow bundles. This also removes the need to have separate custom dev watching for workflows and we can fully rely on Next.js for watching for changes instead.

closes: #523
closes: #469

@changeset-bot

changeset-botBot commented Dec 17, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 60eaeb3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
NameType
@workflow/buildersPatch
@workflow/nextPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.032s (-21.2% 🟢)1.015s (~)0.983s101.00x
🌐 RedisNext.js (Turbopack)0.034s (-17.5% 🟢)1.018s (~)0.983s101.07x
🌐 StarterNext.js (Turbopack)0.040s (+3.4%)1.014s (~)0.974s101.24x
💻 LocalNitro0.042s (-1.0%)1.006s (~)0.965s101.30x
💻 LocalExpress0.044s (+1.6%)1.007s (~)0.964s101.37x
🌐 TursoNext.js (Turbopack)0.109s (+9.8% 🔺)1.013s (~)0.904s103.41x
🌐 MongoDBNext.js (Turbopack)0.117s (+58.8% 🔺)1.015s (~)0.898s103.66x
🐘 PostgresNitro0.269s (-10.7% 🟢)1.022s (+1.0%)0.753s108.41x
🐘 PostgresExpress0.318s (~)1.016s (~)0.698s109.95x
🐘 PostgresNext.js (Turbopack)0.365s (+123.7% 🔺)1.019s (~)0.654s1011.40x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.537s (+2.0%)1.639s (-17.3% 🟢)1.101s101.00x
▲ VercelExpress0.564s (-7.8% 🟢)1.545s (+5.8% 🔺)0.982s101.05x
▲ VercelNext.js (Turbopack)0.567s (-10.6% 🟢)1.570s (-0.9%)1.004s101.05x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.071s (-2.0%)2.011s (~)0.940s101.00x
🌐 RedisNext.js (Turbopack)1.077s (-1.4%)2.015s (~)0.937s101.01x
🌐 StarterNext.js (Turbopack)1.091s (~)2.009s (~)0.917s101.02x
💻 LocalNitro1.112s (~)2.006s (~)0.894s101.04x
💻 LocalExpress1.113s (~)2.007s (~)0.895s101.04x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.012s (~)0.710s101.21x
🌐 TursoNext.js (Turbopack)1.315s (+0.9%)2.012s (~)0.697s101.23x
🐘 PostgresNext.js (Turbopack)1.649s (-14.1% 🟢)2.016s (~)0.367s101.54x
🐘 PostgresExpress2.155s (~)3.016s (~)0.860s102.01x
🐘 PostgresNitro2.232s (+4.2%)3.015s (~)0.782s102.08x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.542s (-7.0% 🟢)3.702s (~)1.160s101.00x
▲ VercelNext.js (Turbopack)2.554s (-5.0%)3.634s (-1.8%)1.080s101.00x
▲ VercelExpress2.659s (~)3.624s (+2.2%)0.965s101.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.535s (-1.1%)11.016s (~)0.481s51.00x
🌐 RedisNext.js (Turbopack)10.580s (-0.9%)11.022s (~)0.442s51.00x
🌐 StarterNext.js (Turbopack)10.587s (~)11.010s (~)0.424s51.00x
💻 LocalExpress10.785s (~)11.013s (~)0.228s51.02x
💻 LocalNitro10.791s (~)11.013s (~)0.223s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.022s (~)0.838s51.16x
🌐 MongoDBNext.js (Turbopack)12.193s (~)13.021s (~)0.828s51.16x
🐘 PostgresNext.js (Turbopack)14.811s (-2.7%)15.441s (-3.7%)0.630s51.41x
🐘 PostgresNitro20.431s (~)21.037s (+0.9%)0.606s51.94x
🐘 PostgresExpress20.501s (~)21.032s (~)0.531s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro21.385s (-0.9%)22.047s (-1.7%)0.662s51.00x
▲ VercelExpress21.546s (~)22.397s (~)0.851s51.01x
▲ VercelNext.js (Turbopack)21.606s (-0.9%)22.346s (-0.9%)0.740s51.01x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.313s (-3.3%)2.011s (~)0.699s151.00x
💻 LocalNext.js (Turbopack)1.328s (-4.8%)2.012s (~)0.683s151.01x
🌐 StarterNext.js (Turbopack)1.343s (~)2.007s (~)0.664s151.02x
💻 LocalExpress1.403s (-0.6%)2.006s (~)0.603s151.07x
💻 LocalNitro1.415s (~)2.006s (~)0.591s151.08x
🐘 PostgresNext.js (Turbopack)1.869s (+1.3%)2.015s (-2.5%)0.146s151.42x
🌐 MongoDBNext.js (Turbopack)2.155s (+1.3%)3.013s (~)0.858s101.64x
🌐 TursoNext.js (Turbopack)2.176s (-0.8%)3.017s (~)0.841s101.66x
🐘 PostgresNitro2.338s (-0.6%)3.017s (~)0.679s101.78x
🐘 PostgresExpress2.396s (~)3.013s (~)0.616s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.719s (-0.6%)3.815s (+8.5% 🔺)1.096s81.00x
▲ VercelNitro2.740s (+1.0%)3.806s (~)1.066s81.01x
▲ VercelNext.js (Turbopack)2.935s (-3.8%)3.782s (-4.9%)0.847s81.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.014s (-6.9% 🟢)2.421s (-22.3% 🟢)0.407s131.00x
💻 LocalExpress2.165s (-2.0%)3.131s (-0.8%)0.966s101.07x
💻 LocalNitro2.176s (-2.1%)3.151s (~)0.975s101.08x
🌐 RedisNext.js (Turbopack)2.367s (-5.0% 🟢)3.012s (~)0.645s101.17x
🌐 StarterNext.js (Turbopack)2.446s (~)3.009s (~)0.563s101.21x
🐘 PostgresNext.js (Turbopack)2.576s (-2.2%)3.021s (~)0.444s101.28x
🐘 PostgresExpress2.978s (+2.0%)3.470s (+7.2% 🔺)0.492s91.48x
🐘 PostgresNitro3.048s (+14.8% 🔺)3.582s (+18.3% 🔺)0.534s91.51x
🌐 MongoDBNext.js (Turbopack)4.656s (-2.4%)5.186s (~)0.530s62.31x
🌐 TursoNext.js (Turbopack)4.661s (~)5.181s (~)0.520s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.716s (+16.9% 🔺)4.584s (+20.1% 🔺)0.868s71.00x
▲ VercelExpress3.754s (+23.3% 🔺)4.516s (+22.6% 🔺)0.761s71.01x
▲ VercelNitro3.912s (+25.9% 🔺)4.473s (+16.7% 🔺)0.560s71.05x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.325s (-4.5%)2.011s (~)0.686s151.00x
🌐 StarterNext.js (Turbopack)1.331s (-3.0%)2.007s (~)0.676s151.00x
💻 LocalNext.js (Turbopack)1.351s (-3.4%)2.015s (~)0.664s151.02x
💻 LocalNitro1.409s (-1.7%)2.005s (~)0.596s151.06x
💻 LocalExpress1.410s (~)2.006s (~)0.596s151.06x
🐘 PostgresNext.js (Turbopack)1.671s (+2.6%)2.013s (~)0.343s151.26x
🐘 PostgresNitro1.850s (-1.3%)2.011s (~)0.161s151.40x
🐘 PostgresExpress1.908s (+8.0% 🔺)2.077s (+3.3%)0.170s151.44x
🌐 MongoDBNext.js (Turbopack)2.140s (+1.0%)3.011s (~)0.871s101.62x
🌐 TursoNext.js (Turbopack)2.180s (-1.7%)3.013s (~)0.832s101.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.566s (-4.0%)3.664s (-2.9%)1.098s91.00x
▲ VercelExpress2.668s (-1.5%)3.665s (+4.5%)0.997s91.04x
▲ VercelNext.js (Turbopack)2.712s (+1.9%)3.655s (~)0.943s91.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.060s (-10.2% 🟢)2.918s (-10.1% 🟢)0.858s111.00x
💻 LocalNitro2.214s (-7.4% 🟢)3.157s (-5.2% 🟢)0.943s101.07x
💻 LocalExpress2.227s (-0.8%)3.177s (~)0.950s101.08x
🌐 RedisNext.js (Turbopack)2.381s (-4.3%)3.012s (~)0.632s101.16x
🌐 StarterNext.js (Turbopack)2.466s (~)3.008s (~)0.543s101.20x
🐘 PostgresNext.js (Turbopack)2.466s (-7.1% 🟢)3.021s (~)0.555s101.20x
🐘 PostgresNitro2.619s (+11.8% 🔺)3.024s (~)0.406s101.27x
🐘 PostgresExpress2.817s (+3.4%)3.015s (~)0.197s101.37x
🌐 TursoNext.js (Turbopack)4.702s (-1.4%)5.183s (~)0.481s62.28x
🌐 MongoDBNext.js (Turbopack)4.765s (+1.3%)5.181s (~)0.416s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.745s (+26.2% 🔺)4.586s (+24.6% 🔺)0.842s71.00x
▲ VercelExpress3.795s (+17.8% 🔺)4.591s (+20.7% 🔺)0.796s71.01x
▲ VercelNext.js (Turbopack)4.534s (+41.7% 🔺)5.280s (+36.2% 🔺)0.747s61.21x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.103s (-29.4% 🟢)1.003s (~)0.017s (+3.1%)1.027s (~)0.924s101.00x
🌐 RedisNext.js (Turbopack)0.109s (-23.8% 🟢)1.005s (~)0.000s (NaN%)1.014s (~)0.905s101.05x
🌐 StarterNext.js (Turbopack)0.126s (-2.6%)1.006s (~)0.000s (NaN%)1.011s (~)0.885s101.22x
💻 LocalExpress0.174s (-1.0%)0.992s (~)0.015s (-6.3% 🟢)1.022s (~)0.847s101.68x
💻 LocalNitro0.178s (+1.3%)0.993s (~)0.019s (+18.9% 🔺)1.025s (~)0.848s101.72x
🌐 MongoDBNext.js (Turbopack)0.517s (+0.9%)0.930s (-0.6%)0.000s (+Infinity% 🔺)1.013s (~)0.495s105.00x
🌐 TursoNext.js (Turbopack)0.545s (+11.2% 🔺)0.910s (-5.3% 🟢)0.000s (+200.0% 🔺)1.016s (~)0.471s105.27x
🐘 PostgresNext.js (Turbopack)0.910s (-23.1% 🟢)0.755s (-55.8% 🟢)0.000s (+Infinity% 🔺)1.015s (-44.2% 🟢)0.105s108.80x
🐘 PostgresNitro2.226s (-1.9%)2.823s (+2.0%)0.000s (~)3.016s (~)0.790s1021.51x
🐘 PostgresExpress2.309s (~)2.735s (~)0.000s (-100.0% 🟢)3.016s (~)0.707s1022.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.731s (-8.1% 🟢)3.210s (-0.8%)0.409s (-42.8% 🟢)4.100s (-8.8% 🟢)1.368s101.00x
▲ VercelNitro2.733s (+3.3%)3.330s (+3.4%)0.483s (-27.9% 🟢)4.241s (-1.5%)1.507s101.00x
▲ VercelNext.js (Turbopack)3.089s (+17.4% 🔺)3.571s (+11.8% 🔺)0.484s (-15.7% 🟢)4.515s (+7.6% 🔺)1.425s101.13x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local6/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds109110120
Total118138351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run

Comment threadpackages/next/src/builder.ts Outdated
Comment threadpackages/next/src/loader.ts Outdated
Comment threadpackages/next/src/loader.ts
dirs: ['.'], // Different apps that use nitro have different directories
}),
buildTarget: 'next', // Placeholder, not actually used
buildTarget: 'nitro' as any, // Placeholder, not actually used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice

*/
// Re-export stdlib for discovery - needed because lazy discovery doesn't pick it up via eager scanning.
// The workflow builder injects this as a builtin module available in the workflow runtime sandbox.
export * from '../stdlib.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jc: does this mean things like DurableAgent and mux's external code won't work with lazy eval - when npm modules are distributed via npm?

@ijjkijjkDec 22, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Those will this one is just special since it's implicit not explicit/imported directly by the user.

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.

stdlib only contains fetch() which does need to be imported by the user. We got rid of the implicit fetch() hoisting a while ago.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah ya seems fine without it so must have only been needed from different issue early on in this PR.

#683

Comment threadpackages/builders/src/base-builder.ts
@ijjk

ijjk commented Dec 23, 2025

Copy link
Copy Markdown
MemberAuthor

@packages/next lists peerDependencies as "next": ">13". Any reason to believe that this is still accurate?

@VaguelySerious wrt^ this PR shouldn't be using any features that cause a Next.js semver requirement change but we should validate minimum supported version in follow-up as v13 does sound like a stretch and isn't maintained anymore.

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

Labels

None yet

Projects

None yet

5 participants

@ijjk@TooTallNate@pranaygp@Schniz@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Add lazy workflow and step discovery in Next.js by ijjk · Pull Request #640 · vercel/workflow · GitHub
Skip to content

Add lazy workflow and step discovery in Next.js - #640

Merged
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery
Dec 23, 2025
Merged

Add lazy workflow and step discovery in Next.js#640
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery

Conversation

@ijjk

@ijjkijjk commented Dec 17, 2025

Copy link
Copy Markdown
Member

This re-architects the integration with workflows and Next.js to no longer need to do a pass over all entry points to discover workflows/steps. Instead workflows/steps will be discovered as Next.js is processing files via the configured loader automatically. Then once the loader is done being called we compile the workflow bundles. This also removes the need to have separate custom dev watching for workflows and we can fully rely on Next.js for watching for changes instead.

closes: #523
closes: #469

@changeset-bot

changeset-botBot commented Dec 17, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 60eaeb3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
NameType
@workflow/buildersPatch
@workflow/nextPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.032s (-21.2% 🟢)1.015s (~)0.983s101.00x
🌐 RedisNext.js (Turbopack)0.034s (-17.5% 🟢)1.018s (~)0.983s101.07x
🌐 StarterNext.js (Turbopack)0.040s (+3.4%)1.014s (~)0.974s101.24x
💻 LocalNitro0.042s (-1.0%)1.006s (~)0.965s101.30x
💻 LocalExpress0.044s (+1.6%)1.007s (~)0.964s101.37x
🌐 TursoNext.js (Turbopack)0.109s (+9.8% 🔺)1.013s (~)0.904s103.41x
🌐 MongoDBNext.js (Turbopack)0.117s (+58.8% 🔺)1.015s (~)0.898s103.66x
🐘 PostgresNitro0.269s (-10.7% 🟢)1.022s (+1.0%)0.753s108.41x
🐘 PostgresExpress0.318s (~)1.016s (~)0.698s109.95x
🐘 PostgresNext.js (Turbopack)0.365s (+123.7% 🔺)1.019s (~)0.654s1011.40x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.537s (+2.0%)1.639s (-17.3% 🟢)1.101s101.00x
▲ VercelExpress0.564s (-7.8% 🟢)1.545s (+5.8% 🔺)0.982s101.05x
▲ VercelNext.js (Turbopack)0.567s (-10.6% 🟢)1.570s (-0.9%)1.004s101.05x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.071s (-2.0%)2.011s (~)0.940s101.00x
🌐 RedisNext.js (Turbopack)1.077s (-1.4%)2.015s (~)0.937s101.01x
🌐 StarterNext.js (Turbopack)1.091s (~)2.009s (~)0.917s101.02x
💻 LocalNitro1.112s (~)2.006s (~)0.894s101.04x
💻 LocalExpress1.113s (~)2.007s (~)0.895s101.04x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.012s (~)0.710s101.21x
🌐 TursoNext.js (Turbopack)1.315s (+0.9%)2.012s (~)0.697s101.23x
🐘 PostgresNext.js (Turbopack)1.649s (-14.1% 🟢)2.016s (~)0.367s101.54x
🐘 PostgresExpress2.155s (~)3.016s (~)0.860s102.01x
🐘 PostgresNitro2.232s (+4.2%)3.015s (~)0.782s102.08x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.542s (-7.0% 🟢)3.702s (~)1.160s101.00x
▲ VercelNext.js (Turbopack)2.554s (-5.0%)3.634s (-1.8%)1.080s101.00x
▲ VercelExpress2.659s (~)3.624s (+2.2%)0.965s101.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.535s (-1.1%)11.016s (~)0.481s51.00x
🌐 RedisNext.js (Turbopack)10.580s (-0.9%)11.022s (~)0.442s51.00x
🌐 StarterNext.js (Turbopack)10.587s (~)11.010s (~)0.424s51.00x
💻 LocalExpress10.785s (~)11.013s (~)0.228s51.02x
💻 LocalNitro10.791s (~)11.013s (~)0.223s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.022s (~)0.838s51.16x
🌐 MongoDBNext.js (Turbopack)12.193s (~)13.021s (~)0.828s51.16x
🐘 PostgresNext.js (Turbopack)14.811s (-2.7%)15.441s (-3.7%)0.630s51.41x
🐘 PostgresNitro20.431s (~)21.037s (+0.9%)0.606s51.94x
🐘 PostgresExpress20.501s (~)21.032s (~)0.531s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro21.385s (-0.9%)22.047s (-1.7%)0.662s51.00x
▲ VercelExpress21.546s (~)22.397s (~)0.851s51.01x
▲ VercelNext.js (Turbopack)21.606s (-0.9%)22.346s (-0.9%)0.740s51.01x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.313s (-3.3%)2.011s (~)0.699s151.00x
💻 LocalNext.js (Turbopack)1.328s (-4.8%)2.012s (~)0.683s151.01x
🌐 StarterNext.js (Turbopack)1.343s (~)2.007s (~)0.664s151.02x
💻 LocalExpress1.403s (-0.6%)2.006s (~)0.603s151.07x
💻 LocalNitro1.415s (~)2.006s (~)0.591s151.08x
🐘 PostgresNext.js (Turbopack)1.869s (+1.3%)2.015s (-2.5%)0.146s151.42x
🌐 MongoDBNext.js (Turbopack)2.155s (+1.3%)3.013s (~)0.858s101.64x
🌐 TursoNext.js (Turbopack)2.176s (-0.8%)3.017s (~)0.841s101.66x
🐘 PostgresNitro2.338s (-0.6%)3.017s (~)0.679s101.78x
🐘 PostgresExpress2.396s (~)3.013s (~)0.616s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.719s (-0.6%)3.815s (+8.5% 🔺)1.096s81.00x
▲ VercelNitro2.740s (+1.0%)3.806s (~)1.066s81.01x
▲ VercelNext.js (Turbopack)2.935s (-3.8%)3.782s (-4.9%)0.847s81.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.014s (-6.9% 🟢)2.421s (-22.3% 🟢)0.407s131.00x
💻 LocalExpress2.165s (-2.0%)3.131s (-0.8%)0.966s101.07x
💻 LocalNitro2.176s (-2.1%)3.151s (~)0.975s101.08x
🌐 RedisNext.js (Turbopack)2.367s (-5.0% 🟢)3.012s (~)0.645s101.17x
🌐 StarterNext.js (Turbopack)2.446s (~)3.009s (~)0.563s101.21x
🐘 PostgresNext.js (Turbopack)2.576s (-2.2%)3.021s (~)0.444s101.28x
🐘 PostgresExpress2.978s (+2.0%)3.470s (+7.2% 🔺)0.492s91.48x
🐘 PostgresNitro3.048s (+14.8% 🔺)3.582s (+18.3% 🔺)0.534s91.51x
🌐 MongoDBNext.js (Turbopack)4.656s (-2.4%)5.186s (~)0.530s62.31x
🌐 TursoNext.js (Turbopack)4.661s (~)5.181s (~)0.520s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.716s (+16.9% 🔺)4.584s (+20.1% 🔺)0.868s71.00x
▲ VercelExpress3.754s (+23.3% 🔺)4.516s (+22.6% 🔺)0.761s71.01x
▲ VercelNitro3.912s (+25.9% 🔺)4.473s (+16.7% 🔺)0.560s71.05x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.325s (-4.5%)2.011s (~)0.686s151.00x
🌐 StarterNext.js (Turbopack)1.331s (-3.0%)2.007s (~)0.676s151.00x
💻 LocalNext.js (Turbopack)1.351s (-3.4%)2.015s (~)0.664s151.02x
💻 LocalNitro1.409s (-1.7%)2.005s (~)0.596s151.06x
💻 LocalExpress1.410s (~)2.006s (~)0.596s151.06x
🐘 PostgresNext.js (Turbopack)1.671s (+2.6%)2.013s (~)0.343s151.26x
🐘 PostgresNitro1.850s (-1.3%)2.011s (~)0.161s151.40x
🐘 PostgresExpress1.908s (+8.0% 🔺)2.077s (+3.3%)0.170s151.44x
🌐 MongoDBNext.js (Turbopack)2.140s (+1.0%)3.011s (~)0.871s101.62x
🌐 TursoNext.js (Turbopack)2.180s (-1.7%)3.013s (~)0.832s101.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.566s (-4.0%)3.664s (-2.9%)1.098s91.00x
▲ VercelExpress2.668s (-1.5%)3.665s (+4.5%)0.997s91.04x
▲ VercelNext.js (Turbopack)2.712s (+1.9%)3.655s (~)0.943s91.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.060s (-10.2% 🟢)2.918s (-10.1% 🟢)0.858s111.00x
💻 LocalNitro2.214s (-7.4% 🟢)3.157s (-5.2% 🟢)0.943s101.07x
💻 LocalExpress2.227s (-0.8%)3.177s (~)0.950s101.08x
🌐 RedisNext.js (Turbopack)2.381s (-4.3%)3.012s (~)0.632s101.16x
🌐 StarterNext.js (Turbopack)2.466s (~)3.008s (~)0.543s101.20x
🐘 PostgresNext.js (Turbopack)2.466s (-7.1% 🟢)3.021s (~)0.555s101.20x
🐘 PostgresNitro2.619s (+11.8% 🔺)3.024s (~)0.406s101.27x
🐘 PostgresExpress2.817s (+3.4%)3.015s (~)0.197s101.37x
🌐 TursoNext.js (Turbopack)4.702s (-1.4%)5.183s (~)0.481s62.28x
🌐 MongoDBNext.js (Turbopack)4.765s (+1.3%)5.181s (~)0.416s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.745s (+26.2% 🔺)4.586s (+24.6% 🔺)0.842s71.00x
▲ VercelExpress3.795s (+17.8% 🔺)4.591s (+20.7% 🔺)0.796s71.01x
▲ VercelNext.js (Turbopack)4.534s (+41.7% 🔺)5.280s (+36.2% 🔺)0.747s61.21x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.103s (-29.4% 🟢)1.003s (~)0.017s (+3.1%)1.027s (~)0.924s101.00x
🌐 RedisNext.js (Turbopack)0.109s (-23.8% 🟢)1.005s (~)0.000s (NaN%)1.014s (~)0.905s101.05x
🌐 StarterNext.js (Turbopack)0.126s (-2.6%)1.006s (~)0.000s (NaN%)1.011s (~)0.885s101.22x
💻 LocalExpress0.174s (-1.0%)0.992s (~)0.015s (-6.3% 🟢)1.022s (~)0.847s101.68x
💻 LocalNitro0.178s (+1.3%)0.993s (~)0.019s (+18.9% 🔺)1.025s (~)0.848s101.72x
🌐 MongoDBNext.js (Turbopack)0.517s (+0.9%)0.930s (-0.6%)0.000s (+Infinity% 🔺)1.013s (~)0.495s105.00x
🌐 TursoNext.js (Turbopack)0.545s (+11.2% 🔺)0.910s (-5.3% 🟢)0.000s (+200.0% 🔺)1.016s (~)0.471s105.27x
🐘 PostgresNext.js (Turbopack)0.910s (-23.1% 🟢)0.755s (-55.8% 🟢)0.000s (+Infinity% 🔺)1.015s (-44.2% 🟢)0.105s108.80x
🐘 PostgresNitro2.226s (-1.9%)2.823s (+2.0%)0.000s (~)3.016s (~)0.790s1021.51x
🐘 PostgresExpress2.309s (~)2.735s (~)0.000s (-100.0% 🟢)3.016s (~)0.707s1022.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.731s (-8.1% 🟢)3.210s (-0.8%)0.409s (-42.8% 🟢)4.100s (-8.8% 🟢)1.368s101.00x
▲ VercelNitro2.733s (+3.3%)3.330s (+3.4%)0.483s (-27.9% 🟢)4.241s (-1.5%)1.507s101.00x
▲ VercelNext.js (Turbopack)3.089s (+17.4% 🔺)3.571s (+11.8% 🔺)0.484s (-15.7% 🟢)4.515s (+7.6% 🔺)1.425s101.13x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local6/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds109110120
Total118138351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run

Comment threadpackages/next/src/builder.ts Outdated
Comment threadpackages/next/src/loader.ts Outdated
Comment threadpackages/next/src/loader.ts
dirs: ['.'], // Different apps that use nitro have different directories
}),
buildTarget: 'next', // Placeholder, not actually used
buildTarget: 'nitro' as any, // Placeholder, not actually used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice

*/
// Re-export stdlib for discovery - needed because lazy discovery doesn't pick it up via eager scanning.
// The workflow builder injects this as a builtin module available in the workflow runtime sandbox.
export * from '../stdlib.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jc: does this mean things like DurableAgent and mux's external code won't work with lazy eval - when npm modules are distributed via npm?

@ijjkijjkDec 22, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Those will this one is just special since it's implicit not explicit/imported directly by the user.

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.

stdlib only contains fetch() which does need to be imported by the user. We got rid of the implicit fetch() hoisting a while ago.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah ya seems fine without it so must have only been needed from different issue early on in this PR.

#683

Comment threadpackages/builders/src/base-builder.ts
@ijjk

ijjk commented Dec 23, 2025

Copy link
Copy Markdown
MemberAuthor

@packages/next lists peerDependencies as "next": ">13". Any reason to believe that this is still accurate?

@VaguelySerious wrt^ this PR shouldn't be using any features that cause a Next.js semver requirement change but we should validate minimum supported version in follow-up as v13 does sound like a stretch and isn't maintained anymore.

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

Labels

None yet

Projects

None yet

5 participants

@ijjk@TooTallNate@pranaygp@Schniz@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add lazy workflow and step discovery in Next.js by ijjk · Pull Request #640 · vercel/workflow · GitHub
Skip to content

Add lazy workflow and step discovery in Next.js - #640

Merged
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery
Dec 23, 2025
Merged

Add lazy workflow and step discovery in Next.js#640
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery

Conversation

@ijjk

@ijjkijjk commented Dec 17, 2025

Copy link
Copy Markdown
Member

This re-architects the integration with workflows and Next.js to no longer need to do a pass over all entry points to discover workflows/steps. Instead workflows/steps will be discovered as Next.js is processing files via the configured loader automatically. Then once the loader is done being called we compile the workflow bundles. This also removes the need to have separate custom dev watching for workflows and we can fully rely on Next.js for watching for changes instead.

closes: #523
closes: #469

@changeset-bot

changeset-botBot commented Dec 17, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 60eaeb3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
NameType
@workflow/buildersPatch
@workflow/nextPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.032s (-21.2% 🟢)1.015s (~)0.983s101.00x
🌐 RedisNext.js (Turbopack)0.034s (-17.5% 🟢)1.018s (~)0.983s101.07x
🌐 StarterNext.js (Turbopack)0.040s (+3.4%)1.014s (~)0.974s101.24x
💻 LocalNitro0.042s (-1.0%)1.006s (~)0.965s101.30x
💻 LocalExpress0.044s (+1.6%)1.007s (~)0.964s101.37x
🌐 TursoNext.js (Turbopack)0.109s (+9.8% 🔺)1.013s (~)0.904s103.41x
🌐 MongoDBNext.js (Turbopack)0.117s (+58.8% 🔺)1.015s (~)0.898s103.66x
🐘 PostgresNitro0.269s (-10.7% 🟢)1.022s (+1.0%)0.753s108.41x
🐘 PostgresExpress0.318s (~)1.016s (~)0.698s109.95x
🐘 PostgresNext.js (Turbopack)0.365s (+123.7% 🔺)1.019s (~)0.654s1011.40x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.537s (+2.0%)1.639s (-17.3% 🟢)1.101s101.00x
▲ VercelExpress0.564s (-7.8% 🟢)1.545s (+5.8% 🔺)0.982s101.05x
▲ VercelNext.js (Turbopack)0.567s (-10.6% 🟢)1.570s (-0.9%)1.004s101.05x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.071s (-2.0%)2.011s (~)0.940s101.00x
🌐 RedisNext.js (Turbopack)1.077s (-1.4%)2.015s (~)0.937s101.01x
🌐 StarterNext.js (Turbopack)1.091s (~)2.009s (~)0.917s101.02x
💻 LocalNitro1.112s (~)2.006s (~)0.894s101.04x
💻 LocalExpress1.113s (~)2.007s (~)0.895s101.04x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.012s (~)0.710s101.21x
🌐 TursoNext.js (Turbopack)1.315s (+0.9%)2.012s (~)0.697s101.23x
🐘 PostgresNext.js (Turbopack)1.649s (-14.1% 🟢)2.016s (~)0.367s101.54x
🐘 PostgresExpress2.155s (~)3.016s (~)0.860s102.01x
🐘 PostgresNitro2.232s (+4.2%)3.015s (~)0.782s102.08x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.542s (-7.0% 🟢)3.702s (~)1.160s101.00x
▲ VercelNext.js (Turbopack)2.554s (-5.0%)3.634s (-1.8%)1.080s101.00x
▲ VercelExpress2.659s (~)3.624s (+2.2%)0.965s101.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.535s (-1.1%)11.016s (~)0.481s51.00x
🌐 RedisNext.js (Turbopack)10.580s (-0.9%)11.022s (~)0.442s51.00x
🌐 StarterNext.js (Turbopack)10.587s (~)11.010s (~)0.424s51.00x
💻 LocalExpress10.785s (~)11.013s (~)0.228s51.02x
💻 LocalNitro10.791s (~)11.013s (~)0.223s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.022s (~)0.838s51.16x
🌐 MongoDBNext.js (Turbopack)12.193s (~)13.021s (~)0.828s51.16x
🐘 PostgresNext.js (Turbopack)14.811s (-2.7%)15.441s (-3.7%)0.630s51.41x
🐘 PostgresNitro20.431s (~)21.037s (+0.9%)0.606s51.94x
🐘 PostgresExpress20.501s (~)21.032s (~)0.531s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro21.385s (-0.9%)22.047s (-1.7%)0.662s51.00x
▲ VercelExpress21.546s (~)22.397s (~)0.851s51.01x
▲ VercelNext.js (Turbopack)21.606s (-0.9%)22.346s (-0.9%)0.740s51.01x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.313s (-3.3%)2.011s (~)0.699s151.00x
💻 LocalNext.js (Turbopack)1.328s (-4.8%)2.012s (~)0.683s151.01x
🌐 StarterNext.js (Turbopack)1.343s (~)2.007s (~)0.664s151.02x
💻 LocalExpress1.403s (-0.6%)2.006s (~)0.603s151.07x
💻 LocalNitro1.415s (~)2.006s (~)0.591s151.08x
🐘 PostgresNext.js (Turbopack)1.869s (+1.3%)2.015s (-2.5%)0.146s151.42x
🌐 MongoDBNext.js (Turbopack)2.155s (+1.3%)3.013s (~)0.858s101.64x
🌐 TursoNext.js (Turbopack)2.176s (-0.8%)3.017s (~)0.841s101.66x
🐘 PostgresNitro2.338s (-0.6%)3.017s (~)0.679s101.78x
🐘 PostgresExpress2.396s (~)3.013s (~)0.616s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.719s (-0.6%)3.815s (+8.5% 🔺)1.096s81.00x
▲ VercelNitro2.740s (+1.0%)3.806s (~)1.066s81.01x
▲ VercelNext.js (Turbopack)2.935s (-3.8%)3.782s (-4.9%)0.847s81.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.014s (-6.9% 🟢)2.421s (-22.3% 🟢)0.407s131.00x
💻 LocalExpress2.165s (-2.0%)3.131s (-0.8%)0.966s101.07x
💻 LocalNitro2.176s (-2.1%)3.151s (~)0.975s101.08x
🌐 RedisNext.js (Turbopack)2.367s (-5.0% 🟢)3.012s (~)0.645s101.17x
🌐 StarterNext.js (Turbopack)2.446s (~)3.009s (~)0.563s101.21x
🐘 PostgresNext.js (Turbopack)2.576s (-2.2%)3.021s (~)0.444s101.28x
🐘 PostgresExpress2.978s (+2.0%)3.470s (+7.2% 🔺)0.492s91.48x
🐘 PostgresNitro3.048s (+14.8% 🔺)3.582s (+18.3% 🔺)0.534s91.51x
🌐 MongoDBNext.js (Turbopack)4.656s (-2.4%)5.186s (~)0.530s62.31x
🌐 TursoNext.js (Turbopack)4.661s (~)5.181s (~)0.520s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.716s (+16.9% 🔺)4.584s (+20.1% 🔺)0.868s71.00x
▲ VercelExpress3.754s (+23.3% 🔺)4.516s (+22.6% 🔺)0.761s71.01x
▲ VercelNitro3.912s (+25.9% 🔺)4.473s (+16.7% 🔺)0.560s71.05x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.325s (-4.5%)2.011s (~)0.686s151.00x
🌐 StarterNext.js (Turbopack)1.331s (-3.0%)2.007s (~)0.676s151.00x
💻 LocalNext.js (Turbopack)1.351s (-3.4%)2.015s (~)0.664s151.02x
💻 LocalNitro1.409s (-1.7%)2.005s (~)0.596s151.06x
💻 LocalExpress1.410s (~)2.006s (~)0.596s151.06x
🐘 PostgresNext.js (Turbopack)1.671s (+2.6%)2.013s (~)0.343s151.26x
🐘 PostgresNitro1.850s (-1.3%)2.011s (~)0.161s151.40x
🐘 PostgresExpress1.908s (+8.0% 🔺)2.077s (+3.3%)0.170s151.44x
🌐 MongoDBNext.js (Turbopack)2.140s (+1.0%)3.011s (~)0.871s101.62x
🌐 TursoNext.js (Turbopack)2.180s (-1.7%)3.013s (~)0.832s101.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.566s (-4.0%)3.664s (-2.9%)1.098s91.00x
▲ VercelExpress2.668s (-1.5%)3.665s (+4.5%)0.997s91.04x
▲ VercelNext.js (Turbopack)2.712s (+1.9%)3.655s (~)0.943s91.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.060s (-10.2% 🟢)2.918s (-10.1% 🟢)0.858s111.00x
💻 LocalNitro2.214s (-7.4% 🟢)3.157s (-5.2% 🟢)0.943s101.07x
💻 LocalExpress2.227s (-0.8%)3.177s (~)0.950s101.08x
🌐 RedisNext.js (Turbopack)2.381s (-4.3%)3.012s (~)0.632s101.16x
🌐 StarterNext.js (Turbopack)2.466s (~)3.008s (~)0.543s101.20x
🐘 PostgresNext.js (Turbopack)2.466s (-7.1% 🟢)3.021s (~)0.555s101.20x
🐘 PostgresNitro2.619s (+11.8% 🔺)3.024s (~)0.406s101.27x
🐘 PostgresExpress2.817s (+3.4%)3.015s (~)0.197s101.37x
🌐 TursoNext.js (Turbopack)4.702s (-1.4%)5.183s (~)0.481s62.28x
🌐 MongoDBNext.js (Turbopack)4.765s (+1.3%)5.181s (~)0.416s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.745s (+26.2% 🔺)4.586s (+24.6% 🔺)0.842s71.00x
▲ VercelExpress3.795s (+17.8% 🔺)4.591s (+20.7% 🔺)0.796s71.01x
▲ VercelNext.js (Turbopack)4.534s (+41.7% 🔺)5.280s (+36.2% 🔺)0.747s61.21x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.103s (-29.4% 🟢)1.003s (~)0.017s (+3.1%)1.027s (~)0.924s101.00x
🌐 RedisNext.js (Turbopack)0.109s (-23.8% 🟢)1.005s (~)0.000s (NaN%)1.014s (~)0.905s101.05x
🌐 StarterNext.js (Turbopack)0.126s (-2.6%)1.006s (~)0.000s (NaN%)1.011s (~)0.885s101.22x
💻 LocalExpress0.174s (-1.0%)0.992s (~)0.015s (-6.3% 🟢)1.022s (~)0.847s101.68x
💻 LocalNitro0.178s (+1.3%)0.993s (~)0.019s (+18.9% 🔺)1.025s (~)0.848s101.72x
🌐 MongoDBNext.js (Turbopack)0.517s (+0.9%)0.930s (-0.6%)0.000s (+Infinity% 🔺)1.013s (~)0.495s105.00x
🌐 TursoNext.js (Turbopack)0.545s (+11.2% 🔺)0.910s (-5.3% 🟢)0.000s (+200.0% 🔺)1.016s (~)0.471s105.27x
🐘 PostgresNext.js (Turbopack)0.910s (-23.1% 🟢)0.755s (-55.8% 🟢)0.000s (+Infinity% 🔺)1.015s (-44.2% 🟢)0.105s108.80x
🐘 PostgresNitro2.226s (-1.9%)2.823s (+2.0%)0.000s (~)3.016s (~)0.790s1021.51x
🐘 PostgresExpress2.309s (~)2.735s (~)0.000s (-100.0% 🟢)3.016s (~)0.707s1022.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.731s (-8.1% 🟢)3.210s (-0.8%)0.409s (-42.8% 🟢)4.100s (-8.8% 🟢)1.368s101.00x
▲ VercelNitro2.733s (+3.3%)3.330s (+3.4%)0.483s (-27.9% 🟢)4.241s (-1.5%)1.507s101.00x
▲ VercelNext.js (Turbopack)3.089s (+17.4% 🔺)3.571s (+11.8% 🔺)0.484s (-15.7% 🟢)4.515s (+7.6% 🔺)1.425s101.13x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local6/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds109110120
Total118138351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run

Comment threadpackages/next/src/builder.ts Outdated
Comment threadpackages/next/src/loader.ts Outdated
Comment threadpackages/next/src/loader.ts
dirs: ['.'], // Different apps that use nitro have different directories
}),
buildTarget: 'next', // Placeholder, not actually used
buildTarget: 'nitro' as any, // Placeholder, not actually used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice

*/
// Re-export stdlib for discovery - needed because lazy discovery doesn't pick it up via eager scanning.
// The workflow builder injects this as a builtin module available in the workflow runtime sandbox.
export * from '../stdlib.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jc: does this mean things like DurableAgent and mux's external code won't work with lazy eval - when npm modules are distributed via npm?

@ijjkijjkDec 22, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Those will this one is just special since it's implicit not explicit/imported directly by the user.

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.

stdlib only contains fetch() which does need to be imported by the user. We got rid of the implicit fetch() hoisting a while ago.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah ya seems fine without it so must have only been needed from different issue early on in this PR.

#683

Comment threadpackages/builders/src/base-builder.ts
@ijjk

ijjk commented Dec 23, 2025

Copy link
Copy Markdown
MemberAuthor

@packages/next lists peerDependencies as "next": ">13". Any reason to believe that this is still accurate?

@VaguelySerious wrt^ this PR shouldn't be using any features that cause a Next.js semver requirement change but we should validate minimum supported version in follow-up as v13 does sound like a stretch and isn't maintained anymore.

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

Labels

None yet

Projects

None yet

5 participants

@ijjk@TooTallNate@pranaygp@Schniz@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add lazy workflow and step discovery in Next.js by ijjk · Pull Request #640 · vercel/workflow · GitHub
Skip to content

Add lazy workflow and step discovery in Next.js - #640

Merged
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery
Dec 23, 2025
Merged

Add lazy workflow and step discovery in Next.js#640
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery

Conversation

@ijjk

@ijjkijjk commented Dec 17, 2025

Copy link
Copy Markdown
Member

This re-architects the integration with workflows and Next.js to no longer need to do a pass over all entry points to discover workflows/steps. Instead workflows/steps will be discovered as Next.js is processing files via the configured loader automatically. Then once the loader is done being called we compile the workflow bundles. This also removes the need to have separate custom dev watching for workflows and we can fully rely on Next.js for watching for changes instead.

closes: #523
closes: #469

@changeset-bot

changeset-botBot commented Dec 17, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 60eaeb3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
NameType
@workflow/buildersPatch
@workflow/nextPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.032s (-21.2% 🟢)1.015s (~)0.983s101.00x
🌐 RedisNext.js (Turbopack)0.034s (-17.5% 🟢)1.018s (~)0.983s101.07x
🌐 StarterNext.js (Turbopack)0.040s (+3.4%)1.014s (~)0.974s101.24x
💻 LocalNitro0.042s (-1.0%)1.006s (~)0.965s101.30x
💻 LocalExpress0.044s (+1.6%)1.007s (~)0.964s101.37x
🌐 TursoNext.js (Turbopack)0.109s (+9.8% 🔺)1.013s (~)0.904s103.41x
🌐 MongoDBNext.js (Turbopack)0.117s (+58.8% 🔺)1.015s (~)0.898s103.66x
🐘 PostgresNitro0.269s (-10.7% 🟢)1.022s (+1.0%)0.753s108.41x
🐘 PostgresExpress0.318s (~)1.016s (~)0.698s109.95x
🐘 PostgresNext.js (Turbopack)0.365s (+123.7% 🔺)1.019s (~)0.654s1011.40x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.537s (+2.0%)1.639s (-17.3% 🟢)1.101s101.00x
▲ VercelExpress0.564s (-7.8% 🟢)1.545s (+5.8% 🔺)0.982s101.05x
▲ VercelNext.js (Turbopack)0.567s (-10.6% 🟢)1.570s (-0.9%)1.004s101.05x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.071s (-2.0%)2.011s (~)0.940s101.00x
🌐 RedisNext.js (Turbopack)1.077s (-1.4%)2.015s (~)0.937s101.01x
🌐 StarterNext.js (Turbopack)1.091s (~)2.009s (~)0.917s101.02x
💻 LocalNitro1.112s (~)2.006s (~)0.894s101.04x
💻 LocalExpress1.113s (~)2.007s (~)0.895s101.04x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.012s (~)0.710s101.21x
🌐 TursoNext.js (Turbopack)1.315s (+0.9%)2.012s (~)0.697s101.23x
🐘 PostgresNext.js (Turbopack)1.649s (-14.1% 🟢)2.016s (~)0.367s101.54x
🐘 PostgresExpress2.155s (~)3.016s (~)0.860s102.01x
🐘 PostgresNitro2.232s (+4.2%)3.015s (~)0.782s102.08x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.542s (-7.0% 🟢)3.702s (~)1.160s101.00x
▲ VercelNext.js (Turbopack)2.554s (-5.0%)3.634s (-1.8%)1.080s101.00x
▲ VercelExpress2.659s (~)3.624s (+2.2%)0.965s101.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.535s (-1.1%)11.016s (~)0.481s51.00x
🌐 RedisNext.js (Turbopack)10.580s (-0.9%)11.022s (~)0.442s51.00x
🌐 StarterNext.js (Turbopack)10.587s (~)11.010s (~)0.424s51.00x
💻 LocalExpress10.785s (~)11.013s (~)0.228s51.02x
💻 LocalNitro10.791s (~)11.013s (~)0.223s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.022s (~)0.838s51.16x
🌐 MongoDBNext.js (Turbopack)12.193s (~)13.021s (~)0.828s51.16x
🐘 PostgresNext.js (Turbopack)14.811s (-2.7%)15.441s (-3.7%)0.630s51.41x
🐘 PostgresNitro20.431s (~)21.037s (+0.9%)0.606s51.94x
🐘 PostgresExpress20.501s (~)21.032s (~)0.531s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro21.385s (-0.9%)22.047s (-1.7%)0.662s51.00x
▲ VercelExpress21.546s (~)22.397s (~)0.851s51.01x
▲ VercelNext.js (Turbopack)21.606s (-0.9%)22.346s (-0.9%)0.740s51.01x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.313s (-3.3%)2.011s (~)0.699s151.00x
💻 LocalNext.js (Turbopack)1.328s (-4.8%)2.012s (~)0.683s151.01x
🌐 StarterNext.js (Turbopack)1.343s (~)2.007s (~)0.664s151.02x
💻 LocalExpress1.403s (-0.6%)2.006s (~)0.603s151.07x
💻 LocalNitro1.415s (~)2.006s (~)0.591s151.08x
🐘 PostgresNext.js (Turbopack)1.869s (+1.3%)2.015s (-2.5%)0.146s151.42x
🌐 MongoDBNext.js (Turbopack)2.155s (+1.3%)3.013s (~)0.858s101.64x
🌐 TursoNext.js (Turbopack)2.176s (-0.8%)3.017s (~)0.841s101.66x
🐘 PostgresNitro2.338s (-0.6%)3.017s (~)0.679s101.78x
🐘 PostgresExpress2.396s (~)3.013s (~)0.616s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.719s (-0.6%)3.815s (+8.5% 🔺)1.096s81.00x
▲ VercelNitro2.740s (+1.0%)3.806s (~)1.066s81.01x
▲ VercelNext.js (Turbopack)2.935s (-3.8%)3.782s (-4.9%)0.847s81.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.014s (-6.9% 🟢)2.421s (-22.3% 🟢)0.407s131.00x
💻 LocalExpress2.165s (-2.0%)3.131s (-0.8%)0.966s101.07x
💻 LocalNitro2.176s (-2.1%)3.151s (~)0.975s101.08x
🌐 RedisNext.js (Turbopack)2.367s (-5.0% 🟢)3.012s (~)0.645s101.17x
🌐 StarterNext.js (Turbopack)2.446s (~)3.009s (~)0.563s101.21x
🐘 PostgresNext.js (Turbopack)2.576s (-2.2%)3.021s (~)0.444s101.28x
🐘 PostgresExpress2.978s (+2.0%)3.470s (+7.2% 🔺)0.492s91.48x
🐘 PostgresNitro3.048s (+14.8% 🔺)3.582s (+18.3% 🔺)0.534s91.51x
🌐 MongoDBNext.js (Turbopack)4.656s (-2.4%)5.186s (~)0.530s62.31x
🌐 TursoNext.js (Turbopack)4.661s (~)5.181s (~)0.520s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.716s (+16.9% 🔺)4.584s (+20.1% 🔺)0.868s71.00x
▲ VercelExpress3.754s (+23.3% 🔺)4.516s (+22.6% 🔺)0.761s71.01x
▲ VercelNitro3.912s (+25.9% 🔺)4.473s (+16.7% 🔺)0.560s71.05x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.325s (-4.5%)2.011s (~)0.686s151.00x
🌐 StarterNext.js (Turbopack)1.331s (-3.0%)2.007s (~)0.676s151.00x
💻 LocalNext.js (Turbopack)1.351s (-3.4%)2.015s (~)0.664s151.02x
💻 LocalNitro1.409s (-1.7%)2.005s (~)0.596s151.06x
💻 LocalExpress1.410s (~)2.006s (~)0.596s151.06x
🐘 PostgresNext.js (Turbopack)1.671s (+2.6%)2.013s (~)0.343s151.26x
🐘 PostgresNitro1.850s (-1.3%)2.011s (~)0.161s151.40x
🐘 PostgresExpress1.908s (+8.0% 🔺)2.077s (+3.3%)0.170s151.44x
🌐 MongoDBNext.js (Turbopack)2.140s (+1.0%)3.011s (~)0.871s101.62x
🌐 TursoNext.js (Turbopack)2.180s (-1.7%)3.013s (~)0.832s101.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.566s (-4.0%)3.664s (-2.9%)1.098s91.00x
▲ VercelExpress2.668s (-1.5%)3.665s (+4.5%)0.997s91.04x
▲ VercelNext.js (Turbopack)2.712s (+1.9%)3.655s (~)0.943s91.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.060s (-10.2% 🟢)2.918s (-10.1% 🟢)0.858s111.00x
💻 LocalNitro2.214s (-7.4% 🟢)3.157s (-5.2% 🟢)0.943s101.07x
💻 LocalExpress2.227s (-0.8%)3.177s (~)0.950s101.08x
🌐 RedisNext.js (Turbopack)2.381s (-4.3%)3.012s (~)0.632s101.16x
🌐 StarterNext.js (Turbopack)2.466s (~)3.008s (~)0.543s101.20x
🐘 PostgresNext.js (Turbopack)2.466s (-7.1% 🟢)3.021s (~)0.555s101.20x
🐘 PostgresNitro2.619s (+11.8% 🔺)3.024s (~)0.406s101.27x
🐘 PostgresExpress2.817s (+3.4%)3.015s (~)0.197s101.37x
🌐 TursoNext.js (Turbopack)4.702s (-1.4%)5.183s (~)0.481s62.28x
🌐 MongoDBNext.js (Turbopack)4.765s (+1.3%)5.181s (~)0.416s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.745s (+26.2% 🔺)4.586s (+24.6% 🔺)0.842s71.00x
▲ VercelExpress3.795s (+17.8% 🔺)4.591s (+20.7% 🔺)0.796s71.01x
▲ VercelNext.js (Turbopack)4.534s (+41.7% 🔺)5.280s (+36.2% 🔺)0.747s61.21x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.103s (-29.4% 🟢)1.003s (~)0.017s (+3.1%)1.027s (~)0.924s101.00x
🌐 RedisNext.js (Turbopack)0.109s (-23.8% 🟢)1.005s (~)0.000s (NaN%)1.014s (~)0.905s101.05x
🌐 StarterNext.js (Turbopack)0.126s (-2.6%)1.006s (~)0.000s (NaN%)1.011s (~)0.885s101.22x
💻 LocalExpress0.174s (-1.0%)0.992s (~)0.015s (-6.3% 🟢)1.022s (~)0.847s101.68x
💻 LocalNitro0.178s (+1.3%)0.993s (~)0.019s (+18.9% 🔺)1.025s (~)0.848s101.72x
🌐 MongoDBNext.js (Turbopack)0.517s (+0.9%)0.930s (-0.6%)0.000s (+Infinity% 🔺)1.013s (~)0.495s105.00x
🌐 TursoNext.js (Turbopack)0.545s (+11.2% 🔺)0.910s (-5.3% 🟢)0.000s (+200.0% 🔺)1.016s (~)0.471s105.27x
🐘 PostgresNext.js (Turbopack)0.910s (-23.1% 🟢)0.755s (-55.8% 🟢)0.000s (+Infinity% 🔺)1.015s (-44.2% 🟢)0.105s108.80x
🐘 PostgresNitro2.226s (-1.9%)2.823s (+2.0%)0.000s (~)3.016s (~)0.790s1021.51x
🐘 PostgresExpress2.309s (~)2.735s (~)0.000s (-100.0% 🟢)3.016s (~)0.707s1022.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.731s (-8.1% 🟢)3.210s (-0.8%)0.409s (-42.8% 🟢)4.100s (-8.8% 🟢)1.368s101.00x
▲ VercelNitro2.733s (+3.3%)3.330s (+3.4%)0.483s (-27.9% 🟢)4.241s (-1.5%)1.507s101.00x
▲ VercelNext.js (Turbopack)3.089s (+17.4% 🔺)3.571s (+11.8% 🔺)0.484s (-15.7% 🟢)4.515s (+7.6% 🔺)1.425s101.13x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local6/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds109110120
Total118138351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run

Comment threadpackages/next/src/builder.ts Outdated
Comment threadpackages/next/src/loader.ts Outdated
Comment threadpackages/next/src/loader.ts
dirs: ['.'], // Different apps that use nitro have different directories
}),
buildTarget: 'next', // Placeholder, not actually used
buildTarget: 'nitro' as any, // Placeholder, not actually used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice

*/
// Re-export stdlib for discovery - needed because lazy discovery doesn't pick it up via eager scanning.
// The workflow builder injects this as a builtin module available in the workflow runtime sandbox.
export * from '../stdlib.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jc: does this mean things like DurableAgent and mux's external code won't work with lazy eval - when npm modules are distributed via npm?

@ijjkijjkDec 22, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Those will this one is just special since it's implicit not explicit/imported directly by the user.

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.

stdlib only contains fetch() which does need to be imported by the user. We got rid of the implicit fetch() hoisting a while ago.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah ya seems fine without it so must have only been needed from different issue early on in this PR.

#683

Comment threadpackages/builders/src/base-builder.ts
@ijjk

ijjk commented Dec 23, 2025

Copy link
Copy Markdown
MemberAuthor

@packages/next lists peerDependencies as "next": ">13". Any reason to believe that this is still accurate?

@VaguelySerious wrt^ this PR shouldn't be using any features that cause a Next.js semver requirement change but we should validate minimum supported version in follow-up as v13 does sound like a stretch and isn't maintained anymore.

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

Labels

None yet

Projects

None yet

5 participants

@ijjk@TooTallNate@pranaygp@Schniz@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Add lazy workflow and step discovery in Next.js by ijjk · Pull Request #640 · vercel/workflow · GitHub
Skip to content

Add lazy workflow and step discovery in Next.js - #640

Merged
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery
Dec 23, 2025
Merged

Add lazy workflow and step discovery in Next.js#640
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery

Conversation

@ijjk

@ijjkijjk commented Dec 17, 2025

Copy link
Copy Markdown
Member

This re-architects the integration with workflows and Next.js to no longer need to do a pass over all entry points to discover workflows/steps. Instead workflows/steps will be discovered as Next.js is processing files via the configured loader automatically. Then once the loader is done being called we compile the workflow bundles. This also removes the need to have separate custom dev watching for workflows and we can fully rely on Next.js for watching for changes instead.

closes: #523
closes: #469

@changeset-bot

changeset-botBot commented Dec 17, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 60eaeb3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
NameType
@workflow/buildersPatch
@workflow/nextPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.032s (-21.2% 🟢)1.015s (~)0.983s101.00x
🌐 RedisNext.js (Turbopack)0.034s (-17.5% 🟢)1.018s (~)0.983s101.07x
🌐 StarterNext.js (Turbopack)0.040s (+3.4%)1.014s (~)0.974s101.24x
💻 LocalNitro0.042s (-1.0%)1.006s (~)0.965s101.30x
💻 LocalExpress0.044s (+1.6%)1.007s (~)0.964s101.37x
🌐 TursoNext.js (Turbopack)0.109s (+9.8% 🔺)1.013s (~)0.904s103.41x
🌐 MongoDBNext.js (Turbopack)0.117s (+58.8% 🔺)1.015s (~)0.898s103.66x
🐘 PostgresNitro0.269s (-10.7% 🟢)1.022s (+1.0%)0.753s108.41x
🐘 PostgresExpress0.318s (~)1.016s (~)0.698s109.95x
🐘 PostgresNext.js (Turbopack)0.365s (+123.7% 🔺)1.019s (~)0.654s1011.40x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.537s (+2.0%)1.639s (-17.3% 🟢)1.101s101.00x
▲ VercelExpress0.564s (-7.8% 🟢)1.545s (+5.8% 🔺)0.982s101.05x
▲ VercelNext.js (Turbopack)0.567s (-10.6% 🟢)1.570s (-0.9%)1.004s101.05x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.071s (-2.0%)2.011s (~)0.940s101.00x
🌐 RedisNext.js (Turbopack)1.077s (-1.4%)2.015s (~)0.937s101.01x
🌐 StarterNext.js (Turbopack)1.091s (~)2.009s (~)0.917s101.02x
💻 LocalNitro1.112s (~)2.006s (~)0.894s101.04x
💻 LocalExpress1.113s (~)2.007s (~)0.895s101.04x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.012s (~)0.710s101.21x
🌐 TursoNext.js (Turbopack)1.315s (+0.9%)2.012s (~)0.697s101.23x
🐘 PostgresNext.js (Turbopack)1.649s (-14.1% 🟢)2.016s (~)0.367s101.54x
🐘 PostgresExpress2.155s (~)3.016s (~)0.860s102.01x
🐘 PostgresNitro2.232s (+4.2%)3.015s (~)0.782s102.08x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.542s (-7.0% 🟢)3.702s (~)1.160s101.00x
▲ VercelNext.js (Turbopack)2.554s (-5.0%)3.634s (-1.8%)1.080s101.00x
▲ VercelExpress2.659s (~)3.624s (+2.2%)0.965s101.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.535s (-1.1%)11.016s (~)0.481s51.00x
🌐 RedisNext.js (Turbopack)10.580s (-0.9%)11.022s (~)0.442s51.00x
🌐 StarterNext.js (Turbopack)10.587s (~)11.010s (~)0.424s51.00x
💻 LocalExpress10.785s (~)11.013s (~)0.228s51.02x
💻 LocalNitro10.791s (~)11.013s (~)0.223s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.022s (~)0.838s51.16x
🌐 MongoDBNext.js (Turbopack)12.193s (~)13.021s (~)0.828s51.16x
🐘 PostgresNext.js (Turbopack)14.811s (-2.7%)15.441s (-3.7%)0.630s51.41x
🐘 PostgresNitro20.431s (~)21.037s (+0.9%)0.606s51.94x
🐘 PostgresExpress20.501s (~)21.032s (~)0.531s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro21.385s (-0.9%)22.047s (-1.7%)0.662s51.00x
▲ VercelExpress21.546s (~)22.397s (~)0.851s51.01x
▲ VercelNext.js (Turbopack)21.606s (-0.9%)22.346s (-0.9%)0.740s51.01x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.313s (-3.3%)2.011s (~)0.699s151.00x
💻 LocalNext.js (Turbopack)1.328s (-4.8%)2.012s (~)0.683s151.01x
🌐 StarterNext.js (Turbopack)1.343s (~)2.007s (~)0.664s151.02x
💻 LocalExpress1.403s (-0.6%)2.006s (~)0.603s151.07x
💻 LocalNitro1.415s (~)2.006s (~)0.591s151.08x
🐘 PostgresNext.js (Turbopack)1.869s (+1.3%)2.015s (-2.5%)0.146s151.42x
🌐 MongoDBNext.js (Turbopack)2.155s (+1.3%)3.013s (~)0.858s101.64x
🌐 TursoNext.js (Turbopack)2.176s (-0.8%)3.017s (~)0.841s101.66x
🐘 PostgresNitro2.338s (-0.6%)3.017s (~)0.679s101.78x
🐘 PostgresExpress2.396s (~)3.013s (~)0.616s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.719s (-0.6%)3.815s (+8.5% 🔺)1.096s81.00x
▲ VercelNitro2.740s (+1.0%)3.806s (~)1.066s81.01x
▲ VercelNext.js (Turbopack)2.935s (-3.8%)3.782s (-4.9%)0.847s81.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.014s (-6.9% 🟢)2.421s (-22.3% 🟢)0.407s131.00x
💻 LocalExpress2.165s (-2.0%)3.131s (-0.8%)0.966s101.07x
💻 LocalNitro2.176s (-2.1%)3.151s (~)0.975s101.08x
🌐 RedisNext.js (Turbopack)2.367s (-5.0% 🟢)3.012s (~)0.645s101.17x
🌐 StarterNext.js (Turbopack)2.446s (~)3.009s (~)0.563s101.21x
🐘 PostgresNext.js (Turbopack)2.576s (-2.2%)3.021s (~)0.444s101.28x
🐘 PostgresExpress2.978s (+2.0%)3.470s (+7.2% 🔺)0.492s91.48x
🐘 PostgresNitro3.048s (+14.8% 🔺)3.582s (+18.3% 🔺)0.534s91.51x
🌐 MongoDBNext.js (Turbopack)4.656s (-2.4%)5.186s (~)0.530s62.31x
🌐 TursoNext.js (Turbopack)4.661s (~)5.181s (~)0.520s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.716s (+16.9% 🔺)4.584s (+20.1% 🔺)0.868s71.00x
▲ VercelExpress3.754s (+23.3% 🔺)4.516s (+22.6% 🔺)0.761s71.01x
▲ VercelNitro3.912s (+25.9% 🔺)4.473s (+16.7% 🔺)0.560s71.05x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.325s (-4.5%)2.011s (~)0.686s151.00x
🌐 StarterNext.js (Turbopack)1.331s (-3.0%)2.007s (~)0.676s151.00x
💻 LocalNext.js (Turbopack)1.351s (-3.4%)2.015s (~)0.664s151.02x
💻 LocalNitro1.409s (-1.7%)2.005s (~)0.596s151.06x
💻 LocalExpress1.410s (~)2.006s (~)0.596s151.06x
🐘 PostgresNext.js (Turbopack)1.671s (+2.6%)2.013s (~)0.343s151.26x
🐘 PostgresNitro1.850s (-1.3%)2.011s (~)0.161s151.40x
🐘 PostgresExpress1.908s (+8.0% 🔺)2.077s (+3.3%)0.170s151.44x
🌐 MongoDBNext.js (Turbopack)2.140s (+1.0%)3.011s (~)0.871s101.62x
🌐 TursoNext.js (Turbopack)2.180s (-1.7%)3.013s (~)0.832s101.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.566s (-4.0%)3.664s (-2.9%)1.098s91.00x
▲ VercelExpress2.668s (-1.5%)3.665s (+4.5%)0.997s91.04x
▲ VercelNext.js (Turbopack)2.712s (+1.9%)3.655s (~)0.943s91.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.060s (-10.2% 🟢)2.918s (-10.1% 🟢)0.858s111.00x
💻 LocalNitro2.214s (-7.4% 🟢)3.157s (-5.2% 🟢)0.943s101.07x
💻 LocalExpress2.227s (-0.8%)3.177s (~)0.950s101.08x
🌐 RedisNext.js (Turbopack)2.381s (-4.3%)3.012s (~)0.632s101.16x
🌐 StarterNext.js (Turbopack)2.466s (~)3.008s (~)0.543s101.20x
🐘 PostgresNext.js (Turbopack)2.466s (-7.1% 🟢)3.021s (~)0.555s101.20x
🐘 PostgresNitro2.619s (+11.8% 🔺)3.024s (~)0.406s101.27x
🐘 PostgresExpress2.817s (+3.4%)3.015s (~)0.197s101.37x
🌐 TursoNext.js (Turbopack)4.702s (-1.4%)5.183s (~)0.481s62.28x
🌐 MongoDBNext.js (Turbopack)4.765s (+1.3%)5.181s (~)0.416s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.745s (+26.2% 🔺)4.586s (+24.6% 🔺)0.842s71.00x
▲ VercelExpress3.795s (+17.8% 🔺)4.591s (+20.7% 🔺)0.796s71.01x
▲ VercelNext.js (Turbopack)4.534s (+41.7% 🔺)5.280s (+36.2% 🔺)0.747s61.21x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.103s (-29.4% 🟢)1.003s (~)0.017s (+3.1%)1.027s (~)0.924s101.00x
🌐 RedisNext.js (Turbopack)0.109s (-23.8% 🟢)1.005s (~)0.000s (NaN%)1.014s (~)0.905s101.05x
🌐 StarterNext.js (Turbopack)0.126s (-2.6%)1.006s (~)0.000s (NaN%)1.011s (~)0.885s101.22x
💻 LocalExpress0.174s (-1.0%)0.992s (~)0.015s (-6.3% 🟢)1.022s (~)0.847s101.68x
💻 LocalNitro0.178s (+1.3%)0.993s (~)0.019s (+18.9% 🔺)1.025s (~)0.848s101.72x
🌐 MongoDBNext.js (Turbopack)0.517s (+0.9%)0.930s (-0.6%)0.000s (+Infinity% 🔺)1.013s (~)0.495s105.00x
🌐 TursoNext.js (Turbopack)0.545s (+11.2% 🔺)0.910s (-5.3% 🟢)0.000s (+200.0% 🔺)1.016s (~)0.471s105.27x
🐘 PostgresNext.js (Turbopack)0.910s (-23.1% 🟢)0.755s (-55.8% 🟢)0.000s (+Infinity% 🔺)1.015s (-44.2% 🟢)0.105s108.80x
🐘 PostgresNitro2.226s (-1.9%)2.823s (+2.0%)0.000s (~)3.016s (~)0.790s1021.51x
🐘 PostgresExpress2.309s (~)2.735s (~)0.000s (-100.0% 🟢)3.016s (~)0.707s1022.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.731s (-8.1% 🟢)3.210s (-0.8%)0.409s (-42.8% 🟢)4.100s (-8.8% 🟢)1.368s101.00x
▲ VercelNitro2.733s (+3.3%)3.330s (+3.4%)0.483s (-27.9% 🟢)4.241s (-1.5%)1.507s101.00x
▲ VercelNext.js (Turbopack)3.089s (+17.4% 🔺)3.571s (+11.8% 🔺)0.484s (-15.7% 🟢)4.515s (+7.6% 🔺)1.425s101.13x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local6/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds109110120
Total118138351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run

Comment threadpackages/next/src/builder.ts Outdated
Comment threadpackages/next/src/loader.ts Outdated
Comment threadpackages/next/src/loader.ts
dirs: ['.'], // Different apps that use nitro have different directories
}),
buildTarget: 'next', // Placeholder, not actually used
buildTarget: 'nitro' as any, // Placeholder, not actually used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice

*/
// Re-export stdlib for discovery - needed because lazy discovery doesn't pick it up via eager scanning.
// The workflow builder injects this as a builtin module available in the workflow runtime sandbox.
export * from '../stdlib.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jc: does this mean things like DurableAgent and mux's external code won't work with lazy eval - when npm modules are distributed via npm?

@ijjkijjkDec 22, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Those will this one is just special since it's implicit not explicit/imported directly by the user.

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.

stdlib only contains fetch() which does need to be imported by the user. We got rid of the implicit fetch() hoisting a while ago.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah ya seems fine without it so must have only been needed from different issue early on in this PR.

#683

Comment threadpackages/builders/src/base-builder.ts
@ijjk

ijjk commented Dec 23, 2025

Copy link
Copy Markdown
MemberAuthor

@packages/next lists peerDependencies as "next": ">13". Any reason to believe that this is still accurate?

@VaguelySerious wrt^ this PR shouldn't be using any features that cause a Next.js semver requirement change but we should validate minimum supported version in follow-up as v13 does sound like a stretch and isn't maintained anymore.

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

Labels

None yet

Projects

None yet

5 participants

@ijjk@TooTallNate@pranaygp@Schniz@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add lazy workflow and step discovery in Next.js by ijjk · Pull Request #640 · vercel/workflow · GitHub
Skip to content

Add lazy workflow and step discovery in Next.js - #640

Merged
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery
Dec 23, 2025
Merged

Add lazy workflow and step discovery in Next.js#640
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery

Conversation

@ijjk

@ijjkijjk commented Dec 17, 2025

Copy link
Copy Markdown
Member

This re-architects the integration with workflows and Next.js to no longer need to do a pass over all entry points to discover workflows/steps. Instead workflows/steps will be discovered as Next.js is processing files via the configured loader automatically. Then once the loader is done being called we compile the workflow bundles. This also removes the need to have separate custom dev watching for workflows and we can fully rely on Next.js for watching for changes instead.

closes: #523
closes: #469

@changeset-bot

changeset-botBot commented Dec 17, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 60eaeb3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
NameType
@workflow/buildersPatch
@workflow/nextPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.032s (-21.2% 🟢)1.015s (~)0.983s101.00x
🌐 RedisNext.js (Turbopack)0.034s (-17.5% 🟢)1.018s (~)0.983s101.07x
🌐 StarterNext.js (Turbopack)0.040s (+3.4%)1.014s (~)0.974s101.24x
💻 LocalNitro0.042s (-1.0%)1.006s (~)0.965s101.30x
💻 LocalExpress0.044s (+1.6%)1.007s (~)0.964s101.37x
🌐 TursoNext.js (Turbopack)0.109s (+9.8% 🔺)1.013s (~)0.904s103.41x
🌐 MongoDBNext.js (Turbopack)0.117s (+58.8% 🔺)1.015s (~)0.898s103.66x
🐘 PostgresNitro0.269s (-10.7% 🟢)1.022s (+1.0%)0.753s108.41x
🐘 PostgresExpress0.318s (~)1.016s (~)0.698s109.95x
🐘 PostgresNext.js (Turbopack)0.365s (+123.7% 🔺)1.019s (~)0.654s1011.40x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.537s (+2.0%)1.639s (-17.3% 🟢)1.101s101.00x
▲ VercelExpress0.564s (-7.8% 🟢)1.545s (+5.8% 🔺)0.982s101.05x
▲ VercelNext.js (Turbopack)0.567s (-10.6% 🟢)1.570s (-0.9%)1.004s101.05x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.071s (-2.0%)2.011s (~)0.940s101.00x
🌐 RedisNext.js (Turbopack)1.077s (-1.4%)2.015s (~)0.937s101.01x
🌐 StarterNext.js (Turbopack)1.091s (~)2.009s (~)0.917s101.02x
💻 LocalNitro1.112s (~)2.006s (~)0.894s101.04x
💻 LocalExpress1.113s (~)2.007s (~)0.895s101.04x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.012s (~)0.710s101.21x
🌐 TursoNext.js (Turbopack)1.315s (+0.9%)2.012s (~)0.697s101.23x
🐘 PostgresNext.js (Turbopack)1.649s (-14.1% 🟢)2.016s (~)0.367s101.54x
🐘 PostgresExpress2.155s (~)3.016s (~)0.860s102.01x
🐘 PostgresNitro2.232s (+4.2%)3.015s (~)0.782s102.08x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.542s (-7.0% 🟢)3.702s (~)1.160s101.00x
▲ VercelNext.js (Turbopack)2.554s (-5.0%)3.634s (-1.8%)1.080s101.00x
▲ VercelExpress2.659s (~)3.624s (+2.2%)0.965s101.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.535s (-1.1%)11.016s (~)0.481s51.00x
🌐 RedisNext.js (Turbopack)10.580s (-0.9%)11.022s (~)0.442s51.00x
🌐 StarterNext.js (Turbopack)10.587s (~)11.010s (~)0.424s51.00x
💻 LocalExpress10.785s (~)11.013s (~)0.228s51.02x
💻 LocalNitro10.791s (~)11.013s (~)0.223s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.022s (~)0.838s51.16x
🌐 MongoDBNext.js (Turbopack)12.193s (~)13.021s (~)0.828s51.16x
🐘 PostgresNext.js (Turbopack)14.811s (-2.7%)15.441s (-3.7%)0.630s51.41x
🐘 PostgresNitro20.431s (~)21.037s (+0.9%)0.606s51.94x
🐘 PostgresExpress20.501s (~)21.032s (~)0.531s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro21.385s (-0.9%)22.047s (-1.7%)0.662s51.00x
▲ VercelExpress21.546s (~)22.397s (~)0.851s51.01x
▲ VercelNext.js (Turbopack)21.606s (-0.9%)22.346s (-0.9%)0.740s51.01x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.313s (-3.3%)2.011s (~)0.699s151.00x
💻 LocalNext.js (Turbopack)1.328s (-4.8%)2.012s (~)0.683s151.01x
🌐 StarterNext.js (Turbopack)1.343s (~)2.007s (~)0.664s151.02x
💻 LocalExpress1.403s (-0.6%)2.006s (~)0.603s151.07x
💻 LocalNitro1.415s (~)2.006s (~)0.591s151.08x
🐘 PostgresNext.js (Turbopack)1.869s (+1.3%)2.015s (-2.5%)0.146s151.42x
🌐 MongoDBNext.js (Turbopack)2.155s (+1.3%)3.013s (~)0.858s101.64x
🌐 TursoNext.js (Turbopack)2.176s (-0.8%)3.017s (~)0.841s101.66x
🐘 PostgresNitro2.338s (-0.6%)3.017s (~)0.679s101.78x
🐘 PostgresExpress2.396s (~)3.013s (~)0.616s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.719s (-0.6%)3.815s (+8.5% 🔺)1.096s81.00x
▲ VercelNitro2.740s (+1.0%)3.806s (~)1.066s81.01x
▲ VercelNext.js (Turbopack)2.935s (-3.8%)3.782s (-4.9%)0.847s81.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.014s (-6.9% 🟢)2.421s (-22.3% 🟢)0.407s131.00x
💻 LocalExpress2.165s (-2.0%)3.131s (-0.8%)0.966s101.07x
💻 LocalNitro2.176s (-2.1%)3.151s (~)0.975s101.08x
🌐 RedisNext.js (Turbopack)2.367s (-5.0% 🟢)3.012s (~)0.645s101.17x
🌐 StarterNext.js (Turbopack)2.446s (~)3.009s (~)0.563s101.21x
🐘 PostgresNext.js (Turbopack)2.576s (-2.2%)3.021s (~)0.444s101.28x
🐘 PostgresExpress2.978s (+2.0%)3.470s (+7.2% 🔺)0.492s91.48x
🐘 PostgresNitro3.048s (+14.8% 🔺)3.582s (+18.3% 🔺)0.534s91.51x
🌐 MongoDBNext.js (Turbopack)4.656s (-2.4%)5.186s (~)0.530s62.31x
🌐 TursoNext.js (Turbopack)4.661s (~)5.181s (~)0.520s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.716s (+16.9% 🔺)4.584s (+20.1% 🔺)0.868s71.00x
▲ VercelExpress3.754s (+23.3% 🔺)4.516s (+22.6% 🔺)0.761s71.01x
▲ VercelNitro3.912s (+25.9% 🔺)4.473s (+16.7% 🔺)0.560s71.05x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.325s (-4.5%)2.011s (~)0.686s151.00x
🌐 StarterNext.js (Turbopack)1.331s (-3.0%)2.007s (~)0.676s151.00x
💻 LocalNext.js (Turbopack)1.351s (-3.4%)2.015s (~)0.664s151.02x
💻 LocalNitro1.409s (-1.7%)2.005s (~)0.596s151.06x
💻 LocalExpress1.410s (~)2.006s (~)0.596s151.06x
🐘 PostgresNext.js (Turbopack)1.671s (+2.6%)2.013s (~)0.343s151.26x
🐘 PostgresNitro1.850s (-1.3%)2.011s (~)0.161s151.40x
🐘 PostgresExpress1.908s (+8.0% 🔺)2.077s (+3.3%)0.170s151.44x
🌐 MongoDBNext.js (Turbopack)2.140s (+1.0%)3.011s (~)0.871s101.62x
🌐 TursoNext.js (Turbopack)2.180s (-1.7%)3.013s (~)0.832s101.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.566s (-4.0%)3.664s (-2.9%)1.098s91.00x
▲ VercelExpress2.668s (-1.5%)3.665s (+4.5%)0.997s91.04x
▲ VercelNext.js (Turbopack)2.712s (+1.9%)3.655s (~)0.943s91.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.060s (-10.2% 🟢)2.918s (-10.1% 🟢)0.858s111.00x
💻 LocalNitro2.214s (-7.4% 🟢)3.157s (-5.2% 🟢)0.943s101.07x
💻 LocalExpress2.227s (-0.8%)3.177s (~)0.950s101.08x
🌐 RedisNext.js (Turbopack)2.381s (-4.3%)3.012s (~)0.632s101.16x
🌐 StarterNext.js (Turbopack)2.466s (~)3.008s (~)0.543s101.20x
🐘 PostgresNext.js (Turbopack)2.466s (-7.1% 🟢)3.021s (~)0.555s101.20x
🐘 PostgresNitro2.619s (+11.8% 🔺)3.024s (~)0.406s101.27x
🐘 PostgresExpress2.817s (+3.4%)3.015s (~)0.197s101.37x
🌐 TursoNext.js (Turbopack)4.702s (-1.4%)5.183s (~)0.481s62.28x
🌐 MongoDBNext.js (Turbopack)4.765s (+1.3%)5.181s (~)0.416s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.745s (+26.2% 🔺)4.586s (+24.6% 🔺)0.842s71.00x
▲ VercelExpress3.795s (+17.8% 🔺)4.591s (+20.7% 🔺)0.796s71.01x
▲ VercelNext.js (Turbopack)4.534s (+41.7% 🔺)5.280s (+36.2% 🔺)0.747s61.21x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.103s (-29.4% 🟢)1.003s (~)0.017s (+3.1%)1.027s (~)0.924s101.00x
🌐 RedisNext.js (Turbopack)0.109s (-23.8% 🟢)1.005s (~)0.000s (NaN%)1.014s (~)0.905s101.05x
🌐 StarterNext.js (Turbopack)0.126s (-2.6%)1.006s (~)0.000s (NaN%)1.011s (~)0.885s101.22x
💻 LocalExpress0.174s (-1.0%)0.992s (~)0.015s (-6.3% 🟢)1.022s (~)0.847s101.68x
💻 LocalNitro0.178s (+1.3%)0.993s (~)0.019s (+18.9% 🔺)1.025s (~)0.848s101.72x
🌐 MongoDBNext.js (Turbopack)0.517s (+0.9%)0.930s (-0.6%)0.000s (+Infinity% 🔺)1.013s (~)0.495s105.00x
🌐 TursoNext.js (Turbopack)0.545s (+11.2% 🔺)0.910s (-5.3% 🟢)0.000s (+200.0% 🔺)1.016s (~)0.471s105.27x
🐘 PostgresNext.js (Turbopack)0.910s (-23.1% 🟢)0.755s (-55.8% 🟢)0.000s (+Infinity% 🔺)1.015s (-44.2% 🟢)0.105s108.80x
🐘 PostgresNitro2.226s (-1.9%)2.823s (+2.0%)0.000s (~)3.016s (~)0.790s1021.51x
🐘 PostgresExpress2.309s (~)2.735s (~)0.000s (-100.0% 🟢)3.016s (~)0.707s1022.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.731s (-8.1% 🟢)3.210s (-0.8%)0.409s (-42.8% 🟢)4.100s (-8.8% 🟢)1.368s101.00x
▲ VercelNitro2.733s (+3.3%)3.330s (+3.4%)0.483s (-27.9% 🟢)4.241s (-1.5%)1.507s101.00x
▲ VercelNext.js (Turbopack)3.089s (+17.4% 🔺)3.571s (+11.8% 🔺)0.484s (-15.7% 🟢)4.515s (+7.6% 🔺)1.425s101.13x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local6/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds109110120
Total118138351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run

Comment threadpackages/next/src/builder.ts Outdated
Comment threadpackages/next/src/loader.ts Outdated
Comment threadpackages/next/src/loader.ts
dirs: ['.'], // Different apps that use nitro have different directories
}),
buildTarget: 'next', // Placeholder, not actually used
buildTarget: 'nitro' as any, // Placeholder, not actually used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice

*/
// Re-export stdlib for discovery - needed because lazy discovery doesn't pick it up via eager scanning.
// The workflow builder injects this as a builtin module available in the workflow runtime sandbox.
export * from '../stdlib.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jc: does this mean things like DurableAgent and mux's external code won't work with lazy eval - when npm modules are distributed via npm?

@ijjkijjkDec 22, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Those will this one is just special since it's implicit not explicit/imported directly by the user.

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.

stdlib only contains fetch() which does need to be imported by the user. We got rid of the implicit fetch() hoisting a while ago.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah ya seems fine without it so must have only been needed from different issue early on in this PR.

#683

Comment threadpackages/builders/src/base-builder.ts
@ijjk

ijjk commented Dec 23, 2025

Copy link
Copy Markdown
MemberAuthor

@packages/next lists peerDependencies as "next": ">13". Any reason to believe that this is still accurate?

@VaguelySerious wrt^ this PR shouldn't be using any features that cause a Next.js semver requirement change but we should validate minimum supported version in follow-up as v13 does sound like a stretch and isn't maintained anymore.

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

Labels

None yet

Projects

None yet

5 participants

@ijjk@TooTallNate@pranaygp@Schniz@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Add lazy workflow and step discovery in Next.js by ijjk · Pull Request #640 · vercel/workflow · GitHub
Skip to content

Add lazy workflow and step discovery in Next.js - #640

Merged
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery
Dec 23, 2025
Merged

Add lazy workflow and step discovery in Next.js#640
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery

Conversation

@ijjk

@ijjkijjk commented Dec 17, 2025

Copy link
Copy Markdown
Member

This re-architects the integration with workflows and Next.js to no longer need to do a pass over all entry points to discover workflows/steps. Instead workflows/steps will be discovered as Next.js is processing files via the configured loader automatically. Then once the loader is done being called we compile the workflow bundles. This also removes the need to have separate custom dev watching for workflows and we can fully rely on Next.js for watching for changes instead.

closes: #523
closes: #469

@changeset-bot

changeset-botBot commented Dec 17, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 60eaeb3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
NameType
@workflow/buildersPatch
@workflow/nextPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.032s (-21.2% 🟢)1.015s (~)0.983s101.00x
🌐 RedisNext.js (Turbopack)0.034s (-17.5% 🟢)1.018s (~)0.983s101.07x
🌐 StarterNext.js (Turbopack)0.040s (+3.4%)1.014s (~)0.974s101.24x
💻 LocalNitro0.042s (-1.0%)1.006s (~)0.965s101.30x
💻 LocalExpress0.044s (+1.6%)1.007s (~)0.964s101.37x
🌐 TursoNext.js (Turbopack)0.109s (+9.8% 🔺)1.013s (~)0.904s103.41x
🌐 MongoDBNext.js (Turbopack)0.117s (+58.8% 🔺)1.015s (~)0.898s103.66x
🐘 PostgresNitro0.269s (-10.7% 🟢)1.022s (+1.0%)0.753s108.41x
🐘 PostgresExpress0.318s (~)1.016s (~)0.698s109.95x
🐘 PostgresNext.js (Turbopack)0.365s (+123.7% 🔺)1.019s (~)0.654s1011.40x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.537s (+2.0%)1.639s (-17.3% 🟢)1.101s101.00x
▲ VercelExpress0.564s (-7.8% 🟢)1.545s (+5.8% 🔺)0.982s101.05x
▲ VercelNext.js (Turbopack)0.567s (-10.6% 🟢)1.570s (-0.9%)1.004s101.05x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.071s (-2.0%)2.011s (~)0.940s101.00x
🌐 RedisNext.js (Turbopack)1.077s (-1.4%)2.015s (~)0.937s101.01x
🌐 StarterNext.js (Turbopack)1.091s (~)2.009s (~)0.917s101.02x
💻 LocalNitro1.112s (~)2.006s (~)0.894s101.04x
💻 LocalExpress1.113s (~)2.007s (~)0.895s101.04x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.012s (~)0.710s101.21x
🌐 TursoNext.js (Turbopack)1.315s (+0.9%)2.012s (~)0.697s101.23x
🐘 PostgresNext.js (Turbopack)1.649s (-14.1% 🟢)2.016s (~)0.367s101.54x
🐘 PostgresExpress2.155s (~)3.016s (~)0.860s102.01x
🐘 PostgresNitro2.232s (+4.2%)3.015s (~)0.782s102.08x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.542s (-7.0% 🟢)3.702s (~)1.160s101.00x
▲ VercelNext.js (Turbopack)2.554s (-5.0%)3.634s (-1.8%)1.080s101.00x
▲ VercelExpress2.659s (~)3.624s (+2.2%)0.965s101.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.535s (-1.1%)11.016s (~)0.481s51.00x
🌐 RedisNext.js (Turbopack)10.580s (-0.9%)11.022s (~)0.442s51.00x
🌐 StarterNext.js (Turbopack)10.587s (~)11.010s (~)0.424s51.00x
💻 LocalExpress10.785s (~)11.013s (~)0.228s51.02x
💻 LocalNitro10.791s (~)11.013s (~)0.223s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.022s (~)0.838s51.16x
🌐 MongoDBNext.js (Turbopack)12.193s (~)13.021s (~)0.828s51.16x
🐘 PostgresNext.js (Turbopack)14.811s (-2.7%)15.441s (-3.7%)0.630s51.41x
🐘 PostgresNitro20.431s (~)21.037s (+0.9%)0.606s51.94x
🐘 PostgresExpress20.501s (~)21.032s (~)0.531s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro21.385s (-0.9%)22.047s (-1.7%)0.662s51.00x
▲ VercelExpress21.546s (~)22.397s (~)0.851s51.01x
▲ VercelNext.js (Turbopack)21.606s (-0.9%)22.346s (-0.9%)0.740s51.01x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.313s (-3.3%)2.011s (~)0.699s151.00x
💻 LocalNext.js (Turbopack)1.328s (-4.8%)2.012s (~)0.683s151.01x
🌐 StarterNext.js (Turbopack)1.343s (~)2.007s (~)0.664s151.02x
💻 LocalExpress1.403s (-0.6%)2.006s (~)0.603s151.07x
💻 LocalNitro1.415s (~)2.006s (~)0.591s151.08x
🐘 PostgresNext.js (Turbopack)1.869s (+1.3%)2.015s (-2.5%)0.146s151.42x
🌐 MongoDBNext.js (Turbopack)2.155s (+1.3%)3.013s (~)0.858s101.64x
🌐 TursoNext.js (Turbopack)2.176s (-0.8%)3.017s (~)0.841s101.66x
🐘 PostgresNitro2.338s (-0.6%)3.017s (~)0.679s101.78x
🐘 PostgresExpress2.396s (~)3.013s (~)0.616s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.719s (-0.6%)3.815s (+8.5% 🔺)1.096s81.00x
▲ VercelNitro2.740s (+1.0%)3.806s (~)1.066s81.01x
▲ VercelNext.js (Turbopack)2.935s (-3.8%)3.782s (-4.9%)0.847s81.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.014s (-6.9% 🟢)2.421s (-22.3% 🟢)0.407s131.00x
💻 LocalExpress2.165s (-2.0%)3.131s (-0.8%)0.966s101.07x
💻 LocalNitro2.176s (-2.1%)3.151s (~)0.975s101.08x
🌐 RedisNext.js (Turbopack)2.367s (-5.0% 🟢)3.012s (~)0.645s101.17x
🌐 StarterNext.js (Turbopack)2.446s (~)3.009s (~)0.563s101.21x
🐘 PostgresNext.js (Turbopack)2.576s (-2.2%)3.021s (~)0.444s101.28x
🐘 PostgresExpress2.978s (+2.0%)3.470s (+7.2% 🔺)0.492s91.48x
🐘 PostgresNitro3.048s (+14.8% 🔺)3.582s (+18.3% 🔺)0.534s91.51x
🌐 MongoDBNext.js (Turbopack)4.656s (-2.4%)5.186s (~)0.530s62.31x
🌐 TursoNext.js (Turbopack)4.661s (~)5.181s (~)0.520s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.716s (+16.9% 🔺)4.584s (+20.1% 🔺)0.868s71.00x
▲ VercelExpress3.754s (+23.3% 🔺)4.516s (+22.6% 🔺)0.761s71.01x
▲ VercelNitro3.912s (+25.9% 🔺)4.473s (+16.7% 🔺)0.560s71.05x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.325s (-4.5%)2.011s (~)0.686s151.00x
🌐 StarterNext.js (Turbopack)1.331s (-3.0%)2.007s (~)0.676s151.00x
💻 LocalNext.js (Turbopack)1.351s (-3.4%)2.015s (~)0.664s151.02x
💻 LocalNitro1.409s (-1.7%)2.005s (~)0.596s151.06x
💻 LocalExpress1.410s (~)2.006s (~)0.596s151.06x
🐘 PostgresNext.js (Turbopack)1.671s (+2.6%)2.013s (~)0.343s151.26x
🐘 PostgresNitro1.850s (-1.3%)2.011s (~)0.161s151.40x
🐘 PostgresExpress1.908s (+8.0% 🔺)2.077s (+3.3%)0.170s151.44x
🌐 MongoDBNext.js (Turbopack)2.140s (+1.0%)3.011s (~)0.871s101.62x
🌐 TursoNext.js (Turbopack)2.180s (-1.7%)3.013s (~)0.832s101.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.566s (-4.0%)3.664s (-2.9%)1.098s91.00x
▲ VercelExpress2.668s (-1.5%)3.665s (+4.5%)0.997s91.04x
▲ VercelNext.js (Turbopack)2.712s (+1.9%)3.655s (~)0.943s91.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.060s (-10.2% 🟢)2.918s (-10.1% 🟢)0.858s111.00x
💻 LocalNitro2.214s (-7.4% 🟢)3.157s (-5.2% 🟢)0.943s101.07x
💻 LocalExpress2.227s (-0.8%)3.177s (~)0.950s101.08x
🌐 RedisNext.js (Turbopack)2.381s (-4.3%)3.012s (~)0.632s101.16x
🌐 StarterNext.js (Turbopack)2.466s (~)3.008s (~)0.543s101.20x
🐘 PostgresNext.js (Turbopack)2.466s (-7.1% 🟢)3.021s (~)0.555s101.20x
🐘 PostgresNitro2.619s (+11.8% 🔺)3.024s (~)0.406s101.27x
🐘 PostgresExpress2.817s (+3.4%)3.015s (~)0.197s101.37x
🌐 TursoNext.js (Turbopack)4.702s (-1.4%)5.183s (~)0.481s62.28x
🌐 MongoDBNext.js (Turbopack)4.765s (+1.3%)5.181s (~)0.416s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.745s (+26.2% 🔺)4.586s (+24.6% 🔺)0.842s71.00x
▲ VercelExpress3.795s (+17.8% 🔺)4.591s (+20.7% 🔺)0.796s71.01x
▲ VercelNext.js (Turbopack)4.534s (+41.7% 🔺)5.280s (+36.2% 🔺)0.747s61.21x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.103s (-29.4% 🟢)1.003s (~)0.017s (+3.1%)1.027s (~)0.924s101.00x
🌐 RedisNext.js (Turbopack)0.109s (-23.8% 🟢)1.005s (~)0.000s (NaN%)1.014s (~)0.905s101.05x
🌐 StarterNext.js (Turbopack)0.126s (-2.6%)1.006s (~)0.000s (NaN%)1.011s (~)0.885s101.22x
💻 LocalExpress0.174s (-1.0%)0.992s (~)0.015s (-6.3% 🟢)1.022s (~)0.847s101.68x
💻 LocalNitro0.178s (+1.3%)0.993s (~)0.019s (+18.9% 🔺)1.025s (~)0.848s101.72x
🌐 MongoDBNext.js (Turbopack)0.517s (+0.9%)0.930s (-0.6%)0.000s (+Infinity% 🔺)1.013s (~)0.495s105.00x
🌐 TursoNext.js (Turbopack)0.545s (+11.2% 🔺)0.910s (-5.3% 🟢)0.000s (+200.0% 🔺)1.016s (~)0.471s105.27x
🐘 PostgresNext.js (Turbopack)0.910s (-23.1% 🟢)0.755s (-55.8% 🟢)0.000s (+Infinity% 🔺)1.015s (-44.2% 🟢)0.105s108.80x
🐘 PostgresNitro2.226s (-1.9%)2.823s (+2.0%)0.000s (~)3.016s (~)0.790s1021.51x
🐘 PostgresExpress2.309s (~)2.735s (~)0.000s (-100.0% 🟢)3.016s (~)0.707s1022.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.731s (-8.1% 🟢)3.210s (-0.8%)0.409s (-42.8% 🟢)4.100s (-8.8% 🟢)1.368s101.00x
▲ VercelNitro2.733s (+3.3%)3.330s (+3.4%)0.483s (-27.9% 🟢)4.241s (-1.5%)1.507s101.00x
▲ VercelNext.js (Turbopack)3.089s (+17.4% 🔺)3.571s (+11.8% 🔺)0.484s (-15.7% 🟢)4.515s (+7.6% 🔺)1.425s101.13x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local6/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds109110120
Total118138351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run

Comment threadpackages/next/src/builder.ts Outdated
Comment threadpackages/next/src/loader.ts Outdated
Comment threadpackages/next/src/loader.ts
dirs: ['.'], // Different apps that use nitro have different directories
}),
buildTarget: 'next', // Placeholder, not actually used
buildTarget: 'nitro' as any, // Placeholder, not actually used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice

*/
// Re-export stdlib for discovery - needed because lazy discovery doesn't pick it up via eager scanning.
// The workflow builder injects this as a builtin module available in the workflow runtime sandbox.
export * from '../stdlib.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jc: does this mean things like DurableAgent and mux's external code won't work with lazy eval - when npm modules are distributed via npm?

@ijjkijjkDec 22, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Those will this one is just special since it's implicit not explicit/imported directly by the user.

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.

stdlib only contains fetch() which does need to be imported by the user. We got rid of the implicit fetch() hoisting a while ago.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah ya seems fine without it so must have only been needed from different issue early on in this PR.

#683

Comment threadpackages/builders/src/base-builder.ts
@ijjk

ijjk commented Dec 23, 2025

Copy link
Copy Markdown
MemberAuthor

@packages/next lists peerDependencies as "next": ">13". Any reason to believe that this is still accurate?

@VaguelySerious wrt^ this PR shouldn't be using any features that cause a Next.js semver requirement change but we should validate minimum supported version in follow-up as v13 does sound like a stretch and isn't maintained anymore.

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

Labels

None yet

Projects

None yet

5 participants

@ijjk@TooTallNate@pranaygp@Schniz@VaguelySerious
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); Add lazy workflow and step discovery in Next.js by ijjk · Pull Request #640 · vercel/workflow · GitHub
Skip to content

Add lazy workflow and step discovery in Next.js - #640

Merged
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery
Dec 23, 2025
Merged

Add lazy workflow and step discovery in Next.js#640
ijjk merged 27 commits into
mainfrom
ijjk/lazy-next-discovery

Conversation

@ijjk

@ijjkijjk commented Dec 17, 2025

Copy link
Copy Markdown
Member

This re-architects the integration with workflows and Next.js to no longer need to do a pass over all entry points to discover workflows/steps. Instead workflows/steps will be discovered as Next.js is processing files via the configured loader automatically. Then once the loader is done being called we compile the workflow bundles. This also removes the need to have separate custom dev watching for workflows and we can fully rely on Next.js for watching for changes instead.

closes: #523
closes: #469

@changeset-bot

changeset-botBot commented Dec 17, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 60eaeb3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
NameType
@workflow/buildersPatch
@workflow/nextPatch
@workflow/astroPatch
@workflow/cliPatch
@workflow/nitroPatch
@workflow/sveltekitPatch
workflowPatch
@workflow/world-testingPatch
@workflow/nuxtPatch
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.032s (-21.2% 🟢)1.015s (~)0.983s101.00x
🌐 RedisNext.js (Turbopack)0.034s (-17.5% 🟢)1.018s (~)0.983s101.07x
🌐 StarterNext.js (Turbopack)0.040s (+3.4%)1.014s (~)0.974s101.24x
💻 LocalNitro0.042s (-1.0%)1.006s (~)0.965s101.30x
💻 LocalExpress0.044s (+1.6%)1.007s (~)0.964s101.37x
🌐 TursoNext.js (Turbopack)0.109s (+9.8% 🔺)1.013s (~)0.904s103.41x
🌐 MongoDBNext.js (Turbopack)0.117s (+58.8% 🔺)1.015s (~)0.898s103.66x
🐘 PostgresNitro0.269s (-10.7% 🟢)1.022s (+1.0%)0.753s108.41x
🐘 PostgresExpress0.318s (~)1.016s (~)0.698s109.95x
🐘 PostgresNext.js (Turbopack)0.365s (+123.7% 🔺)1.019s (~)0.654s1011.40x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro0.537s (+2.0%)1.639s (-17.3% 🟢)1.101s101.00x
▲ VercelExpress0.564s (-7.8% 🟢)1.545s (+5.8% 🔺)0.982s101.05x
▲ VercelNext.js (Turbopack)0.567s (-10.6% 🟢)1.570s (-0.9%)1.004s101.05x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.071s (-2.0%)2.011s (~)0.940s101.00x
🌐 RedisNext.js (Turbopack)1.077s (-1.4%)2.015s (~)0.937s101.01x
🌐 StarterNext.js (Turbopack)1.091s (~)2.009s (~)0.917s101.02x
💻 LocalNitro1.112s (~)2.006s (~)0.894s101.04x
💻 LocalExpress1.113s (~)2.007s (~)0.895s101.04x
🌐 MongoDBNext.js (Turbopack)1.301s (~)2.012s (~)0.710s101.21x
🌐 TursoNext.js (Turbopack)1.315s (+0.9%)2.012s (~)0.697s101.23x
🐘 PostgresNext.js (Turbopack)1.649s (-14.1% 🟢)2.016s (~)0.367s101.54x
🐘 PostgresExpress2.155s (~)3.016s (~)0.860s102.01x
🐘 PostgresNitro2.232s (+4.2%)3.015s (~)0.782s102.08x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.542s (-7.0% 🟢)3.702s (~)1.160s101.00x
▲ VercelNext.js (Turbopack)2.554s (-5.0%)3.634s (-1.8%)1.080s101.00x
▲ VercelExpress2.659s (~)3.624s (+2.2%)0.965s101.05x

🔍 Observability: Nitro | Next.js (Turbopack) | Express

workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)10.535s (-1.1%)11.016s (~)0.481s51.00x
🌐 RedisNext.js (Turbopack)10.580s (-0.9%)11.022s (~)0.442s51.00x
🌐 StarterNext.js (Turbopack)10.587s (~)11.010s (~)0.424s51.00x
💻 LocalExpress10.785s (~)11.013s (~)0.228s51.02x
💻 LocalNitro10.791s (~)11.013s (~)0.223s51.02x
🌐 TursoNext.js (Turbopack)12.184s (~)13.022s (~)0.838s51.16x
🌐 MongoDBNext.js (Turbopack)12.193s (~)13.021s (~)0.828s51.16x
🐘 PostgresNext.js (Turbopack)14.811s (-2.7%)15.441s (-3.7%)0.630s51.41x
🐘 PostgresNitro20.431s (~)21.037s (+0.9%)0.606s51.94x
🐘 PostgresExpress20.501s (~)21.032s (~)0.531s51.95x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro21.385s (-0.9%)22.047s (-1.7%)0.662s51.00x
▲ VercelExpress21.546s (~)22.397s (~)0.851s51.01x
▲ VercelNext.js (Turbopack)21.606s (-0.9%)22.346s (-0.9%)0.740s51.01x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.313s (-3.3%)2.011s (~)0.699s151.00x
💻 LocalNext.js (Turbopack)1.328s (-4.8%)2.012s (~)0.683s151.01x
🌐 StarterNext.js (Turbopack)1.343s (~)2.007s (~)0.664s151.02x
💻 LocalExpress1.403s (-0.6%)2.006s (~)0.603s151.07x
💻 LocalNitro1.415s (~)2.006s (~)0.591s151.08x
🐘 PostgresNext.js (Turbopack)1.869s (+1.3%)2.015s (-2.5%)0.146s151.42x
🌐 MongoDBNext.js (Turbopack)2.155s (+1.3%)3.013s (~)0.858s101.64x
🌐 TursoNext.js (Turbopack)2.176s (-0.8%)3.017s (~)0.841s101.66x
🐘 PostgresNitro2.338s (-0.6%)3.017s (~)0.679s101.78x
🐘 PostgresExpress2.396s (~)3.013s (~)0.616s101.83x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.719s (-0.6%)3.815s (+8.5% 🔺)1.096s81.00x
▲ VercelNitro2.740s (+1.0%)3.806s (~)1.066s81.01x
▲ VercelNext.js (Turbopack)2.935s (-3.8%)3.782s (-4.9%)0.847s81.08x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.014s (-6.9% 🟢)2.421s (-22.3% 🟢)0.407s131.00x
💻 LocalExpress2.165s (-2.0%)3.131s (-0.8%)0.966s101.07x
💻 LocalNitro2.176s (-2.1%)3.151s (~)0.975s101.08x
🌐 RedisNext.js (Turbopack)2.367s (-5.0% 🟢)3.012s (~)0.645s101.17x
🌐 StarterNext.js (Turbopack)2.446s (~)3.009s (~)0.563s101.21x
🐘 PostgresNext.js (Turbopack)2.576s (-2.2%)3.021s (~)0.444s101.28x
🐘 PostgresExpress2.978s (+2.0%)3.470s (+7.2% 🔺)0.492s91.48x
🐘 PostgresNitro3.048s (+14.8% 🔺)3.582s (+18.3% 🔺)0.534s91.51x
🌐 MongoDBNext.js (Turbopack)4.656s (-2.4%)5.186s (~)0.530s62.31x
🌐 TursoNext.js (Turbopack)4.661s (~)5.181s (~)0.520s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Next.js (Turbopack)3.716s (+16.9% 🔺)4.584s (+20.1% 🔺)0.868s71.00x
▲ VercelExpress3.754s (+23.3% 🔺)4.516s (+22.6% 🔺)0.761s71.01x
▲ VercelNitro3.912s (+25.9% 🔺)4.473s (+16.7% 🔺)0.560s71.05x

🔍 Observability: Next.js (Turbopack) | Express | Nitro

Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.325s (-4.5%)2.011s (~)0.686s151.00x
🌐 StarterNext.js (Turbopack)1.331s (-3.0%)2.007s (~)0.676s151.00x
💻 LocalNext.js (Turbopack)1.351s (-3.4%)2.015s (~)0.664s151.02x
💻 LocalNitro1.409s (-1.7%)2.005s (~)0.596s151.06x
💻 LocalExpress1.410s (~)2.006s (~)0.596s151.06x
🐘 PostgresNext.js (Turbopack)1.671s (+2.6%)2.013s (~)0.343s151.26x
🐘 PostgresNitro1.850s (-1.3%)2.011s (~)0.161s151.40x
🐘 PostgresExpress1.908s (+8.0% 🔺)2.077s (+3.3%)0.170s151.44x
🌐 MongoDBNext.js (Turbopack)2.140s (+1.0%)3.011s (~)0.871s101.62x
🌐 TursoNext.js (Turbopack)2.180s (-1.7%)3.013s (~)0.832s101.65x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro2.566s (-4.0%)3.664s (-2.9%)1.098s91.00x
▲ VercelExpress2.668s (-1.5%)3.665s (+4.5%)0.997s91.04x
▲ VercelNext.js (Turbopack)2.712s (+1.9%)3.655s (~)0.943s91.06x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)2.060s (-10.2% 🟢)2.918s (-10.1% 🟢)0.858s111.00x
💻 LocalNitro2.214s (-7.4% 🟢)3.157s (-5.2% 🟢)0.943s101.07x
💻 LocalExpress2.227s (-0.8%)3.177s (~)0.950s101.08x
🌐 RedisNext.js (Turbopack)2.381s (-4.3%)3.012s (~)0.632s101.16x
🌐 StarterNext.js (Turbopack)2.466s (~)3.008s (~)0.543s101.20x
🐘 PostgresNext.js (Turbopack)2.466s (-7.1% 🟢)3.021s (~)0.555s101.20x
🐘 PostgresNitro2.619s (+11.8% 🔺)3.024s (~)0.406s101.27x
🐘 PostgresExpress2.817s (+3.4%)3.015s (~)0.197s101.37x
🌐 TursoNext.js (Turbopack)4.702s (-1.4%)5.183s (~)0.481s62.28x
🌐 MongoDBNext.js (Turbopack)4.765s (+1.3%)5.181s (~)0.416s62.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Nitro3.745s (+26.2% 🔺)4.586s (+24.6% 🔺)0.842s71.00x
▲ VercelExpress3.795s (+17.8% 🔺)4.591s (+20.7% 🔺)0.796s71.01x
▲ VercelNext.js (Turbopack)4.534s (+41.7% 🔺)5.280s (+36.2% 🔺)0.747s61.21x

🔍 Observability: Nitro | Express | Next.js (Turbopack)

Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.103s (-29.4% 🟢)1.003s (~)0.017s (+3.1%)1.027s (~)0.924s101.00x
🌐 RedisNext.js (Turbopack)0.109s (-23.8% 🟢)1.005s (~)0.000s (NaN%)1.014s (~)0.905s101.05x
🌐 StarterNext.js (Turbopack)0.126s (-2.6%)1.006s (~)0.000s (NaN%)1.011s (~)0.885s101.22x
💻 LocalExpress0.174s (-1.0%)0.992s (~)0.015s (-6.3% 🟢)1.022s (~)0.847s101.68x
💻 LocalNitro0.178s (+1.3%)0.993s (~)0.019s (+18.9% 🔺)1.025s (~)0.848s101.72x
🌐 MongoDBNext.js (Turbopack)0.517s (+0.9%)0.930s (-0.6%)0.000s (+Infinity% 🔺)1.013s (~)0.495s105.00x
🌐 TursoNext.js (Turbopack)0.545s (+11.2% 🔺)0.910s (-5.3% 🟢)0.000s (+200.0% 🔺)1.016s (~)0.471s105.27x
🐘 PostgresNext.js (Turbopack)0.910s (-23.1% 🟢)0.755s (-55.8% 🟢)0.000s (+Infinity% 🔺)1.015s (-44.2% 🟢)0.105s108.80x
🐘 PostgresNitro2.226s (-1.9%)2.823s (+2.0%)0.000s (~)3.016s (~)0.790s1021.51x
🐘 PostgresExpress2.309s (~)2.735s (~)0.000s (-100.0% 🟢)3.016s (~)0.707s1022.31x

▲ Production (Vercel)

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
▲ Vercel🥇 Express2.731s (-8.1% 🟢)3.210s (-0.8%)0.409s (-42.8% 🟢)4.100s (-8.8% 🟢)1.368s101.00x
▲ VercelNitro2.733s (+3.3%)3.330s (+3.4%)0.483s (-27.9% 🟢)4.241s (-1.5%)1.507s101.00x
▲ VercelNext.js (Turbopack)3.089s (+17.4% 🔺)3.571s (+11.8% 🔺)0.484s (-15.7% 🟢)4.515s (+7.6% 🔺)1.425s101.13x

🔍 Observability: Express | Nitro | Next.js (Turbopack)

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)8/8
🐘 PostgresNext.js (Turbopack)7/8
▲ VercelNitro5/8
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express💻 Local8/8
Next.js (Turbopack)💻 Local6/8
Nitro💻 Local8/8
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Starter: Community world (local development)
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@github-actions

github-actionsBot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production286011297
✅ 💻 Local Development26208270
✅ 📦 Local Production26208270
✅ 🐘 Local Postgres26208270
❌ 🪟 Windows027027
❌ 🌍 Community Worlds109110120
Total118138351254

❌ Failed Tests

🪟 Windows (27 failed)

nextjs-turbopack (27 failed):

  • addTenWorkflow
  • addTenWorkflow
  • should work with react rendering in step
  • promiseAllWorkflow
  • promiseRaceWorkflow
  • promiseAnyWorkflow
  • readableStreamWorkflow
  • hookWorkflow
  • webhookWorkflow
  • webhook route with invalid token
  • sleepingWorkflow
  • nullByteWorkflow
  • workflowAndStepMetadataWorkflow
  • outputStreamWorkflow
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions
  • fetchWorkflow
  • promiseRaceStressTestWorkflow
  • retryAttemptCounterWorkflow
  • retryableAndFatalErrorWorkflow
  • stepDirectCallWorkflow - calling step functions directly outside workflow context
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • closureVariableWorkflow - nested step functions with closure variables
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • health check endpoint - workflow and step endpoints respond to __health query parameter
🌍 Community Worlds (11 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (8 failed):

  • addTenWorkflow
  • addTenWorkflow
  • retryAttemptCounterWorkflow
  • crossFileErrorWorkflow - stack traces work across imported modules
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro2601
✅ example2601
✅ express2601
✅ fastify2601
✅ hono2601
✅ nextjs-turbopack2601
✅ nextjs-webpack2601
✅ nitro2601
✅ nuxt2601
✅ sveltekit2601
✅ vite2601
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable2601
✅ express-stable2601
✅ fastify-stable2601
✅ hono-stable2601
✅ nextjs-turbopack-stable2700
✅ nextjs-webpack-stable2700
✅ nitro-stable2601
✅ nuxt-stable2601
✅ sveltekit-stable2601
✅ vite-stable2601
❌ 🪟 Windows
AppPassedFailedSkipped
❌ nextjs-turbopack0270
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev300
❌ mongodb2610
✅ redis-dev300
❌ redis2610
✅ starter-dev300
❌ starter1980
✅ turso-dev300
❌ turso2610

📋 View full workflow run

Comment threadpackages/next/src/builder.ts Outdated
Comment threadpackages/next/src/loader.ts Outdated
Comment threadpackages/next/src/loader.ts
dirs: ['.'], // Different apps that use nitro have different directories
}),
buildTarget: 'next', // Placeholder, not actually used
buildTarget: 'nitro' as any, // Placeholder, not actually used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice

*/
// Re-export stdlib for discovery - needed because lazy discovery doesn't pick it up via eager scanning.
// The workflow builder injects this as a builtin module available in the workflow runtime sandbox.
export * from '../stdlib.js';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jc: does this mean things like DurableAgent and mux's external code won't work with lazy eval - when npm modules are distributed via npm?

@ijjkijjkDec 22, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Those will this one is just special since it's implicit not explicit/imported directly by the user.

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.

stdlib only contains fetch() which does need to be imported by the user. We got rid of the implicit fetch() hoisting a while ago.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah ya seems fine without it so must have only been needed from different issue early on in this PR.

#683

Comment threadpackages/builders/src/base-builder.ts
@ijjk

ijjk commented Dec 23, 2025

Copy link
Copy Markdown
MemberAuthor

@packages/next lists peerDependencies as "next": ">13". Any reason to believe that this is still accurate?

@VaguelySerious wrt^ this PR shouldn't be using any features that cause a Next.js semver requirement change but we should validate minimum supported version in follow-up as v13 does sound like a stretch and isn't maintained anymore.

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

Labels

None yet

Projects

None yet

5 participants

@ijjk@TooTallNate@pranaygp@Schniz@VaguelySerious