Safeguard
Developer Tools•

Which frameworks serve API docs by default? Four compared

FastAPI serves docs out of the box. Spring needs springdoc and NestJS needs setup. Rails API mode has none. A table of default paths and the off switches.

Safeguard Security Team
3 min read

FastAPI serves Swagger UI, ReDoc and the OpenAPI JSON by default. Spring Boot serves them only after you add springdoc. NestJS serves them only after you call SwaggerModule.setup. Rails API mode generates nothing on its own. Each has different off switches, and scanners probe for all of these paths.

Comparison table

FrameworkDocs by default?Typical pathsHow to turn off
FastAPIYes/docs, /redoc, /openapi.jsonopenapi_url=None, or docs_url and redoc_url set to None
Spring Boot with springdocOnly if the library is added/v3/api-docs, /v3/api-docs.yaml, /swagger-ui.htmlspringdoc.api-docs.enabled=false and springdoc.swagger-ui.enabled=false
NestJS with @nestjs/swaggerOnly if you call setupMount path, plus api-json and api-yaml for a mount path of apiui false and raw false
Rails API modeNoNone in the base frameworkNothing to switch off unless you add a gem

The paths and options come from each project's documentation, linked below. springdoc and @nestjs/swagger are separate packages, so whether they exist in your project depends on your dependency list.

Why defaults matter

A scanner or an attacker does not need to guess what you built. Common paths are tried first. If a framework serves docs by default, any app built on it with no extra care exposes them. The OWASP security misconfiguration page lists unnecessary enabled features and exposed endpoints among common causes of API weakness, and its prevention advice includes repeatable hardening and automated checks across environments.

Steps to find out what your app serves

  1. Check your dependency manifest for springdoc, @nestjs/swagger and any Rails documentation gem.
  2. Search code for FastAPI( with its arguments, for SwaggerModule.setup, and for springdoc properties.
  3. Request the default paths in the table against staging and production from outside.
  4. Record the result next to each service in your API inventory. The OWASP inventory guidance suggests documenting hosts, environment, network access and version.
  5. For each exposed doc, decide to keep, protect or remove. The production decision guide walks through it.
  6. Put the switch in environment specific configuration and test it in CI.

How to read the table honestly

The table describes defaults from project documentation, not your deployment. A team may have changed paths, added authentication in front of the docs, or wrapped them behind a gateway. Always test your own app from outside before concluding anything. The point of the table is to tell you which paths to try first and which switch to look for in code review.

Per framework write ups

Try it yourself

Click through it at your own pace, or open it full screen. Look for documentation libraries in the inventory.

Safeguard's SBOM and dependency scanning lists packages like springdoc and @nestjs/swagger, and a free scan is available.

Quick check

Which framework here exposes docs without any extra package?

FastAPI. The others need a library or explicit setup.

Does a custom path make docs private?

No. Renaming only avoids the laziest guesses. Use authentication or disable the docs.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.