Grafbase + SolidJS
SolidJS gives you all the tools you need to build production scale applications. Whether you need to fetch data on the server, at build time when creating a static export, or caching on demand, SolidJS has you covered.
import { GraphQLClient, gql } from 'graphql-request'
import { useRouteData } from 'solid-start'
import { createServerData$ } from 'solid-start/server'
export const grafbase = new GraphQLClient('GRAFBASE_API_URL', {
headers: { 'x-api-key': '...' }
})
const GetAllPosts = gql`
{
postCollection(first: 100) {
edges {
node {
id
title
slug
}
}
}
}
`
export const routeData = () => {
return createServerData$(async () => {
const { postCollection } = await grafbase.request(GetAllPosts)
return postCollection
})
}
const App = () => {
const { edges } = useRouteData<typeof routeData>()
return (
<Layout>
<For each={edges()}>
{(edge) => !!edge?.node && <Post {...edge.node} />}
</For>
</Layout>
)
}
export default App
import { GraphQLClient, gql } from 'graphql-request'
import { useRouteData } from 'solid-start'
import { createServerData$ } from 'solid-start/server'
export const grafbase = new GraphQLClient('GRAFBASE_API_URL', {
headers: { 'x-api-key': '...' }
})
const GetAllPosts = gql`
{
postCollection(first: 100) {
edges {
node {
id
title
slug
}
}
}
}
`
export const routeData = () => {
return createServerData$(async () => {
const { postCollection } = await grafbase.request(GetAllPosts)
return postCollection
})
}
const App = () => {
const { edges } = useRouteData<typeof routeData>()
return (
<Layout>
<For each={edges()}>
{(edge) => !!edge?.node && <Post {...edge.node} />}
</For>
</Layout>
)
}
export default App
Testimonials
Tried @grafbase and was impressed how easy & fast it was to create your serverless GraphQL API + local instance 🔥
Current fantasy tech stack 🚀: - @nextjs - @tailwindcss - @typescript - @trpcio - @grafbase - @ClerkDev
As an engineer, I'm always on the lookout for tools that make my job easier and more efficient. @grafbase has quickly become a go-to for me in my #GraphQL development work. Its real-time query execution and intuitive schema management have saved me countless hours of debugging
Done playing with @Cloudflare Pages & Workers, for now. Now to learn some @grafbase and see how if it can play a role, because it is pretty nifty!
not sure if @grafbase is so good that it will actually obviate my entire job, or if it's good enough that i can use it at work without someone questioning my existence. either way, i am sold on the concept of "upload some SDL and query shit, stop worrying about the DB infra".
Build a Solid backend with Grafbase
We’ve made it super easy to get started integrating Grafbase with SolidJS.