Features
- 🚀 Fast Spec: Generate comprehensive specifications quickly - perfect for MVPs and prototypes
- 🔍 Deep Spec: Generate ultra-detailed specifications for complex systems with enterprise-grade depth
- ⚡ Async Spec: Non-blocking async methods for long-running requests
- 📊 Status Tracking: Check the status of async specification generation requests
- ✨ Full TypeScript Support: Complete type definitions for better IDE support
- 🛡️ Error Handling: Custom exceptions for different error scenarios
- 🌐 Modern ES Modules: Uses ES6+ import/export syntax
Installation
Install the pre.dev Node SDK using npm:Quick Start
Authentication
The Pre.dev API uses API key authentication. Get your API key from the pre.dev dashboard under Settings → API Keys:API Methods
Synchronous Methods
fastSpec()
Generate a fast specification (30-40 seconds, 10 credits).options.input
(required):string
- Description of what you want to buildoptions.outputFormat
(optional):"url" | "markdown"
- Output format (default:"url"
)options.currentContext
(optional):string
- Existing project contextoptions.docURLs
(optional):string[]
- Documentation URLs to reference
Promise<SpecResponse>
object with complete specification data
deepSpec()
Generate a deep specification (2-3 minutes, 50 credits).fastSpec()
Returns: Promise<SpecResponse>
object with comprehensive specification data
Asynchronous Methods
fastSpecAsync()
Generate a fast specification asynchronously (returns immediately).fastSpec()
Returns: Promise<AsyncResponse>
object with specId
for polling
deepSpecAsync()
Generate a deep specification asynchronously (returns immediately).fastSpec()
Returns: Promise<AsyncResponse>
object with specId
for polling
Status Checking
getSpecStatus()
Check the status of an async specification generation request.specId
(required):string
- The specification ID from async methods
Promise<SpecResponse>
object with current status and data (when completed)
Listing and Searching Specs
listSpecs()
List all specs with optional filtering and pagination.params.limit
(optional):number
- Results per page (1-100, default: 20)params.skip
(optional):number
- Offset for pagination (default: 0)params.endpoint
(optional):"fast_spec" | "deep_spec"
- Filter by endpoint typeparams.status
(optional):"pending" | "processing" | "completed" | "failed"
- Filter by status
Promise<ListSpecsResponse>
object with specs array and pagination metadata
findSpecs()
Search for specs using regex patterns.params.query
(required):string
- Regex pattern (case-insensitive)params.limit
(optional):number
- Results per page (1-100, default: 20)params.skip
(optional):number
- Offset for pagination (default: 0)params.endpoint
(optional):"fast_spec" | "deep_spec"
- Filter by endpoint typeparams.status
(optional):"pending" | "processing" | "completed" | "failed"
- Filter by status
Promise<ListSpecsResponse>
object with matching specs and pagination metadata
Regex Pattern Examples:
Pattern | Matches |
---|---|
payment | ”payment”, “Payment”, “make payment” |
^Build | Specs starting with “Build” |
platform$ | Specs ending with “platform” |
(API|REST) | Either “API” or “REST” |
auth.*system | ”auth” then anything then “system” |
\\d{3,} | 3+ digits (budgets, quantities) |
saas|sass | SaaS or SASS |