UNPKG

prices-as-code

Version:

Prices as Code (PaC) - Define your product pricing schemas with type-safe definitions

199 lines (174 loc) 8.35 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Home - Prices as Code</title> <meta name="description" content="Define your product pricing schemas with type-safe definitions"> <link rel="stylesheet" href="assets/css/main.css"> <link rel="icon" href="https://raw.githubusercontent.com/wickdninja/assets/refs/heads/main/PaC.webp"> </head> <body> <header class="site-header"> <div class="container"> <div class="header-content"> <div class="logo"> <a href="index.html"> <img src="https://raw.githubusercontent.com/wickdninja/assets/refs/heads/main/PaC.webp" alt="Prices as Code" width="40"> <span>Prices as Code</span> </a> </div> <nav class="main-nav"> <ul> <li><a href="guides/index.html">Guides</a></li> <li><a href="api/index.html">API</a></li> <li><a href="providers/index.html">Providers</a></li> <li><a href="https://github.com/wickdninja/prices-as-code" target="_blank">GitHub</a></li> <li><a href="https://www.npmjs.com/package/prices-as-code" target="_blank">NPM</a></li> </ul> </nav> </div> </div> </header> <main class="content"> <div class="container"> <div class="hero"> <img src="https://raw.githubusercontent.com/wickdninja/assets/refs/heads/main/PaC.webp" alt="Prices as Code" width="300" /> <h1>Prices as Code</h1> <p>Define your product pricing schemas with type-safe definitions and synchronize them with Stripe.</p> <span class="badge">v3.5.0</span> <a href="guides/getting-started.html" class="btn">Get Started</a> <a href="https://github.com/wickdninja/prices-as-code" class="btn btn-secondary">View on GitHub</a> </div> <div class="note"> <p>Prices as Code is a TypeScript library that makes it easy to manage product pricing with Stripe and allows for extending to custom providers.</p> </div> <div class="whats-new"> <h2>🎉 What's New in v3.5.0</h2> <ul> <li><strong>Generate Feature:</strong> Quickly scaffold pricing templates</li> <li><strong>Customizable Templates:</strong> Define tiers, intervals, and currencies</li> <li><strong>CLI Enhancements:</strong> New generate command with options</li> <li><strong>Programmatic Generation:</strong> Create templates through the API</li> </ul> <a href="https://github.com/wickdninja/prices-as-code/blob/main/LIBRARY_CHANGES.md" class="btn btn-small">View Changelog</a> </div> <div class="features"> <div class="feature"> <h3>Type-Safe</h3> <p>Use TypeScript and Zod schemas to define your pricing models with full type safety.</p> </div> <div class="feature"> <h3>Multi-Provider</h3> <p>Support for Stripe with an extensible architecture allowing for custom providers.</p> </div> <div class="feature"> <h3>Bidirectional</h3> <p>Push local config to providers or pull provider data into your codebase.</p> </div> <div class="feature"> <h3>Idempotent</h3> <p>Run it multiple times, only changes what's needed. Perfect for CI/CD pipelines.</p> </div> <div class="feature"> <h3>Metadata Support</h3> <p>Add custom metadata to your products and prices for enhanced flexibility.</p> </div> </div> <h2>Quick Installation</h2> <div class="highlight"> <pre><code class="language-bash">npm install prices-as-code</code></pre> </div> <p>or</p> <div class="highlight"> <pre><code class="language-bash">yarn add prices-as-code</code></pre> </div> <h2>Example Configuration</h2> <div class="highlight"> <pre><code class="language-typescript">import { Config } from 'prices-as-code'; const config: Config = { products: [ { provider: 'stripe', name: 'Basic Plan', description: 'For individuals and small teams', features: ['5 projects', '10GB storage', 'Email support'] }, { provider: 'stripe', name: 'Pro Plan', description: 'For growing businesses', features: ['Unlimited projects', '100GB storage', 'Priority support'] } ], prices: [ { provider: 'stripe', name: 'Basic Monthly', unitAmount: 999, // $9.99 currency: 'usd', type: 'recurring', recurring: { interval: 'month' }, productKey: 'basic_plan' } ] };</code></pre> </div> <h2>Why Prices as Code?</h2> <p>Managing pricing across multiple billing providers is complex and error-prone. Prices as Code provides a unified way to:</p> <ol> <li><strong>Centralize Pricing Logic</strong>: Define pricing once, deploy everywhere</li> <li><strong>Ensure Consistency</strong>: Maintain the same pricing information across systems</li> <li><strong>Reduce Errors</strong>: Catch pricing mistakes before they happen with type safety</li> <li><strong>Simplify Workflow</strong>: Integrate pricing management into your CI/CD pipeline</li> </ol> <h2>Explore the Documentation</h2> <div class="grid"> <div class="card"> <div class="card-header">Guides</div> <div class="card-body"> <p>Step-by-step guides to get you started with Prices as Code</p> <a href="guides/index.html">View Guides</a> </div> </div> <div class="card"> <div class="card-header">API Reference</div> <div class="card-body"> <p>Detailed API documentation for developers</p> <a href="api/index.html">View API</a> </div> </div> <div class="card"> <div class="card-header">Providers</div> <div class="card-body"> <p>Information about supported billing providers</p> <a href="providers/index.html">View Providers</a> </div> </div> </div> <h2>Supported Providers</h2> <p>Currently, Prices as Code supports this billing provider:</p> <ul> <li><a href="providers/stripe.html">Stripe</a></li> </ul> <p>Looking for more providers? Check out <a href="guides/custom-providers.html">Adding Custom Providers</a>.</p> <div class="warning"> <p>Prices as Code is currently in active development. APIs may change in future versions.</p> </div> <h2>License</h2> <p>This project is licensed under the <a href="https://github.com/wickdninja/prices-as-code/blob/main/LICENSE">MIT License</a></p> </div> </main> <footer class="site-footer"> <div class="container"> <div class="footer-content"> <p>Copyright &copy; 2025 Nate Ross. Distributed by an <a href="https://github.com/wickdninja/prices-as-code/blob/main/LICENSE">MIT license.</a></p> <p><a href="#top" class="back-to-top">Back to top</a></p> </div> </div> </footer> <script src="assets/js/main.js"></script> </body> </html>