Edit this page

Data model

The main Sequelize models behind bounties, payment requests and wallets, and how they relate.

Models live in src/models/, one file per model. Migrations are in src/db/migrations/ and seed data in src/db/seeders/.

Main data modelUsers import Tasks (issues), which belong to Projects and Organizations. Orders fund Tasks under a Plan. Contributors are assigned (Assign) and send TaskSolutions; accepted work creates Transfers, and Payouts move money out. Payment requests have payments and transfers. Wallets are topped up with WalletOrders.BOUNTIESPAYMENT REQUESTSWALLETSUserroles, payoutaccountOrganizationhas many ProjectsTaskan imported issueOrdera bounty payment + PlanTransferbounty to contributorAssignwho is assignedTaskSolutiona submitted pull requestPayoutbalance to bankPaymentRequesta payment linkPaymentRequestPaymentone customer paymentPaymentRequestTransferclaim for the sellerWalletprepaid balanceWalletOrdera top-up invoice
The main models, grouped by product.

People and structure

Model What it is
User An account. Holds roles (through Type), sign-in providers and the payout account IDs for Whop and Stripe.
Type A role: Contributor, Funding, Maintainer, Provider.
Organization The owner of a repository. Has many projects.
Project A repository. Has many tasks, and programming languages through ProjectProgrammingLanguage.
Label, ProgrammingLanguage Issue labels and languages, used for filtering.
Member, Role Membership and permissions on a task.

Bounties

Model What it is
Task An imported issue. In the app it’s called an issue. Holds the URL, provider, state, value, deadline and visibility.
Order A payment toward a task’s bounty: card, invoice, wallet or pay later. Linked to a Plan.
Plan, PlanSchema The fee plan applied to an order: open source (8%), open source from $5,000 (0%), private (18%), plus refund plans.
Assign A contributor assigned to a task.
Offer Legacy: bounty offers from contributors. Offers are no longer part of the app.
TaskSolution A pull request submitted as a solution, with the result of each check.
Transfer A bounty transferred to the contributor’s payout account.
Payout Money leaving a user’s payout balance for their bank.
History A task’s history of state changes.
Coupon A discount code for card payments.

Payment requests

Model What it is
PaymentRequest A payment link. Holds the title, amount or custom amount flag, settings, the provider resources, and platform_fee_percent, snapshotted at creation.
PaymentRequestCustomer The customer who paid.
PaymentRequestPayment One payment on a link, with gross, fees, net amount and status.
PaymentRequestTransfer The transfer to the seller for older links, and the claim shown to them.
PaymentRequestBalance, PaymentRequestBalanceTransaction The seller’s ledger of refund and dispute costs on older links.

Wallets

Model What it is
Wallet A prepaid balance. The balance is computed from its wallet orders.
WalletOrder A top-up, paid by invoice.

Platform stats

PlatformPublicStats stores the public totals shown on the site. It’s refreshed daily by the sync-stats job. See Scheduled jobs.

Conventions

  • Business logic doesn’t query models directly in controllers. Reads go in src/queries/, writes in src/mutations/.
  • Sensitive user fields are excluded by default scopes; use the selfView scope only for the account owner.

Next steps