import { useParams } from 'common' import { DocSection } from '../../DocSection' import PublicSchemaNotEnabledAlert from '../../PublicSchemaNotEnabledAlert' import CodeSnippet from '@/components/interfaces/Docs/CodeSnippet' import { GeneratingTypes } from '@/components/interfaces/Docs/GeneratingTypes' import { InlineLink } from '@/components/ui/InlineLink' import { useProjectPostgrestConfigQuery } from '@/data/config/project-postgrest-config-query' interface IntroductionProps { selectedLang: 'bash' | 'js' } const Introduction = ({ selectedLang }: IntroductionProps) => { const { ref: projectRef } = useParams() const { data: config, isSuccess } = useProjectPostgrestConfigQuery({ projectRef }) const isPublicSchemaEnabled = config?.db_schema .split(',') .map((name) => name.trim()) .includes('public') return (
All views and tables in the public schema and accessible by the active database role for a request are available for querying.

} snippets={isSuccess && !isPublicSchemaEnabled && } /> If you don't want to expose tables in your API, simply add them to a different schema (not the public schema).

} /> GraphQL vs Briven } content={ <>

If you have a GraphQL background, you might be wondering if you can fetch your data in a single round-trip. The answer is yes!

The syntax is very similar. This example shows how you might achieve the same thing with Apollo GraphQL and Briven.

Still want GraphQL?

If you still want to use GraphQL, you can. Briven provides you with a full Postgres database, so as long as your middleware can connect to the database then you can still use the tools you love. You can find the database connection details{' '} in the settings.

} snippets={ <> } />
) } const localSnippets = { withApollo: () => ({ title: 'With Apollo GraphQL', bash: { language: 'js', code: ` const { loading, error, data } = useQuery(gql\` query GetDogs { dogs { id breed owner { id name } } } \`)`, }, js: { language: 'js', code: ` const { loading, error, data } = useQuery(gql\` query GetDogs { dogs { id breed owner { id name } } } \`)`, }, }), withBriven: () => ({ title: 'With Briven', bash: { language: 'js', code: ` const { data, error } = await briven .from('dogs') .select(\` id, breed, owner (id, name) \`) `, }, js: { language: 'js', code: ` const { data, error } = await briven .from('dogs') .select(\` id, breed, owner (id, name) \`) `, }, }), } export default Introduction