open-index/open-npm huggingface dataset:
npm package: @pothos-examples/prisma
Description: This example uses the following packages:
Latest version: 3.1.18

# A GraphQL API built with prisma

This example uses the following packages:

- `@pothos/core`: For building the schema
- `@pothos/plugin-prisma`: For prisma based type definitions, and efficient queries
- `@prisma/client`: For querying data from a database
- `prisma`: For running migrations and generating `@prisma/client`
- `graphql-yoga`: For creating a server that executes the schema

## Schema

```graphql
type Comment {
  author: User!
  comment: String!
  id: ID!
  post: Post!
}

type Post {
  author: User!
  comments: [Comment!]!
  content: String!
  id: ID!
  title: String!
}

type Query {
  post(id: ID!): Post
  posts(skip: Int, take: Int): [Post!]!
  user(id: ID!): User
}

type User {
  comments: [Comment!]!
  firstName: String!
  fullName: String!
  id: ID!
  lastName: String!
  posts: [Post!]!
}
```
npm package: @pothos-examples/prisma-relay
Description: This example uses the following packages:
Latest version: 3.1.21

# A relay compatible GraphQL API built with prisma

This example uses the following packages:

- `@pothos/core`: For building the schema
- `@pothos/plugin-prisma`: For prisma based type definitions, and efficient queries
- `@pothos/plugin-relay`: For adding relay compatible connections and nodes
- `@prisma/client`: For querying data from a database
- `prisma`: For running migrations and generating `@prisma/client`
- `graphql-yoga`: For creating a server that executes the schema

## Schema

```graphql
type Comment implements Node {
  author: User!
  comment: String!
  id: ID!
  post: Post!
}

interface Node {
  id: ID!
}

type PageInfo {
  endCursor: String
  hasNextPage: Boolean!
  hasPreviousPage: Boolean!
  startCursor: String
}

type Post implements Node {
  author: User!
  comments: [Comment!]!
  content: String!
  id: ID!
  title: String!
}

type Query {
  node(id: ID!): Node
  nodes(ids: [ID!]!): [Node]!
  post(id: ID!): Post
  posts(after: ID, before: ID, first: Int, last: Int): QueryPostsConnection!
  user(id: ID!): User
}

type QueryPostsConnection {
  edges: [QueryPostsConnectionEdge]!
  pageInfo: PageInfo!
}

type QueryPostsConnectionEdge {
  cursor: String!
  node: Post!
}

type User implements Node {
  comments(after: ID, before: ID, first: Int, last: Int): UserCommentsConnection!
  firstName: String!
  fullName: String!
  id: ID!
  lastName: String!
  posts: [Post!]!
}

type UserCommentsConnection {
  edges: [UserCommentsConnectionEdge]!
  pageInfo: PageInfo!
}

type UserCommentsConnectionEdge {
  cursor: String!
  node: Comment!
}
```
npm package: @pothos-examples/prisma-smart-subscriptions-apollo
Description: This example uses the following packages:
Latest version: 3.1.19

# A GraphQL API built with prisma with subscriptions for basic CRUD mutations

This example uses the following packages:

- `@pothos/core`: For building the schema
- `@pothos/plugin-prisma`: For prisma based type definitions, and efficient queries
- `@pothos/plugin-smart-subscriptions`: For automatically create subscription from db query
- `@prisma/client`: For querying data from a database
- `prisma`: For running migrations and generating `@prisma/client`
- `@apollo/server`: For creating a server that executes the schema
- `express`: Mandatory for Apollo v4 subscriptions

This is a fairly basic implementation, and may not represent best practices for production, but
should help demonstrate how smart subscriptions could be implemented.

## Schema

