This example uses the Vue framework with Vite and Typescript. In production environments, you should switch to a supported auth provider using the Authorization header with requests to secure your data.
- Run
npx degit grafbase/grafbase/examples/vue grafbase-with-vueto clone this example - Change directory into the new folder
cd grafbase-with-vue - Run
cp .env.example .env - Open
.envin your code editor and provide your Grafbase API endpoint and API key. Example should be fine fornpx grafbase@latest dev! - Run
npm install, oryarn installto install dependencies - Run
npx grafbase@latest devin your terminal - Populate the backend with some
Messageentries using a GraphQL mutation:
mutation {
messageCreate(
input: { author: "Grafbase Admin", body: "Grafbase is awesome!" }
) {
message {
id
}
}
}- In another terminal, run
npm run devand visithttp://localhost:5174/
To learn more about Grafbase, take a look at the following resources: