{"id":15837921,"url":"https://github.com/sambacha/create-subgraph-app","last_synced_at":"2026-02-12T18:32:06.262Z","repository":{"id":51303745,"uuid":"332283649","full_name":"sambacha/create-subgraph-app","owner":"sambacha","description":"cra-subgraph - web3/subgraph template","archived":false,"fork":false,"pushed_at":"2021-05-16T23:52:29.000Z","size":377,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-11T01:57:09.518Z","etag":null,"topics":["cra","create-react","ethereum","graphql","subgraph","web3"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sambacha.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-23T18:45:09.000Z","updated_at":"2021-10-18T16:16:59.000Z","dependencies_parsed_at":"2022-09-10T17:52:01.010Z","dependency_job_id":null,"html_url":"https://github.com/sambacha/create-subgraph-app","commit_stats":null,"previous_names":[],"tags_count":7,"template":true,"template_full_name":null,"purl":"pkg:github/sambacha/create-subgraph-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fcreate-subgraph-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fcreate-subgraph-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fcreate-subgraph-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fcreate-subgraph-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sambacha","download_url":"https://codeload.github.com/sambacha/create-subgraph-app/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fcreate-subgraph-app/sbom","scorecard":{"id":797080,"data":{"date":"2025-08-11","repo":{"name":"github.com/sambacha/create-subgraph-app","commit":"414afeb7fe459a3a4df93c5abadaf95bc9ce7ac6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/12 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/sambacha/create-subgraph-app/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/sambacha/create-subgraph-app/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/sambacha/create-subgraph-app/nodejs.yml/master?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 19 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T09:19:02.955Z","repository_id":51303745,"created_at":"2025-08-23T09:19:02.955Z","updated_at":"2025-08-23T09:19:02.955Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29376870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T18:17:34.915Z","status":"ssl_error","status_checked_at":"2026-02-12T18:17:34.495Z","response_time":55,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cra","create-react","ethereum","graphql","subgraph","web3"],"created_at":"2024-10-05T15:42:29.314Z","updated_at":"2026-02-12T18:32:06.247Z","avatar_url":"https://github.com/sambacha.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Create Subgraph Application\n\n[![nodejs](https://github.com/sambacha/create-subgraph-app/actions/workflows/nodejs.yml/badge.svg?branch=workflow)](https://github.com/sambacha/create-subgraph-app/actions/workflows/nodejs.yml)\n\n\u003e Web3 React App Template utilizing TheGraph\n\n## Notes\n\nSet `ETHEREUM_REORG_THRESHOLD=1` and `ETHEREUM_ANCESTOR_COUNT=1` in the thegraph service, it will only query for the latest block and its transaction receipts on startup\n\n\n## Install\n\n```bash\nnpx create-react-app \u003cyour_application_name\u003e --template cra-subgraph\n```\n\n#### NPM Registry \n\n`npm install create-subgraph-appp` -- [🔗 npm/create-subgraph-app](https://npmjs.com/package/create-subgraph-app)\n\n### Usage\n\nImport the store API and other features from this library in your mappings. A few examples:\n\n```ts\nimport { store, crypto } from '@graphprotocol/graph-ts'\n\n// This is just an example event type generated by `graph-cli`\n// from an Ethereum smart contract ABI\nimport { NameRegistered } from './types/abis/SomeContract'\n\n// This is an example of an entity type generated from a\n// subgraph's GraphQL schema\nimport { Domain } from './types/schema'\n\nfunction handleNameRegistered(event: NameRegistered) {\n  // Example use of a crypto function\n  let id = crypto.keccak256(name).toHexString()\n\n  // Example use of the generated `Entry` class\n  let domain = new Domain()\n  domain.name = name\n  domain.owner = event.params.owner\n  domain.timeRegistered = event.block.timestamp\n\n  // Example use of the store API\n  store.set('Name', id, entity)\n}\n```\n\n## GraphQL API\n\n## 1 Queries\n### 1.1 Basics\nFor each `Entity` type that you define in your schema, an `entity` and `entities` field will be generated on the top-level `Query` type. Note that `query` does not need to be included at the top of the `graphql` query when using The Graph.\n\n#### Example\nQuery for a single `Token` entity defined in your schema:\n```graphql\n{\n  token(id: \"1\") {\n    id\n    owner\n  }\n}\n```\nWhen querying for a single entity, the `id` field is required.\n\n#### Example\nCollection query for `Token` entities:\n```graphql\n{\n  tokens(first: 100) {\n    id\n    owner\n  }\n}\n```\n### 1.2 Sorting\nWhen querying a collection, the `orderBy` parameter may be used to sort by a specific attribute. Additionally, the `orderDirection` can be used to specify the sort direction, `asc` for ascending or `desc` for descending.\n\n#### Example\n```graphql\n{\n  tokens(first: 100, orderBy: price, orderDirection: asc) {\n    id\n    owner\n  }\n}\n```\n\n### 1.3 Pagination\nWhen querying a collection, the `first` parameter must be used to paginate from the beginning of the collection.\n\nTo query for groups of entities in the middle of a collection, the `skip` parameter may be used to skip a specified number of entities starting at the beginning of the collection.\n\n#### Example\nQuery 10 `Token` entities, offset by 10:\n```graphql\n{\n  tokens(first: 10, skip: 10) {\n    id\n    owner\n  }\n}\n```\n\n### 1.4 Filtering\n\nYou can use the `where` parameter in your queries to filter for different properties.\n\n#### Example\nQuery challenges with `failed` outcome:\n\n```graphql\n{\n  challenges(first: 100, where: {outcome: \"failed\"}) {\n    challenger\n    outcome\n    application(first: 100) {\n      id\n    }\n  }\n}\n```\n\nYou can use suffixes like `_gt`, `_lte` for value comparison:\n\n#### Example\n```graphql\n{\n  applications(first: 100, where: {deposit_gt:\"10000000000\"}) {\n    id\n    whitelisted\n    deposit\n  }\n}\n```\n\nFull list of parameter suffixes:\n```\n_not\n_gt\n_lt\n_gte\n_lte\n_in\n_not_in\n_contains\n_not_contains\n_starts_with\n_ends_with\n_not_starts_with\n_not_ends_with\n```\n\nPlease note that some suffixes are only supported for specific types. For example, `Boolean` only supports `_not`, `_in`, and `_not_in`.\n\n## 2 Subscriptions\nGraph Protocol subscriptions are GraphQL spec-compliant subscriptions. Unlike query operations, GraphQL subscriptions may only have a single top-level field at the root level for each subscription operation.\n\n### 2.1 Basics\nThe root Subscription type for subscription operations mimics the root Query type used for query operations to minimize the cognitive overhead for writing subscriptions.\n\n#### Example\nQuery the first 100 `Token` entities along with their `id` and `owner` attributes:\n\n```graphql\nquery {\n  tokens(first: 100) {\n    id\n    owner\n  }\n}\n```\n\nSubscribe to all `Token` entity changes and fetch the values of the `id` and `owner` attributes on the updated entity:\n\n```graphql\nsubscription {\n  tokens(first: 100) {\n    id\n    owner\n  }\n}\n```\n\n## 3 Schema\n\nThe schema of your data source--that is, the entity types, values, and relationships that are available to query--are defined through the [GraphQL Interface Definition Langauge (IDL)](http://facebook.github.io/graphql/draft/#sec-Type-System).\n\n### 3.1 Basics\n\nGraphQL requests consist of three basic operations: `query`, `subscription`, and `mutation`. Each of these has a corresponding root level `Query`, `Subscription`, and `Mutation` type in the schema of a GraphQL endpoint.\n\n\u003e **Note:** Our API does not expose mutations because developers are expected to issue transactions directly against the underlying blockchain from their applications.\n\nIt is typical for developers to define their own root `Query` and `Subscription` types when building a GraphQL API server, but with The Graph, we generate these top-level types based on the entities that you define in your schema as well as several other types for exploring blockchain data, which we describe in depth in the [Query API](#Basics).\n\n### 3.2 Entities\n\nAll GraphQL types with `@entity` directives in your schema will be treated as entities and must have an `ID` field.\n\n\u003e **Note:** Currently, all types in your schema must have an `@entity` directive. In the future, we will treat types without an `@entity` directive as value objects, but this is not yet supported.\n\n#### Example\nDefine a `Token` entity:\n\n```graphql\ntype Token @entity {\n  # The unique ID of this entity\n  id: ID!\n  name: String!\n  symbol: String!\n  decimals: Int!\n}\n```\n\n### 3.3 Built-In Types\n\n#### 3.3.1 GraphQL Built-In Scalars\nAll the scalars defined in the GraphQL spec are supported: `Int`, `Float`, `String`, `Boolean`, and `ID`.\n\n#### 3.3.2 Bytes\nThere is a `Bytes` scalar for variable-length byte arrays.\n\n#### 3.3.2 Numbers\nThe GraphQL spec defines `Int` and `Float` to have sizes of 32 bytes.\n\nThis API additionally includes a `BigInt` number type to represent arbitrarily large integer numbers.\n\n### 3.4 Enums\n\nYou can also create `enums` within a schema. Enums have the following syntax:\n\n```graphql\nenum TokenStatus {\n  OriginalOwner,\n  SecondOwner,\n  ThirdOwner,\n}\n```\n\nTo set a store value with an enum, use the name of the enum value as a string. In the example above, you can set the `TokenStatus` to the second owner with `SecondOwner`.\nMore detail on writing enums can be found in the [GraphQL documentation](https://graphql.org/learn/schema/).\n\n### 3.5 Entity Relationships\nAn entity may have a relationship to one or more other entities in your schema. These relationships may be traversed in your queries and subscriptions.\n\nRelationships in The Graph are unidirectional. Despite this, relationships may be traversed in *either* direction by defining reverse lookups on an entity.\n\n#### 3.5.1 Basics\n\nRelationships are defined on entities just like any other scalar type except that the type specified is that of another entity.\n\n#### Example\nDefine a `Transaction` entity type with an optional one-to-one relationship with a `TransactionReceipt` entity type:\n```graphql\ntype Transaction @entity {\n  id: ID!\n  transactionReceipt: TransactionReceipt\n}\n\ntype TransactionReceipt @entity {\n  id: ID!\n  transaction: Transaction\n}\n```\n\n#### Example\nDefine a `Token` entity type with a required one-to-many relationship with a `TokenBalance` entity type:\n```graphql\ntype Token @entity {\n  id: ID!\n  tokenBalances: [TokenBalance!]!\n}\n\ntype TokenBalance @entity {\n  id: ID!\n  amount: Int!\n}\n```\n\n#### 3.5.2 Reverse Lookups\nDefining reverse lookups can be defined on an entity through the `@derivedFrom` field. This creates a virtual field on the entity that may be queried but cannot be set manually through the mappings API. Rather, it is derived from the relationship defined on the other entity.\n\nThe type of an `@derivedFrom` field must be a collection since multiple entities may specify relationships to a single entity.\n\n#### Example\nDefine a reverse lookup from a `User` entity type to an `Organization` entity type:\n```graphql\ntype Organization @entity {\n  id: ID!\n  name: String!\n  members: [User]!\n}\n\ntype User @entity {\n  id: ID!\n  name: String!\n  organizations: [Organization!] @derivedFrom(field: \"members\")\n}\n```\n\n\n## License\n\nApache-2.0 or MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambacha%2Fcreate-subgraph-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsambacha%2Fcreate-subgraph-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambacha%2Fcreate-subgraph-app/lists"}