```graphql
type Comment {
  author: User!
  comment: String!
  id: ID!
  post: Post!
}

type Mutation {
  createOneUser(firstName: String!, lastName: String!): User!
}

type Post {
  author: User!
  comments: [Comment!]!
  content: String!
  id: ID!
  title: String!
}

type Query {
  countManyUser: Int!
}

type Subscription {
  countManyUser: Int!
}

type User {
  comments: [Comment!]!
  firstName: String!
  fullName: String!
  id: ID!
  lastName: String!
  posts: [Post!]!
}
```
npm package: @pothos-examples/prisma-subscriptions
Description: This example uses the following packages:
Latest version: 3.1.18

# A GraphQL API built with prisma with subscriptions for basic CRUD mutations

This example uses the following packages:

- `@pothos/core`: For building the schema
- `@pothos/plugin-prisma`: For prisma based type definitions, and efficient queries
- `@prisma/client`: For querying data from a database
- `prisma`: For running migrations and generating `@prisma/client`
- `graphql-yoga`: For creating a server that executes the schema

This is a fairly basic implementation, and may not represent best practices for production, but
should help demonstrate how subscriptions could be implemented.

## Schema

```graphql
type Comment {
  author: User!
  comment: String!
  id: ID!
  post: Post!
}

type Mutation {
  createPost(authorId: ID!, content: String!, title: String!): Post!
  createUser(firstName: String!, lastName: String!): User!
  deletePost(id: ID!): Post
  deleteUser(id: ID!): User
  updatePost(content: String, id: ID!, title: String): Post
  updateUser(firstName: String, id: ID!, lastName: String): User
}

enum MutationType {
  CREATED
  DELETED
  UPDATED
}

type Post {
  author: User!
  comments: [Comment!]!
  content: String!
  id: ID!
  title: String!
}

type Query {
  post(id: ID!): Post
  posts(skip: Int, take: Int): [Post!]!
  user(id: ID!): User
}

type Subscription {
  post(id: ID!): SubscriptionPostEvent
  posts: SubscriptionPostEvent!
  user(id: ID!): SubscriptionUserEvent
  users: SubscriptionUserEvent!
}

interface SubscriptionEvent {
  mutationType: String!
}

type SubscriptionPostEvent implements SubscriptionEvent {
  mutationType: String!
  post: Post
}

type SubscriptionUserEvent implements SubscriptionEvent {
  mutationType: String!
  user: User
}

type User {
  comments: [Comment!]!
  firstName: String!
  fullName: String!
  id: ID!
  lastName: String!
  posts: [Post!]!
}
```
npm package: @pothos-examples/relay
Description: This example uses the following packages:
Latest version: 2.0.0

# A GraphQL API built with prisma

This example uses the following packages:

- `@pothos/core`: For building the schema
- `@pothos/plugin-prism`: For prisma based type definitions, and efficient queries
- `@prisma/client`: For querying data from a database
- `prisma`: For running migrations and generating `@prisma/client`
- `apollo-server`: For creating a server that executes the schema

## Schema

```graphql
type Comment {
  author: User!
  comment: String!
  id: ID!
  post: Post!
}

type Post {
  author: User!
  comments: [Comment!]!
  content: String!
  id: ID!
  title: String!
}

type Query {
  post(id: ID!): Post
  posts(skip: Int, take: Int): [Post!]!
  user(id: ID!): User
}

type User {
  comments: [Comment!]!
  firstName: String!
  fullName: String!
  id: ID!
  lastName: String!
  posts: [Post!]!
}
```
npm package: @pothos-examples/relay-windowed-pagination
Description: This is roughly based on https://artsy.github.io/blog/2020/01/21/graphql-relay-windowed-pagination/
Latest version: 3.1.12

# A relay compatible GraphQL API that uses windowed pagination

This is roughly based on https://artsy.github.io/blog/2020/01/21/graphql-relay-windowed-pagination/

This example uses the following packages:

- `@pothos/core`: For building the schema
- `@pothos/plugin-relay`: For adding relay compatible connections and nodes
- `graphql-yoga`: For creating a server that executes the schema

## Schema

