{"id":18703,"library":"rankdeploy-middleware","title":"@rankdeploy/middleware","description":"SEO middleware that serves pre-rendered HTML to search engine bots while keeping zero performance impact on human visitors. Current stable version is 1.3.2, with regular updates. Key differentiators: seamless integration with Next.js (single-line setup), Netlify Edge Functions, and Express.js; automatically detects a wide range of bots (Google, Bing, Yandex, social media crawlers, AI bots like GPTBot and Claude); supports custom API URL, extra bots, and exclusion paths. Built by Rank Deploy, it offers a simple, efficient alternative to more complex prerendering solutions.","status":"active","version":"1.3.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","seo","prerender","middleware","nextjs","netlify","express","rankdeploy","googlebot","typescript"],"install":[{"cmd":"npm install rankdeploy-middleware","lang":"bash","label":"npm"},{"cmd":"yarn add rankdeploy-middleware","lang":"bash","label":"yarn"},{"cmd":"pnpm add rankdeploy-middleware","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Must use named export and export { } pattern; import and default export won't work in middleware.ts.","wrong":"import { middleware } from '@rankdeploy/middleware'","symbol":"middleware, config (Next.js)","correct":"export { middleware, config } from '@rankdeploy/middleware/next'"},{"note":"Must use named re-export of default; shorthand export default from syntax is invalid.","wrong":"export default from '@rankdeploy/middleware/netlify'","symbol":"default (Netlify)","correct":"export { default } from '@rankdeploy/middleware/netlify'"},{"note":"Express export is a named function, not a default export.","wrong":"import rankdeploy from '@rankdeploy/middleware/express'","symbol":"rankdeploy (Express)","correct":"import { rankdeploy } from '@rankdeploy/middleware/express'"}],"quickstart":{"code":"// Next.js / Vercel\n// File: middleware.ts (at project root)\nexport { middleware, config } from '@rankdeploy/middleware/next'\n\n// Netlify\n// File: netlify/edge-functions/rankdeploy.ts\nexport { default } from '@rankdeploy/middleware/netlify'\n\n// Express.js\n// File: server.ts\nimport express from 'express'\nimport { rankdeploy } from '@rankdeploy/middleware/express'\n\nconst app = express()\napp.use(rankdeploy())\napp.listen(3000)","lang":"typescript","description":"One-line integrations for Next.js, Netlify Edge Functions, and Express.js."},"warnings":[{"fix":"Ensure file is middleware.ts at root and export { middleware, config } from '@rankdeploy/middleware/next'.","message":"In Next.js, the middleware file must be named middleware.ts (not .js) and located at the project root (not /pages or /app). Also, the export must be a named export of both middleware and config; using a default export will break the integration.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Name the file rankdeploy.ts and add [[edge_functions]] function = \"rankdeploy\" path = \"/*\" to netlify.toml.","message":"Netlify Edge Functions require a netlify.toml configuration with the function name matching the file name. If the file is named other than rankdeploy.ts, the export and config must be adjusted accordingly.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Place app.use(rankdeploy()) as early as possible, before express.static and route handlers.","message":"The Express middleware should be applied before other routes, especially those that handle static files or API endpoints. Applying it after other middleware may cause it to be bypassed for prerender requests.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Consider using createMiddleware to specify a custom apiUrl or watch for changelog updates.","message":"The default API URL (https://proxy.unikium.com) may be deprecated in future versions; check documentation for updated endpoint.","severity":"deprecated","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure your tsconfig.json includes 'node_modules/@types' or install @types/node. Also verify the package is in dependencies (not devDependencies) if you need types in production.","cause":"The module is installed but TypeScript cannot resolve its types.","error":"Cannot find module '@rankdeploy/middleware' or its corresponding type declarations."},{"fix":"Use export { middleware, config } from '@rankdeploy/middleware/next'. Do not use import or default export.","cause":"The Next.js middleware file is imported incorrectly or named export syntax is wrong.","error":"Expected ';' at 'middleware' (import error in middleware.ts)"},{"fix":"Ensure the file exports default: export { default } from '@rankdeploy/middleware/netlify'. The file name must match the function name in netlify.toml.","cause":"The Netlify edge function file does not export the default handler properly.","error":"Netlify Edge Function import failed: '@rankdeploy/middleware/netlify' is not a valid function handler."},{"fix":"Use import { rankdeploy } from '@rankdeploy/middleware/express'. Then call rankdeploy() (note parentheses).","cause":"Trying to use Express import as a default import instead of named import.","error":"TypeError: rankdeploy is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}