Back to Articles
Tutorials5 minJanuary 15, 2025

Windsurf Rules for MoneyGraph: Cascade-Style Payment Integration

Configure Windsurf (Codeium) for MoneyGraph payment integrations. Learn how our Cascade rules teach Windsurf the SDK architecture and compliance patterns.

By MoneyGraph Team

Windsurf (powered by Codeium) is the fastest-growing alternative to Cursor, known for its Cascade rules engine. MoneyGraph SDK v2.2 includes a comprehensive .windsurfrules.md file that teaches Windsurf our entire SDK architecture.

What Makes Windsurf Rules Special

Windsurf uses XML-style tags to organize rules into categories. Our rules file includes:

TagPurposeWhat It Contains
`<coding>`Code StandardsStrict TypeScript patterns for MoneyGraph
`<architecture>`System DesignNamespace hierarchy and domain mapping
`<task_mapping>`WorkflowsStep-by-step flows for common operations
`<compliance>`RulesKYC, FX, and payout requirements

`<coding>` Rules

Strict TypeScript patterns for MoneyGraph integration.

`<architecture>` Namespace Mapping

Windsurf learns our entire namespace hierarchy with domain mapping for each area:

NamespaceDomainSub-NamespacesPurpose
`mg.customers`Customer Onboarding`kyc`, `directors`Create and manage customers
`mg.fx`Foreign Exchange`rates`Quotes, rates, confirmations
`mg.payouts`Outbound Payments`swift`, `mobileMoney`, `crypto`Send money globally
`mg.wallets`Multi-Currency WalletsBalance management
`mg.transfers`Internal TransfersCustomer-to-customer
`mg.cards`Card IssuanceVirtual and physical cards
`mg.payments`Accept PaymentsCard processing
`mg.r3`Route OptimizationBest route selection

`<task_mapping>` Flows

Step-by-step flows for common tasks like sending international payments:

  1. mg.customers.kyc.canPayout() - Verify KYC
  2. mg.fx.quote() - Get FX quote
  3. mg.fx.confirm() - Lock the rate
  4. mg.payouts.create() - Execute payout

How Windsurf Uses These Rules

When you ask Windsurf to build a payment feature, it:

  1. Reads the architecture — Understands which namespace to use
  2. Follows the task flow — Executes steps in order
  3. Applies coding rules — Uses strict types and patterns
  4. Checks compliance — Adds KYC verification automatically

Example: Ask Windsurf to Build a Payout

Prompt: "Build a function to send money to Kenya via M-Pesa"

Windsurf generates:

import { MoneyGraph } from '@moneygraph/sdk';
import type { Payout } from '@moneygraph/sdk';

async function sendToKenyaMpesa( customerId: string, amount: number, phoneNumber: string ): Promise { const mg = new MoneyGraph({ apiKey: process.env.MONEYGRAPH_API_KEY! });

// Step 1: Verify KYC const status = await mg.customers.kyc.canPayout(customerId); if (!status.allowed) { throw new Error(KYC not approved: ${status.status}); }

// Step 2: Get FX quote const quote = await mg.fx.quote({ from: 'USD', to: 'KES', amount, });

// Step 3: Lock the rate await mg.fx.confirm(quote.id);

// Step 4: Execute payout via mobile money return mg.payouts.mobileMoney.create({ quote_id: quote.id, customer_id: customerId, recipient: { name: 'Recipient', mobile_network: 'MPESA', mobile_number: phoneNumber, }, }); } ```

Notice how Windsurf:

  • Used mg.payouts.mobileMoney (correct namespace from architecture)
  • Followed the 4-step flow (from task_mapping)
  • Added TypeScript types (from coding rules)
  • Included KYC check (from compliance rules)

Setup

Installation: ``bash npm install @moneygraph/sdk ``

How It Works: Windsurf automatically reads .windsurfrules.md from your project's node_modules/@moneygraph/sdk folder. The Cascade engine applies rules to all code files.

Quick Start Prompt

Ask Windsurf:

Build a function to send money to Kenya via M-Pesa using MoneyGraph SDK.

Requirements: - npm install @moneygraph/sdk first - Check KYC before sending - Get FX quote from USD to KES - Use mg.payouts.mobileMoney namespace - Add TypeScript types - Handle all errors ```

Windsurf's Cascade engine will generate compliant code following all payment flow patterns!

Next Steps:

Why Windsurf + MoneyGraph

Windsurf's Cascade engine excels at understanding hierarchical systems. Our SDK's namespace structure (mg.module.submodule.method) maps perfectly to Cascade's mental model.

Perfect For: Complex fintech applications with multiple payment rails, compliance requirements, and international transactions.

Ready to Get Started?

Install MoneyGraph SDK and start building AI-native payment applications today