```graphql
type Comment {
  author: User
  comment: String!
  id: ID!
  post: Post!
}

interface Node {
  id: ID!
}

type PageCursor {
  cursor: String!
  isCurrent: Boolean!
  pageNumber: Int!
}

type PageCursors {
  around: [PageCursor!]!
  first: PageCursor!
  last: PageCursor!
}

type PageInfo {
  endCursor: String
  hasNextPage: Boolean!
  hasPreviousPage: Boolean!
  startCursor: String
}

type Post implements Node {
  author: User
  comments(after: ID, before: ID, first: Int, last: Int): PostCommentsConnection!
  content: String!
  id: ID!
  title: String!
}

type PostCommentsConnection {
  edges: [PostCommentsConnectionEdge]!
  pageCursors: PageCursors!
  pageInfo: PageInfo!
}

type PostCommentsConnectionEdge {
  cursor: String!
  node: Comment!
}

type Query {
  node(id: ID!): Node
  nodes(ids: [ID!]!): [Node]!
  post(id: ID!): Post
  posts(after: ID, before: ID, first: Int, last: Int): QueryPostsConnection!
  user(id: ID!): User
}

type QueryPostsConnection {
  edges: [QueryPostsConnectionEdge]!
  pageCursors: PageCursors!
  pageInfo: PageInfo!
}

type QueryPostsConnectionEdge {
  cursor: String!
  node: Post!
}

type User implements Node {
  comments(after: ID, before: ID, first: Int, last: Int): UserCommentsConnection!
  firstName: String!
  fullName: String!
  id: ID!
  lastName: String!
  posts(after: ID, before: ID, first: Int, last: Int): UserPostsConnection!
}

type UserCommentsConnection {
  edges: [UserCommentsConnectionEdge]!
  pageCursors: PageCursors!
  pageInfo: PageInfo!
}

type UserCommentsConnectionEdge {
  cursor: String!
  node: Comment!
}

type UserPostsConnection {
  edges: [UserPostsConnectionEdge]!
  pageCursors: PageCursors!
  pageInfo: PageInfo!
}

type UserPostsConnectionEdge {
  cursor: String!
  node: Post!
}
```
npm package: @pothos-examples/simple-classes
Description: This example shows how to create a GraphQL API that exposes data defined by classes
Latest version: 3.1.9

# A Simple Pothos API using data described by typescript classes

This example shows how to create a GraphQL API that exposes data defined by classes

This example uses the following packages:

- `@pothos/core`: For building the schema
- `graphql-yoga`: For creating a server that executes the schema

## Schema

```graphql
type Comment {
  author: User
  comment: String!
  id: ID!
  post: Post!
}

type Post {
  author: User
  comments: [Comment!]!
  content: String!
  id: ID!
  title: String!
}

type Query {
  post(id: ID!): Post
  posts(skip: Int, take: Int): [Post!]
  user(id: ID!): User
}

type User {
  comments: [Comment!]!
  firstName: String!
  fullName: String!
  id: ID!
  lastName: String!
  posts: [Post!]!
}
```
npm package: @pothos-examples/simple-interfaces
Description: This example shows how to create a GraphQL API that exposes data that is described by interfaces
Latest version: 3.1.9

# A Simple Pothos API using data described by typescript interfaces

This example shows how to create a GraphQL API that exposes data that is described by interfaces

This example uses the following packages:

- `@pothos/core`: For building the schema
- `graphql-yoga`: For creating a server that executes the schema

## Schema

```graphql
type Comment {
  author: User
  comment: String!
  id: ID!
  post: Post!
}

type Post {
  author: User
  comments: [Comment!]!
  content: String!
  id: ID!
  title: String!
}

type Query {
  post(id: ID!): Post
  posts(skip: Int, take: Int): [Post!]
  user(id: ID!): User
}

type User {
  comments: [Comment!]!
  firstName: String!
  fullName: String!
  id: ID!
  lastName: String!
  posts: [Post!]!
}
```