https://github.com/mammadataei/vite-plugin-graphql-server
Bootstrap a local GraphQL server in your Vite project
https://github.com/mammadataei/vite-plugin-graphql-server
Last synced: 24 days ago
JSON representation
Bootstrap a local GraphQL server in your Vite project
- Host: GitHub
- URL: https://github.com/mammadataei/vite-plugin-graphql-server
- Owner: mammadataei
- License: mit
- Created: 2022-12-11T12:46:25.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-11T19:54:49.000Z (28 days ago)
- Last Synced: 2025-04-11T20:42:12.655Z (28 days ago)
- Language: TypeScript
- Homepage:
- Size: 168 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- fucking-awesome-vite - vite-plugin-graphql-server - Bootstrap a local GraphQL server for testing and documentaion. (Plugins / Framework-agnostic Plugins)
- awesome-vite - vite-plugin-graphql-server - Bootstrap a local GraphQL server for testing and documentaion. (Plugins / Framework-agnostic Plugins)
README
Vite GraphQL Server
Bootstrap a local GraphQL server in your Vite project
## Introduction
This plugin helps you bootstrap a local GraphQL server in your Vite project with
the minimum amount of setup and configuration. It is helpful for prototyping,
local development, and debugging.## Getting Started
First, install the plugin:
```bash
npm install --save-dev vite-plugin-graphql-serveryarn add --dev vite-plugin-graphql-server
pnpm add --save-dev vite-plugin-graphql-server
```Then, add the plugin to your `vite.config.ts` and pass in your GraphQL schema
and resolvers:```ts
import { defineConfig } from 'vite'
import GraphqlServer from 'vite-plugin-graphql-server'export default defineConfig({
plugins: [
plugin({
contextValue: {
// Any context value that you want to be available in your resolvers
},
schema: {
typeDefs: `
type Query {
hello: String!
}
`,
resolvers: {
Query: {
hello: () => 'Hello World',
},
},
},
}),
],
})
```Now, you can start your Vite server and your GraphQL server will be available at
`http://localhost:5173/__graphql`.## Related Projects
- [vite-plugin-graphiql](https://github.com/mammadataei/vite-plugin-graphiql):
Integrate GraphiQL IDE in your Vite projects. It is a great companion to this
plugin. You can use it to explore your GraphQL schema and execute queries
against your local GraphQL server.- [@graphql-utils/store](https://github.com/graphql-utils/store): In-memory data
store for writing stateful GraphQL mocks. You can use it to store data in your
GraphQL server and use it in your resolvers without having to set up a
database.## License
Licensed under the [MIT License](LICENSE).