Edit this page

System overview

How Gitpay is built, from the React app to the payment providers, and where each piece lives in the repository.

Gitpay is a single repository, worknenjoy/gitpay, with a Node.js API and a React web app. It’s open source under the MIT license.

Gitpay system overviewA React web app talks to a Node.js and Express API over JSON. The API stores data in PostgreSQL through Sequelize, moves money through a payment provider layer for Whop and Stripe, reads GitHub through OAuth and the REST API, sends email through SendGrid and notifications to Slack. Providers call back through webhooks, and scheduled jobs run through cron or Inngest.EXTERNAL SERVICESJSON overHTTPSproviderlayerWeb appReact 18, MUI, Redux, ReactIntlDesign libraryStorybook, atoms to pagesScheduled jobscron in process, moving toInngestAPI serverNode.js 24, Express 5,TypeScript, PassportPostgreSQLSequelize models and migrationsWhopCheckout, KYC, payoutsStripeOlder accountsGitHubOAuth, REST API,commentsSendGridTransactional emailSlackTeam notifications
The main parts of Gitpay and how they talk to each other.

The pieces

Part Technology Where
Web app React 18, MUI, Redux, React Intl, webpack frontend/
Design library Components from atoms to full pages, documented in Storybook frontend/src/components/design-library/
API server Node.js 24, Express 5, TypeScript, Passport src/
Database PostgreSQL through Sequelize, with migrations and seeders src/models/, src/db/
Payment providers A provider layer with Whop and Stripe connectors src/providers/
Webhooks Signed endpoints for Whop and Stripe events src/app/routes/webhooks.ts, src/modules/webhooks/
GitHub integration OAuth sign-in, the REST API, and issue comments src/client/, src/bot/
Scheduled jobs In-process cron, moving to Inngest src/crons/, src/inngest/
Email SendGrid, with templates in English and Portuguese src/mail/, locales/

Request flow

  1. The web app calls the API over HTTPS with JSON. Signed-in requests carry a JWT.
  2. Express routes in src/app/routes/ pass the request to a controller in src/app/controllers/.
  3. Controllers call business logic in src/modules/ and src/services/, which read and write through src/queries/ and src/mutations/.
  4. Anything that moves money goes through getPaymentProvider(), never a provider SDK directly. See Payment providers.
  5. Providers report results back through webhooks, which update records and send emails. See Webhooks.

Repository layout

gitpay/
├── src/
│   ├── app/            # Express routes and controllers
│   ├── modules/        # Business logic by feature (tasks, orders, payment requests…)
│   ├── services/       # Cross-cutting services (payments, payouts, issues, transfers)
│   ├── queries/        # Database reads
│   ├── mutations/      # Database writes
│   ├── models/         # Sequelize models
│   ├── db/             # Migrations and seeders
│   ├── providers/      # PaymentProvider, Stripe and Whop connectors, webhook registry
│   ├── client/         # Auth strategies and external API clients
│   ├── bot/            # Comments Gitpay posts on GitHub
│   ├── crons/          # Legacy scheduled jobs
│   ├── inngest/        # Inngest functions
│   ├── mail/           # Email templates and senders
│   └── scripts/        # Operational and reporting scripts
├── frontend/
│   └── src/
│       ├── components/
│       │   ├── areas/           # Public and private app areas
│       │   └── design-library/  # atoms → molecules → organisms → templates → pages
│       ├── actions/, reducers/  # Redux
│       └── translations/        # UI strings (React Intl)
├── test/               # Backend tests (Mocha)
├── playwright/         # End-to-end tests with GitHub and Whop stubs
├── locales/            # Server-side strings for emails
└── docs/               # Developer notes on providers and jobs

Authentication

Passport handles sign-in with email and password, GitHub, Bitbucket, Google and Facebook. The API issues a JWT that the web app sends on every signed-in request. Connecting GitHub is required to send bounty solutions, because Gitpay verifies the pull request author against the connected account.

Hosting

The API and the built web app run as one Node.js process on Heroku, with Heroku Postgres. The documentation site and Storybook are published to GitHub Pages from the gh-pages branch.

Next steps