Engineering Reference

Architecture & Tech Stack: How This Project Works

This document describes the technical architecture of the Pinehaven Ventures website: the stack, deployment pipeline, manifest-driven code generation, file map, component inventory, API routes, and environment variables.

Last updated: March 3, 2026. Reflects the current production architecture on pinehavenventures.io.

Tech stack

LayerTechnologyVersionPurpose
FrameworkNext.js16.xApp Router, server components, API routes, static/dynamic rendering
UI LibraryReact19.xComponent model, hooks, server/client component split
LanguageTypeScript5.xType safety across all source files, strict mode enabled
StylingTailwind CSS4.xUtility-first CSS via PostCSS plugin, theme variables in globals.css
PaymentsStripe SDK20.x (server) / 8.x (client)Hosted Checkout, subscriptions, billing portal, webhooks
HostingVercelManagedAutomatic deployments from GitHub, edge network, environment variables
Script Runnertsx4.xExecutes TypeScript scripts (generator, seed) without a compile step
LintingESLint9.xCode quality with next/core-web-vitals and next/typescript configs

Deployment pipeline

Code flows from a single JSON manifest to a live production site in six steps. Vercel handles build and hosting automatically on every push.

1

Edit ventures.json

All product, plan, and pricing changes start here. This is the single source of truth.

2

Run npm run generate

Reads ventures.json and regenerates stripe-products.ts, seed-stripe.ts, .env.example, and scaffolds new product pages.

3

Customize generated pages

Product pages are scaffolded once and never overwritten. Enhance hero copy, features, and layout after generation.

4

Verify locally

Run npx tsc --noEmit (type check) and npm run build (full production build) to catch errors before pushing.

5

Push to GitHub

Commit changes and push to the repository. Vercel watches the repo for changes.

6

Vercel builds and deploys

Vercel automatically runs next build and deploys to pinehavenventures.io. Environment variables are configured in Vercel dashboard.

Manifest-driven code generation

ventures.json in the project root is the single source of truth. Every product, plan, price, and feature is defined there. The generator script reads this file and produces all derived code, eliminating manual synchronization across Stripe configs, environment variables, and page scaffolds.

What the generator produces

src/lib/stripe-products.ts

Runtime Stripe product configuration with helper functions (getProductBySlug, getPlanById, formatPrice).

scripts/seed-stripe.ts

Script to provision Stripe products/prices and configure the billing portal.

.env.example

Environment variable template with placeholders for all Stripe price IDs.

src/app/ventures/<id>/page.tsx

Product page scaffold (only created for new ventures, never overwrites existing pages).

File map

Files marked as generated are overwritten by npm run generate. Do not edit them manually.

PathGenerated?Purpose
ventures.jsonManualSingle source of truth for all ventures, plans, and pricing
scripts/generate-from-manifest.tsManualGenerator script that reads ventures.json and produces generated files
scripts/seed-stripe.tsGeneratedStripe product/price provisioning and billing portal setup
src/lib/stripe-products.tsGeneratedRuntime Stripe config with product lookup helpers
src/lib/stripe.tsManualServer-side Stripe client initialization
src/lib/stripe-client.tsManualClient-side loadStripe wrapper
.env.exampleGeneratedEnvironment variable template
src/app/ventures/*/page.tsxManualProduct pages (scaffolded once, then customized)
src/app/api/stripe/*/route.tsManualGeneric API routes (checkout, webhooks, portal)
src/app/components/*.tsxManualShared UI components
src/app/reference/*/page.tsxManualToolkit reference documents
src/app/toolkit/page.tsxManualToolkit hub page listing all reference docs
src/app/checkout/*/page.tsxManualPost-checkout success and cancel pages

Component inventory

All shared components live in src/app/components/. Every component is a client component (marked with 'use client').

ComponentPropsUsed in
Navigation
src/app/components/Navigation.tsx
NoneEvery page (layout-level)
CheckoutButton
src/app/components/CheckoutButton.tsx
priceId, mode, label, classNamePricingCard, product pages
PricingCard
src/app/components/PricingCard.tsx
name, price, interval, priceId, features, highlighted, badgeAll product pages with paid plans
LeadCapture
src/app/components/LeadCapture.tsx
NoneHomepage
ContactForm
src/app/components/ContactForm.tsx
NoneHomepage (#contact anchor)
SubscribeBanner
src/app/components/SubscribeBanner.tsx
NonePower Queue Tracker product page

API routes

All API routes are generic and accept any valid input. No changes are needed when adding new products.

POST/api/stripe/checkout

Create a Stripe Checkout session

Accepts

{ priceId, mode?, successUrl?, cancelUrl? }

Returns

{ url: string }

POST/api/stripe/webhooks

Receive and process Stripe webhook events

Accepts

Raw body with stripe-signature header

Returns

{ received: true }

POST/api/stripe/portal

Create a billing portal session

Accepts

{ customerId }

Returns

{ url: string }

POST/api/subscribe

Capture email signups (Airtable integration)

Accepts

{ email, source }

Returns

{ success: true }

Environment variables

Variables go in .env.local (gitignored). Variables prefixed with NEXT_PUBLIC_ are exposed to the browser. Generated variables are auto-populated by npm run generate into .env.example.

VariableScopeDescriptionSource
STRIPE_SECRET_KEYserverServer-side Stripe API keyManual
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYclientClient-side Stripe publishable keyManual
STRIPE_WEBHOOK_SECRETserverWebhook signing secret from Stripe DashboardManual
NEXT_PUBLIC_APP_URLclientBase URL for checkout redirectsManual
AIRTABLE_TOKENserverAirtable API token for lead captureManual
AIRTABLE_BASE_IDserverAirtable base ID for subscriber tableManual
NEXT_PUBLIC_STRIPE_PRICE_POWER_DIGITAL_ANNUALclientPrice ID for Power Digital annual licenseGenerated
NEXT_PUBLIC_STRIPE_PRICE_PQT_SOLOclientPrice ID for Power Queue Tracker Solo planGenerated
NEXT_PUBLIC_STRIPE_PRICE_PQT_TEAMclientPrice ID for Power Queue Tracker Team planGenerated
NEXT_PUBLIC_STRIPE_PRICE_PQT_ENTERPRISEclientPrice ID for Power Queue Tracker Enterprise planGenerated
NEXT_PUBLIC_STRIPE_PRICE_REELPOST_STARTERclientPrice ID for ReelPost Starter planGenerated
NEXT_PUBLIC_STRIPE_PRICE_REELPOST_PROclientPrice ID for ReelPost Pro planGenerated
NEXT_PUBLIC_STRIPE_PRICE_REELPOST_AGENCYclientPrice ID for ReelPost Agency planGenerated
NEXT_PUBLIC_STRIPE_PRICE_CRYPTO_LOG_PREMIUMclientPrice ID for Crypto Transaction Log Premium planGenerated

Related references

See the Stripe Integration Spec for payment flow details, the Operations Runbook for step-by-step procedures, and the Site Map for the complete route inventory.