home / skills / andrelandgraf / fullstackrecipes / stripe-subscriptions
This skill helps you implement a complete Stripe subscriptions workflow with webhooks, plan gating via feature flags, and a billing portal for seamless billing.
npx playbooks add skill andrelandgraf/fullstackrecipes --skill stripe-subscriptionsReview the files below or copy the command above to add this skill to your agents.
---
name: stripe-subscriptions
description: Complete subscription billing system with Stripe integration, feature flags for plan gating, webhook handling, and billing portal.
---
# Stripe Subscriptions
Complete subscription billing system with Stripe integration, feature flags for plan gating, webhook handling, and billing portal.
## Prerequisites
Complete these recipes first (in order):
### Type-Safe Environment Configuration
Type-safe environment variable validation using Zod with a Drizzle-like schema API. Supports server/public fields, feature flags, either-or constraints, and client-side protection.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/config-schema-setup
```
### Neon + Drizzle Setup
Connect a Next.js app to Neon Postgres using Drizzle ORM with optimized connection pooling for Vercel serverless functions.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/neon-drizzle-setup
```
### Pino Logging Setup
Configure structured logging with Pino. Outputs human-readable colorized logs in development and structured JSON in production for log aggregation services.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/pino-logging-setup
```
## Cookbook - Complete These Recipes in Order
### Feature Flags with Flags SDK
Implement feature flags using the Vercel Flags SDK with server-side evaluation, environment-based toggles, and Vercel Toolbar integration.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/feature-flags-setup
```
### Stripe Subscriptions DB Sync
Complete subscription system with Stripe, Vercel Flags for plan configuration, webhook handling for syncing subscription state to Postgres, usage tracking, and billing portal integration.
```bash
curl -H "Accept: text/markdown" https://fullstackrecipes.com/api/recipes/stripe-sync
```
This skill implements a complete subscription billing system integrated with Stripe, including plan gating via feature flags, webhook-driven sync to your database, and a customer billing portal. It bundles production-ready patterns and step-by-step recipes to connect Stripe, Postgres, and feature flagging for reliable recurring billing. The implementation is TypeScript-first and designed for full-stack Next.js apps.
The system wires Stripe checkout, billing portal sessions, and webhook handlers to keep subscription state synchronized with a Postgres database using Drizzle. Feature flags control plan availability and gating logic at runtime, so you can enable or disable plans without code releases. Webhooks from Stripe update subscription and invoice records, while usage tracking and billing portal links let customers manage billing directly.
Do I need a specific database or ORM?
No, but the recipes use Postgres with Drizzle ORM and Neon-compatible pooling for serverless environments; you can adapt the syncing logic to other databases.
How are feature flags evaluated?
Feature flags are evaluated server-side using the Flags SDK, allowing environment-based toggles and integration with your plan configuration without client-side exposure.