@isaacadams/platapi
v1.3.5
Published
The easiest way to create an API to love.
Readme

platapi — smart, simple, scalable APIs
- Next.js-like file-based routing
- Endpoints are simple, testable, functions
- Runs server or serverless with no additional config
- Automatically generate OpenAPI spec documentation
Getting Started (easy)
npx create-platapi
cd my-platapi-project
npm run dev
CLI Reference
Commands
platapi dev
Start the development server with hot reloading.
platapi dev
platapi dev -c ./custom-api.config.jsOptions:
-c, --config <string>- Location of your api.config.js file (default:./api.config.js)
platapi build
Build your API for production deployment.
# Basic production build
platapi build
# Build with source maps for debugging
platapi build -s
platapi build --sourcemap
# Build without minification (faster, uses less memory)
platapi build --no-minify
# Build with custom config
platapi build -c ./custom-api.config.js
# Build with increased memory limit
platapi build --max-old-space-size 6144
# Combine options
platapi build -s --no-minify -c ./api.config.jsOptions:
-c, --config <string>- Location of your api.config.js file (default:./api.config.js)-s, --sourcemap- Generate source maps for debugging (default:false)--no-minify- Skip minification to reduce memory usage and build time--max-old-space-size <mb>- Set the Node.js heap limit for this command
Output:
build/server.js- Bundled server filebuild/server.js.map- Source map file (when using-s)
platapi generate:docs
Generate OpenAPI 3.1 specification documentation for your API.
# Generate docs to console
platapi generate:docs
# Generate docs to file
platapi generate:docs -o ./openapi.json
# Merge with existing OpenAPI spec
platapi generate:docs -d ./base-spec.json -o ./openapi.json
# With custom config
platapi generate:docs -c ./custom-api.config.js -o ./docs.jsonOptions:
-c, --config <string>- Location of your api.config.js file (default:./api.config.js)-d, --defaultSpecFile <string>- Default OpenAPI 3.1 spec to merge with generated documentation-o, --outfile <string>- Output docs to a file, otherwise prints to console--max-old-space-size <mb>- Set the Node.js heap limit for this command
Environment Variables
PlatAPI supports several environment variables for advanced configuration:
# Set default heap limit for PlatAPI commands
PLATAPI_MAX_OLD_SPACE_SIZE=6144 platapi build
# Pass additional Node.js flags
PLATAPI_NODE_OPTIONS="--trace-gc" platapi build
# Enable memory usage debugging
PLATAPI_DEBUG_MEMORY=1 platapi generate:docsAvailable Variables:
PLATAPI_MAX_OLD_SPACE_SIZE=<mb>- Sets the default heap limit for PlatAPI commandsPLATAPI_NODE_OPTIONS="..."- Passes extra Node flags to the respawned processPLATAPI_DEBUG_MEMORY=1- Logs phase-level RSS/heap usage during build and docs generation
Getting Help
# Show all commands
platapi
platapi help
# Show help for specific command
platapi build --help
platapi dev --help
platapi generate:docs --help