Skip to content

Repository files navigation

Workfusion Trading AI

Workfusion Trading AI is a SaaS MVP for MT4/MT5 automation builders.

It helps traders:

  • Generate EA drafts from plain-English strategy ideas.
  • Debug MQL4/MQL5 code and compiler errors.
  • Govern prop-firm payout readiness with target, drawdown, trading-day, exposure, and warning checks.
  • Analyze trading reports and identify risk issues.
  • Export PDF governance reports before changing risk or requesting payout review.
  • Optimize prop-firm settings before demo or live testing.
  • Download generated code artifacts.
  • Save projects through a local storage adapter.
  • Pre-check generated code, optionally compile MT5 .mq5 files through MetaEditor, and estimate backtest readiness.
  • Prepare Stripe/PayPal billing with explicit live-mode guardrails.

Product Positioning

Workfusion is a software tool. It does not manage accounts, execute trades, custody funds, or guarantee profits.

Core offer:

Generate, debug, and risk-check MT4/MT5 Expert Advisors for prop-firm traders.

Updated offer:

Build, debug, and govern MT4/MT5 automation.

Local Development

npm run dev

Open:

http://localhost:3000

Verification

npm run lint
npm run build

Optional Real MT5 Compiler

POST /api/workers/compile always returns a static MQL pre-check. To make it run a real MetaEditor compile on a Mac/VPS with Wine and MT5 installed, set:

WORKFUSION_COMPILER_WORKER_URL=http://127.0.0.1:8787
WORKFUSION_COMPILER_WORKER_TOKEN=change-this-long-token
WORKFUSION_METAEDITOR_ROOT=/path/to/MetaTrader 5
WORKFUSION_WINE_BIN=wine
WORKFUSION_METAEDITOR_TIMEOUT_MS=180000

Start the Mac/VPS worker:

npm run compiler:worker

The worker root folder must contain MetaEditor64.exe. When configured, the API posts the submitted .mq5 to the worker, the worker writes it into MQL5/Experts/WorkfusionCompilerJobs/, calls MetaEditor, and reports whether an .ex5 artifact was produced. Vercel deployments normally run in static_precheck mode until WORKFUSION_COMPILER_WORKER_URL points to a reachable HTTPS worker endpoint. If WORKFUSION_COMPILER_WORKER_URL is not set, the API can still run local MetaEditor compilation directly via WORKFUSION_METAEDITOR_ROOT.

PayPal Sandbox Test

Use sandbox credentials only:

PAYPAL_API_BASE=https://api-m.sandbox.paypal.com
PAYPAL_CLIENT_ID=...
PAYPAL_CLIENT_SECRET=...
NEXT_PUBLIC_PAYPAL_MONTHLY_PLAN_ID=...
NEXT_PUBLIC_PAYPAL_YEARLY_PLAN_ID=...
PAYPAL_WEBHOOK_ID=...

Then run:

npm run paypal:sandbox -- preflight
npm run paypal:sandbox -- create sandbox-buyer@example.com starter
npm run paypal:sandbox -- verify I-SUBSCRIPTIONID

Premium activation is completed by /api/billing/paypal/activate after PayPal redirects back with subscription_id. Renewals and payment receipt evidence are handled by /api/billing/paypal/webhook, which verifies PayPal webhook signatures and records PAYMENT.SALE.COMPLETED events.

API Routes

  • POST /api/trading/generate
  • POST /api/trading/debug
  • POST /api/trading/debrief
  • POST /api/trading/optimize
  • POST /api/trading/download
  • POST /api/govern/payout
  • POST /api/govern/payout-report
  • POST /api/subscription/status
  • GET|POST /api/auth/session
  • GET|POST /api/projects
  • POST /api/workers/compile
  • POST /api/workers/backtest
  • POST /api/billing/checkout

Billing Safety

/api/billing/checkout only creates provider checkout/approval sessions when:

WORKFUSION_BILLING_MODE=live
NEXT_PUBLIC_APP_URL=https://www.workfusionapp.com
PAYPAL_CLIENT_ID=...
PAYPAL_CLIENT_SECRET=...
NEXT_PUBLIC_PAYPAL_MONTHLY_PLAN_ID=...
NEXT_PUBLIC_PAYPAL_YEARLY_PLAN_ID=...

Stripe also requires:

STRIPE_SECRET_KEY=...
STRIPE_PRICE_STARTER=...
STRIPE_PRICE_PRO=...
STRIPE_PRICE_STUDIO=...

Launch Checklist

  • Connect Stripe price IDs or PayPal order capture before public paid launch.
  • Add Terms of Service and Privacy Policy.
  • Add production logging and rate limits.
  • Add user accounts and persistent project storage.
  • Use a dedicated Mac/VPS compiler worker before marketing browser-only SaaS outputs as guaranteed production-ready.

About

Official Workfusionapp product repository for AI-assisted MT4/MT5 builder tooling, compiler diagnostics, EA readiness checks, and SaaS workflows.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages