{"id":19028035,"url":"https://github.com/suinplayground/typescript-prisma-graphql-nexus-example","last_synced_at":"2025-06-13T18:37:54.531Z","repository":{"id":136046368,"uuid":"344643922","full_name":"suinplayground/typescript-prisma-graphql-nexus-example","owner":"suinplayground","description":"このサンプルアプリケーションは GraphQL Nexus を用いて GraphQL エンドポイントを提供する方法を例示するものです。","archived":false,"fork":false,"pushed_at":"2021-03-05T00:07:01.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-21T19:44:50.658Z","etag":null,"topics":["example-app","graphql-nexus","prisma","prisma2","typescript"],"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/suinplayground.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-05T00:06:51.000Z","updated_at":"2021-03-05T00:09:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"2e375521-d681-4a87-addf-cd39e1829b1f","html_url":"https://github.com/suinplayground/typescript-prisma-graphql-nexus-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/suinplayground/typescript-prisma-graphql-nexus-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suinplayground%2Ftypescript-prisma-graphql-nexus-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suinplayground%2Ftypescript-prisma-graphql-nexus-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suinplayground%2Ftypescript-prisma-graphql-nexus-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suinplayground%2Ftypescript-prisma-graphql-nexus-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suinplayground","download_url":"https://codeload.github.com/suinplayground/typescript-prisma-graphql-nexus-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suinplayground%2Ftypescript-prisma-graphql-nexus-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259699933,"owners_count":22898355,"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","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":["example-app","graphql-nexus","prisma","prisma2","typescript"],"created_at":"2024-11-08T21:09:47.039Z","updated_at":"2025-06-13T18:37:54.505Z","avatar_url":"https://github.com/suinplayground.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TypeScript + Prisma + Graphql Nexus Example\n\nこのサンプルアプリケーションは GraphQL Nexus を用いて GraphQL エンドポイントを提供する方法を例示するものです。\n\nこのサンプルアプリケーションは次の技術スタックを使用します:\n\n- [**Apollo Server**](https://github.com/apollographql/apollo-server): GraphQL API の HTTP サーバー\n- [**GraphQL Nexus**](https://nexusjs.org/docs/): GraphQL のスキーマ定義とリゾルバーの実装\n- [**Prisma Client**](https://www.prisma.io/docs/concepts/components/prisma-client): データベースへのアクセス(ORM)\n- [**Prisma Migrate**](https://www.prisma.io/docs/concepts/components/prisma-migrate): データベースのマイグレーション\n- [**SQLite**](https://www.sqlite.org/index.html): データベース\n\nこのサンプルアプリケーションは、次のような「請求」を例題とした API を提供します:\n\n```graphql\n\"\"\"\n請求\n\"\"\"\ntype Invoice {\n  billingDate: DateTime!\n  id: Int!\n  items: [InvoiceItem!]!\n  total: Int!\n}\n\n\"\"\"\n請求明細\n\"\"\"\ntype InvoiceItem {\n  id: Int!\n  name: String!\n  price: Int!\n  quantity: Int!\n  total: Int!\n}\n\ntype Mutation {\n  createInvoice(data: CreateInvoiceInput!): Invoice!\n}\n\ntype Query {\n  allInvoices: [Invoice!]!\n}\n\ninput CreateInvoiceInput {\n  billingDate: DateTime!\n  items: [CreateInvoiceItemInput!]!\n}\n\ninput CreateInvoiceItemInput {\n  name: String!\n  price: Int!\n  quantity: Int!\n}\n```\n\n## サンプルの起動方法\n\n### 1. コードの入手\n\nコードをダウンロードする:\n\n```\ngit clone git@github.com:suinplayground/typescript-prisma-graphql-nexus-example.git --depth=1\n```\n\nパッケージをインストールする:\n\n```bash\n# おすすめはPNPMを使う\npnpm install\n# or\nyarn install\n# or\nnpm install\n```\n\n### 2. データベースの準備\n\nデータベースを作る:\n\n```bash\nnpx prisma migrate dev --name init --preview-feature\n```\n\n初期データ(seed)をデータベースに入れる:\n\n```bash\nnpx prisma db seed --preview-feature\n```\n\n### 3. GraphQL サーバーを起動する\n\n```bash\nnpm run dev\n```\n\n起動したら[http://localhost:4000](http://localhost:4000)にアクセスする。\n\n## 使い方\n\n### 請求をすべて取得する\n\n登録されている請求をすべて取得するには次の GraphQL を実行します:\n\n```graphql\n{\n  allInvoices {\n    id\n    billingDate\n    total\n    items {\n      id\n      name\n      price\n      quantity\n      total\n    }\n  }\n}\n```\n\n### 請求を作成する\n\n新たに請求を登録するには次の GraphQL を実行します:\n\n```graphql\nmutation {\n  createInvoice(\n    data: {\n      billingDate: \"2021-02-28T00:00:00Z\"\n      items: [\n        { name: \"ランディングページ制作\", price: 300000, quantity: 1 }\n        { name: \"マーケティング\", price: 1000000, quantity: 1 }\n      ]\n    }\n  ) {\n    id\n    total\n    billingDate\n    items {\n      id\n      price\n      quantity\n      total\n    }\n  }\n}\n```\n\n### schema.prisma を更新したとき\n\nschema.prisma を更新したときは下記のようなコマンドでマイグレーションを実行してください。\n\n```bash\nnpx prisma migrate dev --name $変更名 --preview-feature\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuinplayground%2Ftypescript-prisma-graphql-nexus-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuinplayground%2Ftypescript-prisma-graphql-nexus-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuinplayground%2Ftypescript-prisma-graphql-nexus-example/lists"}