← Back to all products
$13
Fiat Onramp Bridge
Bridge allowing users to pay subscriptions with fiat via Stripe, auto-converts to crypto.
TypeScriptJSONMarkdown
📁 File Structure 16 files
fiat-onramp-bridge/
├── LICENSE
├── README.md
├── package.json
├── security-notes.md
├── src/
│ ├── config/
│ │ └── env.ts
│ ├── index.ts
│ ├── middleware/
│ │ ├── logger.ts
│ │ └── rateLimiter.ts
│ ├── routes/
│ │ ├── checkout.ts
│ │ ├── health.ts
│ │ └── webhooks.ts
│ ├── services/
│ │ ├── mintService.ts
│ │ └── stripeService.ts
│ └── types/
│ └── index.ts
├── test/
│ └── onramp.test.ts
└── tsconfig.json
📖 Documentation Preview README excerpt
Fiat Onramp Bridge
Sub Protocol Product #5 — CryptoForge Store #5
Fiat-to-NFT onramp service that accepts credit card payments via Stripe Checkout and automatically mints MembershipNFTs to the buyer's wallet address.
Features
- Stripe Checkout integration with PCI-compliant card processing
- Automated NFT minting on payment confirmation
- Webhook signature verification for security
- Zod-based request validation
- Structured JSON logging with Winston
- Rate limiting and CORS protection
- Health check endpoints for monitoring
- Helmet security headers
Quick Start
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your Stripe + Ethereum keys
# Development
npm run dev
# Production
npm run build && npm start
# Listen for Stripe webhooks locally
npm run stripe:listen
Architecture
src/
├── index.ts # Express server bootstrap
├── config/
│ └── env.ts # Environment config with Zod validation
├── routes/
│ ├── checkout.ts # POST /api/checkout — create Stripe session
│ ├── webhooks.ts # POST /api/webhooks/stripe — handle events
│ └── health.ts # GET /api/health — system status
├── services/
│ ├── mintService.ts # Ethereum interaction + NFT minting
│ └── stripeService.ts # Stripe Checkout + webhook verification
├── middleware/
│ ├── logger.ts # Winston structured logger
│ └── rateLimiter.ts # Express rate limiting
└── types/
└── index.ts # TypeScript types + Zod schemas
API Endpoints
... continues with setup instructions, usage examples, and more.
📄 Code Sample .ts preview
src/index.ts
// ╔══════════════════════════════════════════════════════════════════════╗
// ║ FIAT ONRAMP BRIDGE — SERVER ║
// ║ Fiat-to-NFT Onramp with Stripe + Ethereum ║
// ║ Sub Protocol #5 — CryptoForge ║
// ╚══════════════════════════════════════════════════════════════════════╝
import express from "express";
import cors from "cors";
import helmet from "helmet";
import { loadConfig } from "./config/env";
import { MintService } from "./services/mintService";
import { StripeService } from "./services/stripeService";
import { createCheckoutRouter } from "./routes/checkout";
import { createWebhookRouter } from "./routes/webhooks";
import { createHealthRouter } from "./routes/health";
import { createRateLimiter } from "./middleware/rateLimiter";
import { logger } from "./middleware/logger";
/**
* Bootstrap the Fiat Onramp Bridge server.
*
* Architecture:
* Client → POST /api/checkout → Stripe Checkout → Webhook → MintService → NFT
*
* The webhook route uses express.raw() for Stripe signature verification.
* All other routes use express.json().
*/
async function main() {
const config = loadConfig();
const app = express();
// ── Services ──
const mintService = new MintService(config);
const stripeService = new StripeService(config);
// ── Global Middleware ──
app.use(helmet());
app.use(
cors({
origin: config.cors.allowedOrigins,
methods: ["GET", "POST"],
allowedHeaders: ["Content-Type", "Authorization", "Stripe-Signature"],
})
);
// ── Webhook route MUST receive raw body (before json parser) ──
app.use(
"/api/webhooks",
express.raw({ type: "application/json" }),
# ... 38 more lines ...