Third-Party Integrations
Relevant source files
The following files were used as context for generating this wiki page:
The RDM Digital platform leverages third-party integrations to extend its core functionality into the realms of software governance, economic operations, and territorial management. The primary integrations include GitHub for repository synchronization and analysis, and Stripe for payment processing and subscription management. These integrations are orchestrated via Supabase Edge Functions, ensuring a serverless and scalable architecture.
Sources: README.md:47-60, supabase/functions/github-sync/index.ts:1-25
GitHub Integration
The GitHub integration serves as an "Evolutionary Repository" system. It synchronizes data from specific GitHub accounts to populate the platform's federated database, allowing for active analysis of the RDM/TAMV core infrastructure.
Repository Synchronization Flow
The synchronization is handled by the github-sync Edge Function, which fetches data from the GitHub API and persists it into the repositories table.
The system identifies "Core" repositories using a whitelist and applies a classification logic to assign repositories to specific internal Federations (e.g., Technological, Economic, Cultural).
Sources: supabase/functions/github-sync/index.ts:25-60, supabase/functions/_shared/github.ts:7-25
Core Components and Logic
| Component | Description |
|---|---|
fetchGitHubRepos | Fetches paginated repository data for user OsoPanda1. |
classifyRepo | Logic that uses regex on names/descriptions to assign a federation_id. |
isCoreRepo | Validates if a repository belongs to the CORE_REPO_WHITELIST. |
analyzeRepositories | Aggregates metrics like language distribution and core repo counts. |
Sources: supabase/functions/_shared/github.ts:22-86, src/pages/Repositorio.tsx:40-60
Stripe Integration
Stripe is integrated to handle the platform's economic operations, specifically for commercial registrations and monthly billing cycles within the "Federación Económica".
Payment and Webhook Architecture
The integration consists of two main parts: the Checkout flow for initiating payments and the Webhook handler for processing asynchronous events from Stripe.
Stripe Webhook Handling
The stripe-webhook function is designed to validate the stripe-signature to ensure requests originate from Stripe. It serves as the primary listener for events like successful checkouts and subscription updates.
Sources: supabase/functions/stripe-webhook/index.ts:1-40, supabase/functions/stripe-checkout/index.ts:45-55
Configuration Requirements
Integration with Stripe requires the following environment variables to be configured within the Supabase project:
STRIPE_SECRET_KEY: Used for server-side API calls.STRIPE_WEBHOOK_SECRET: Used to verify the authenticity of incoming webhooks.price_ids: Specific Stripe Price IDs must be mapped to the business registration logic.
Sources: supabase/functions/stripe-webhook/index.ts:20-25, supabase/functions/stripe-checkout/index.ts:50-52
Data Models and Schemas
Integrations directly interact with the Supabase schema to maintain state across the platform.
Repository Schema (repositories table)
| Field | Type | Description |
|---|---|---|
id | text | Primary key (GitHub full name). |
github_id | bigint | The unique ID from GitHub. |
federation_id | text | Foreign key to federations. |
is_core | boolean | Flag for whitelisted core repositories. |
topics | jsonb | Array of GitHub topics. |
Sources: supabase/functions/github-sync/index.ts:35-50, src/pages/Repositorio.tsx:25-35
Security and Authorization
Both integrations implement specific security layers:
- Admin-Only Sync: The
github-syncfunction requires a valid JWT with anadminrole verified via thehas_roleRPC. - Signature Verification: The
stripe-webhookbypasses standard JWT authentication in favor ofstripe-signaturevalidation. - Environment Secrets: API tokens (e.g.,
GITHUB_TOKEN,STRIPE_SECRET_KEY) are managed exclusively through server-side environment variables and are never exposed to the frontend.
Sources: supabase/functions/github-sync/index.ts:5-15, supabase/functions/stripe-webhook/index.ts:20-25
The Third-Party Integrations are critical for the "Knowledge-Driven" and "Sovereign Economy" aspects of RDM Digital, ensuring the platform remains synchronized with its technical development and capable of sustaining economic activities.