{"id":14976082,"url":"https://github.com/scalars/grapi","last_synced_at":"2025-10-27T18:30:20.821Z","repository":{"id":40361462,"uuid":"348801014","full_name":"scalars/grapi","owner":"scalars","description":"Make GraphQL API integration simple and easy. Autogen resolvers for mutation and queries in a GraphQL layer. ","archived":false,"fork":false,"pushed_at":"2025-07-04T22:07:37.000Z","size":228,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-23T16:30:04.121Z","etag":null,"topics":["graphql","graphql-js","graphql-schema","graphql-server","mongo","mongodb","mutations","queries"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scalars.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-17T17:47:37.000Z","updated_at":"2025-07-04T22:07:41.000Z","dependencies_parsed_at":"2024-09-27T21:40:26.589Z","dependency_job_id":"cd081c21-6942-4eaf-8224-e08608e89cd9","html_url":"https://github.com/scalars/grapi","commit_stats":{"total_commits":61,"total_committers":4,"mean_commits":15.25,"dds":0.4426229508196722,"last_synced_commit":"d419253f5091716c7367049c10604d96beb6a1e8"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/scalars/grapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalars%2Fgrapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalars%2Fgrapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalars%2Fgrapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalars%2Fgrapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scalars","download_url":"https://codeload.github.com/scalars/grapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalars%2Fgrapi/sbom","scorecard":{"id":803266,"data":{"date":"2025-08-11","repo":{"name":"github.com/scalars/grapi","commit":"10dcaae0adf469fa4aee33b2f0fbd069ce3c4005"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Code-Review","score":0,"reason":"Found 0/8 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":"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":"Maintained","score":5,"reason":"6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"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":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 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-23T11:05:23.932Z","repository_id":40361462,"created_at":"2025-08-23T11:05:23.932Z","updated_at":"2025-08-23T11:05:23.932Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281319624,"owners_count":26481035,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["graphql","graphql-js","graphql-schema","graphql-server","mongo","mongodb","mutations","queries"],"created_at":"2024-09-24T13:53:16.459Z","updated_at":"2025-10-27T18:30:20.536Z","avatar_url":"https://github.com/scalars.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"https://github.com/scalars/grapi\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/scalars/grapi/master/resources/logo-grapi.svg\" width=\"50%\"\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n\u003e Businesses usually involving a broad spectrum of applications, that aren't integrated and requiring human intervention at almost every step of the process, this lack of integration and automation pretend to be solved trought an autogenerated GraphQL API Layer.\n\u003e **Grapi make GraphQL API integration simple and easy.**\n\n## Installation\n``` shell\nyarn add @grapi/server\n```\n\n## Features\n### Build GraphQL API with GraphQL SDL\n\nSDL or Schema Definition Language is part of GraphQL Language, to define data and resolvers for the GraphQL API.\n\n```graphql\n# File schema.graphql\nenum Gender {\n    NO_GENDER,\n    FEMALE,\n    MALE\n}\ntype Actor @Model( dataSource: \"datasource\", key: \"Actor\" ) {\n    id: ID ! @unique\n    name: String !\n    gender: Gender\n}\n```\n\n**Grapi** read SDL types and autogen resolvers for query and mutations on every model defined in SDL schema.\n\n**Grapi for Typescript**\n```shell\nyarn init\nyarn add @grapi/server @grapi/mongodb\nyarn add ts-node apollo-server \nyarn add -D typescript\n```\n\n```typescript\n// server.ts\nimport { readFileSync } from 'fs'\nimport { resolve } from 'path'\nimport { MongodbDataSourceGroup } from '@grapi/mongodb'\nimport { Grapi } from '@grapi/server'\nimport { ApolloServer } from 'apollo-server'\n\nconst getDataSource = async () =\u003e {\n    const datasource = new MongodbDataSourceGroup(\n        process.env.MONGO_URI as string,\n        process.env.MONGO_DATA_BASE_NAME as string\n    )\n    await datasource.initialize()\n    return datasource\n}\n\nconst startGraphQLServer = async () =\u003e {\n    const datasource = await getDataSource()\n    const sdl = readFileSync( resolve( __dirname, 'schema.graphql' ) ).toString()\n    const grapi = new Grapi( {\n        sdl,\n        dataSources: {\n            datasource: ( args ) =\u003e datasource.getDataSource( args.key ),\n        }\n    } )\n    const server = new ApolloServer( grapi.createApolloConfig() )\n    server.listen().then( ( { url } ) =\u003e {\n        console.info( `GraphQL Server On: ${ url }` )\n        console.info( `Go To Browser And See PlayGround` )\n    } )\n}\n\nstartGraphQLServer()\n```\nRun server\n```\nyarn ts-node server.ts \n```\n\n#### You can see the GraphQL server in action with\n\n[ GraphQL PlayGround ](https://www.electronjs.org/apps/graphql-playground)\n\n[ Insomnia ](https://insomnia.rest/download)\n\n[ Graphiql ](https://github.com/graphql/graphiql)\n\nAlso Apollo Server offer a GraphQL Playground open your browser\n[ http://localhost:4000 ]( http://localhost:4000 )\n\n### Auto-Generated GraphQL Schema\n\nMain characteristic of Grapi is autogen a GraphQL API with types defined in SDL, the previous schema create the next resolvers.\n\n\u003cbr/\u003e\n\n#### Singular and Plural\n```graphql\ntype Query {\n    actor( where: ActorWhereUniqueInput ): Actor !\n    actors( where: ActorWhereInput ): [ Actor ! ] !\n}\n```\n\n#### Create - Update and Delete\n```graphql\ntype Mutation {\n    createActor( data: ActorCreateInput ): Actor !\n    updateActor( where: ActorWhereUniqueInput data: ActorUpdateInput ): Actor !\n    deleteActor( where: ActorWhereUniqueInput ): Actor !\n}\n```\n\nThese resolvers serve a schema in a GraphQL Server. \nAdmit retrieve and save data from datasource provided \nby Mongo DataSource or your custom data source.\n\n\n### RelationShip Made Easy\n\nDatabase relationships are associations between tables. \nGrapi support autogen resolvers for queries and mutations in schema relations. \nIt's easy create a complex server with data relations to retrieve and save data.\n\nNext schema examples shows how to create\ndifferent relationship types.\n\n\u003e The ```key``` value in directive ```@Model```\n\u003e is the collection name in mongodb\n\u003e \n\u003e The ```datasource``` value in directive ```@Model```\n\u003e is datasource alias defined in Grapi instance into dataSources object.\n\u003e That alias is arbitrary and is allow to named as you wish.\n\u003e The only condition is that in schema the alias has to be the same\n\n#### One To One Unidirectional\n```graphql\n# File schema.graphql\ntype ActorToAddress implements Relation @config( \n    name: \"ActorToAddress\"\n    foreignKey: { key: \"city_id\", side: Actor } \n)\n\ntype Actor @Model( dataSource: \"datasource\", key: \"Actor\" ) {\n    id: ID ! @unique\n    name: String !\n    address: Address @relation( with: ActorToAddress )\n}\n\ntype Address @Model( dataSource: \"datasource\", key: \"Address\" ) {\n    id: ID ! @unique\n    street: String !\n    location: Json\n}\n```\n\n#### One To One Bidirectional\n```graphql\n# File schema.graphql\ntype ActorToAddress implements Relation @config( \n    name: \"ActorToAddress\"\n    foreignKey: { key: \"city_id\", side: Actor } \n)\n\ntype Actor @Model( dataSource: \"datasource\", key: \"Actor\" ) {\n    id: ID ! @unique\n    name: String !\n    address: Address @relation( with: ActorToAddress )\n}\n\ntype Address @Model( dataSource: \"datasource\", key: \"Address\" ) {\n    id: ID ! @unique\n    street: String !\n    location: Json\n    actor: Actor @relation( with: ActorToAddress )\n}\n```\n\n#### One To Many Bidirectional\n```graphql\n# File schema.graphql\ntype VehiclesFromActor implements Relation @config( \n    name: \"VehiclesFromActor\"\n    foreignKey: { key: \"owner_car_id\" } \n)\n\ntype Actor @Model( dataSource: \"datasource\", key: \"Actor\" ) {\n    id: ID ! @unique\n    name: String !\n    vehicles: [ Vehicle ! ] ! @relation( with: VehiclesFromActor )\n}\n\ntype Vehicle @Model( dataSource: \"datasource\", key: \"Vehicle\" ) {\n    id: ID ! @unique\n    trademark: String !\n    model: String\n    name: String\n    owner: Actor @relation( with: VehiclesFromActor )\n}\n```\n\n#### Many To Many\n```graphql\n# File schema.graphql\ntype MoviesFromActorManyToMany implements Relation @config( name: \"MoviesFromActorManyToMany\" )\n\ntype Actor @Model( dataSource: \"datasource\", key: \"Actor\" ) {\n    id: ID ! @unique\n    name: String !\n    movies: [ Movie! ] ! @relation( with: MoviesFromActorManyToMany )\n}\n\ntype Movie @Model( dataSource: \"datasource\", key: \"Movie\" ) {\n    id: ID ! @unique\n    title: String !\n    actors: [ Actor ! ] ! @relation( with: MoviesFromActorManyToMany )\n}\n```\n\n## Supported data-sources\n\n\u003cdiv\u003e\n    \u003ca href=\"https://github.com/scalars/grapi/tree/main/grapi-mongodb\"\u003e\n        Grapi Mongodb\n    \u003c/a\u003e\n\u003c/div\u003e\n\n\n## License\n\nApache-2.0\n\n\nWith remote love from Colombia\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscalars%2Fgrapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscalars%2Fgrapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscalars%2Fgrapi/lists"}