Oracle3
Open-source trading engine and MCP server for prediction markets. Fee-aware no-arbitrage trading across related contracts, live on Kalshi, Polymarket and Solana or on paper.
Find and fix revenue leaks in your Stripe account. Powered by Stripe + Claude AI.
FinanceTypeScript · PowerShellGitHub @LemagicrachOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
Loading the full README. The saved excerpt is shown below.
Stripe revenue leak detection and monitoring for small SaaS teams.
Corvidet connects to a Stripe account, syncs subscription data, calculates core revenue metrics, detects a small set of concrete revenue leak patterns, and exposes that data through authenticated API routes and a Next.js dashboard. This branch is a serious MVP foundation, not a finished production system.Read the full README ↗Stripe revenue leak detection and monitoring for small SaaS teams.
Corvidet connects to a Stripe account, syncs subscription data, calculates core revenue metrics, detects a small set of concrete revenue leak patterns, and exposes that data through authenticated API routes and a Next.js dashboard. This branch is a serious MVP foundation, not a finished production system.
The repository is beyond scaffold stage: authentication, Stripe Connect, sync, metrics snapshots, leak detection, alerts, and insights are implemented in the current branch. At the same time, several route groups and dashboard areas are still placeholders or partial integrations.
Use this README as a branch-accurate status document, not a product promise.
/api/sync-stripe-sessionANTHROPIC_API_KEY is configuredCorvidet is positioned as a revenue operations layer for founders using Stripe as their source of truth. The current MVP is strongest at:
It is not yet a full revenue intelligence platform with mature forecasting, fully automated notifications, or comprehensive recovery operations.
| Layer | Technology |
|---|---|
| App | Next.js 16 App Router, TypeScript, React 19 |
| Styling | Tailwind CSS 4 |
| Auth + Database | Supabase (Auth, Postgres, RLS) |
| Payments + Source Data | Stripe + Stripe Connect OAuth |
| AI | Anthropic API |
| Resend |
stripe_connections./api/sync-stripe-session uses the stored Stripe connection to pull live Stripe data.metrics_snapshots, refreshes revenue_leaks, and generates simple revenue_signals./api/metrics, /api/alerts, and /api/insights expose derived data for the dashboard or other clients.src/
├── app/
│ ├── api/ # Route handlers
│ ├── auth/callback/ # Supabase auth callback
│ ├── dashboard/ # Protected UI
│ ├── login/ # Auth entry page
│ └── page.tsx # Marketing landing page
├── lib/
│ ├── supabase/ # Browser/server/middleware clients
│ ├── encryption.ts # AES-256-GCM helpers
│ ├── stripe-metrics.ts # Stripe -> metrics snapshot logic
│ ├── revenue-leaks.ts # Leak detection logic
│ ├── revenue-signals.ts # MVP signal generation
│ ├── alerts.ts # Alert shaping
│ ├── insights.ts # Insights shaping
│ ├── server-clients.ts # Stripe + Supabase admin clients
│ └── server-error.ts # Standard API error responses
├── proxy.ts # Session refresh / auth guard entrypoint
└── supabase/migrations/ # Database schema
The main operational heartbeat is /api/sync-stripe-session. It:
last_sync_atThe repo currently calculates and stores:
These values are derived in src/lib/stripe-metrics.ts and persisted to metrics_snapshots.
Current leak detection is intentionally narrow and explainable. It detects:
Leak logic lives in src/lib/revenue-leaks.ts.
The current branch includes:
/api/alerts for an authenticated, normalized alert feed backed by leaks and signals/api/insights for a grounded summary of recoverable revenue, top risks, trend summary, and recommended actionsThese routes are MVP-honest and derived from persisted metrics, leaks, and signals rather than opaque analytics.
npm install
.env.localUse the variables below as a starting point. Features that depend on optional providers can remain disabled if their keys are omitted.
# Supabase
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_KEY=
# Stripe
STRIPE_SECRET_KEY=
STRIPE_CLIENT_ID=
STRIPE_CONNECT_REDIRECT_URI=http://localhost:3000/api/stripe/connect
STRIPE_WEBHOOK_SECRET=
STRIPE_BILLING_WEBHOOK_SECRET=
STRIPE_GROWTH_PRICE_ID=
STRIPE_BUSINESS_PRICE_ID=
# AI
ANTHROPIC_API_KEY=
# Email
RESEND_API_KEY=
RESEND_FROM_EMAIL=
# Security / ops
ENCRYPTION_KEY=
CRON_SECRET=
# App
NEXT_PUBLIC_APP_URL=http://localhost:3000
Notes:
ENCRYPTION_KEY must be 64 hex characters.ANTHROPIC_API_KEY is missing, AI routes will not work.Example key generation:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
http://localhost:3000/auth/callbacksupabase/migrations/ (see Database migrations below).http://localhost:3000/api/stripe/connectnpm run dev
Open http://localhost:3000.
npm run dev
npm run build
npm run lint
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYSUPABASE_SERVICE_KEYSTRIPE_SECRET_KEYSTRIPE_CLIENT_IDSTRIPE_CONNECT_REDIRECT_URIENCRYPTION_KEYNEXT_PUBLIC_APP_URLSTRIPE_WEBHOOK_SECRET: Stripe Connect webhook verificationSTRIPE_BILLING_WEBHOOK_SECRET: Stripe billing webhook verificationSTRIPE_GROWTH_PRICE_ID: checkout for the Growth planSTRIPE_BUSINESS_PRICE_ID: checkout for the Business planANTHROPIC_API_KEY: AI analyze / copilot routesRESEND_API_KEY: email sending helpersRESEND_FROM_EMAIL: custom sender addressCRON_SECRET: authenticated cron endpointsThis repo contains a mix of implemented routes and placeholder routes.
api/stripe/connectapi/stripe/syncapi/sync-stripe-sessionapi/metricsapi/leaks/actionsapi/leaks/connectionsapi/leaks/run-scanapi/alertsapi/insightsapi/churn/analyzeapi/user/connection-statusapi/create-checkoutapi/create-portalapi/ai/analyzeapi/ai/copilotapi/healthapi/cron/sync-allapi/cron/*api/recoveries/*api/leaks/notificationsapi/leaks/email-reportapi/leaks/streamapi/churn/interveneapi/scenarios/createapi/benchmarks/*api/usage/currentapi/user/profileapi/admin/data-modeThe route tree is broader than the truly finished feature set. Read the implementation before assuming a route group is production-ready.
Key tables in the shipped schema:
| Table | Purpose |
|---|---|
user_profiles | Profile, plan tier, Stripe billing customer mapping |
stripe_connections | Connected Stripe accounts and encrypted OAuth tokens |
metrics_snapshots | Daily revenue metrics per connection |
revenue_leaks | Detected leak records with severity and recoverable revenue |
revenue_signals | Lightweight persisted signals / alerts |
recovery_events | Intended recovery event log, currently not fully aligned with all route usage |
usage_events | Product and operational event logging |
All tables use Supabase Row Level Security. The service-role client is used only in trusted server contexts such as sync, billing, and webhook flows.
The repo uses the Supabase CLI to manage schema as versioned SQL files under supabase/migrations/. The CLI is invoked via npx, no global install needed.
Migrations use a sequential prefix, not the CLI's default <timestamp>_ format. Existing files:
supabase/migrations/001_initial_schema.sql
supabase/migrations/002_update_plan_tiers.sql
supabase/migrations/003_monthly_reports.sql
supabase/migrations/004_audit_requests.sql
New migrations continue the sequence: 005_, 006_, etc. Use a short, lowercase, snake_case name describing the change (e.g. 005_rls.sql, 006_quota_function.sql).
Do not run
supabase db pullagainst the linked project — it would emit a<timestamp>_remote_schema.sqlfile that duplicates the schema already captured in the sequential files.
# Authenticate the CLI with your Supabase account (interactive, opens browser)
npx supabase login
# Link the local repo to the remote project (writes project ref into supabase/config.toml)
npx supabase link --project-ref <YOUR_PROJECT_REF>
# Diff local migrations against the linked remote schema
npx supabase db diff
# Lint migrations locally before opening a PR (CI runs the same check)
npx supabase db lint --level error
# Apply pending local migrations to the linked remote project
npx supabase db push
supabase/migrations/<NNN>_<short_name>.sql with the next sequential number.create table if not exists, create index if not exists, etc.).npx supabase db lint --level error locally — fix any issues before pushing..github/workflows/db.yml) re-runs the lint against your branch.npx supabase db push to apply the migration to the linked Supabase project.If you run a local Supabase instance (npx supabase start), you can reapply all migrations from scratch with:
npx supabase db reset
This drops the local database, replays every migration in order, and runs supabase/seed.sql.
src/app/api and src/lib over relying on historical docs.What this branch is today:
What it is not yet: