npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

springboot2postman

v1.3.0

Published

Generate Postman collections automatically from any Spring Boot project — with or without Swagger

Downloads

100

Readme

SpringBoot2Postman

Generate Postman collections automatically from any Spring Boot project — with or without OpenAPI/Swagger.

npm weekly downloads

Features

  • Dual Strategy Support: Works with OpenAPI specs (JSON/YAML) or parses Java source via CST (Concrete Syntax Tree)
  • Static Analysis: No compilation required — parses @RestController annotations directly
  • Spring Boot Aware: Understands @GetMapping, @PostMapping, @RequestParam, @PathVariable, Pageable, etc.
  • Type Resolution: Converts Java types and DTOs to JSON Schema in the generated OpenAPI intermediate spec
  • Flexible Input: Accepts project directories, OpenAPI file paths, or OpenAPI URLs
  • Project Config: Reads application.properties / application.yml for context path, port, and app name
  • Large Codebase Support: Parallel processing with configurable concurrency
  • Package Filtering: Include/exclude glob patterns for file paths

Installation

npm install -g springboot2postman

Or use directly with npx:

npx springboot2postman --project ./my-spring-app

Quick Start

# From a Spring Boot project directory
springboot2postman --project . --out api.postman_collection.json

# From an OpenAPI file path
springboot2postman --project ./docs/openapi.yaml --out api.json

# From an OpenAPI URL (springdoc)
springboot2postman --project http://localhost:8080/v3/api-docs --out api.json

# With a custom base URL
springboot2postman --project ./my-app --base-url https://staging.example.com

# Export OpenAPI instead of Postman
springboot2postman --project ./my-app --format openapi --out api-spec.json

# Deterministic mock data (useful for CI/snapshots)
springboot2postman --project ./my-app --seed 42

# Dry run (no files written)
springboot2postman generate --project ./my-app --dry-run

# Validate project for CI
springboot2postman validate --project ./my-app

# Export Postman environment file
springboot2postman generate --project ./my-app --env-out api.postman_environment.json

# Large project with filtering
springboot2postman --project ./large-app --include "com.example.api.*" --exclude "*Test*" --concurrency 10

Import into Postman

  1. Open Postman → ImportFile
  2. Select the generated postman_collection.json
  3. Optionally import postman_environment.json from --env-out
  4. Set collection variables baseUrl and token as needed

CLI Commands

| Command | Description | | ---------- | ------------------------------------------------------- | | generate | Generate a Postman collection or OpenAPI spec (default) | | validate | Check whether the project can be processed |

CLI Options (generate)

| Option | Description | Default | | ---------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | --project <path> | Project path, OpenAPI file, or OpenAPI URL (required) | — | | --out <file> | Output file path | ./postman_collection.json | | --env-out <file> | Postman environment output path | — | | --dry-run | Analyze without writing output files | false | | --base-url <url> | Override the base URL in the collection | from application.properties or http://localhost:8080 | | --format <format> | Output format: postman or openapi | postman | | --include <patterns> | Include only matching file paths (comma-separated globs) | — | | --exclude <patterns> | Exclude matching file paths (comma-separated globs) | — | | --concurrency <n> | Max parallel file parsing | 5 | | --seed <n> | Seed for deterministic mock data | random | | --no-enhance | Skip Postman collection enhancements | false | | --verbose | Enable verbose logging | false |

How It Works

Strategy Detection

The tool automatically detects the best approach:

  1. URL Input → Fetches and converts OpenAPI spec
  2. OpenAPI File → Direct file path to JSON/YAML spec
  3. OpenAPI in Project → Searches root, src/main/resources/, docs/, etc.
  4. Java Controllers Found → Parser strategy (CST-based static analysis)

Parser Strategy

When no OpenAPI spec is available, the tool:

  1. Reads application.properties / application.yml for base URL and collection name
  2. Scans for DTOs and builds JSON Schema components
  3. Scans for files with @RestController or @Controller annotations
  4. Parses controllers using java-parser (CST)
  5. Extracts endpoint mappings and parameters (including Pageable)
  6. Builds an OpenAPI specification with populated schemas
  7. Converts to Postman collection format
  8. Enhances collection (variables, headers, saved responses)

Supported Annotations

| Controller | Method | Parameter | | ----------------- | ---------------- | ------------------------------------------- | | @RestController | @GetMapping | @PathVariable | | @Controller | @PostMapping | @RequestParam | | @RequestMapping | @PutMapping | @RequestBody | | | @DeleteMapping | @RequestHeader | | | @PatchMapping | @ModelAttribute | | | | Pageable (as page/size/sort query params) |

Known Limitations

  • Java only — Kotlin controllers are not supported
  • No Lombok expansion — fields must be visible in source (private fields in DTOs are detected)
  • Single module — scans one --project directory; multi-module monorepos need per-module runs
  • Regex-free but CST-limited — complex annotation arrays (value = {"/a", "/b"}) are not expanded
  • No Spring Security extraction — OAuth/API key config is not inferred from annotations
  • Include/exclude — filters match file paths, not Java package names directly

Development

git clone https://github.com/guilhermemarch/springboot2postman.git
cd springboot2postman
npm install
npm test
npm run lint

Error Codes

| Code | Description | | ---------------------- | --------------------------------------------------- | | PROJECT_NOT_FOUND | The specified project path does not exist | | NO_CONTROLLERS_FOUND | No Spring Boot controllers found in the project | | OPENAPI_FETCH_FAILED | Failed to fetch OpenAPI specification from URL/file | | INVALID_OPENAPI | The OpenAPI specification is invalid or unsupported | | PARSE_ERROR | Failed to parse a Java file | | CONVERSION_FAILED | Failed to convert to Postman collection |

Requirements

  • Node.js 16.0.0 or higher
  • npm 7.0.0 or higher