Skip to content

Instantly share code, notes, and snippets.

View nikolasburk's full-sized avatar
😑

Nikolas nikolasburk

😑
View GitHub Profile

GraphQL vs Firebase

With the variety of server-side technologies today, developers have a lot of choices when it comes to deciding what kind of backend to use for their next application.

In this article, we want to explore the differences between GraphQL and Firebase, two very popular server-side technologies.

Overview

Before diving into technical details, let's create some perspective on the two technologies and where they're coming from.

// VERSION 1
// subscribe to all changes on the `User` table
const s = await prisma.user.subscribe()
// wait for new events to arrive
for await (let event of s) {
// log the details about an event to the terminal
console.log(`Something happened in the database: `)
"""Autogenerated input type of AcceptTopicSuggestion"""
input AcceptTopicSuggestionInput {
"""The Node ID of the repository."""
repositoryId: ID!
"""The name of the suggested topic."""
name: String!
"""A unique identifier for the client performing the mutation."""
clientMutationId: String
Relay Apollo
Built by Facebook (Check out the project on GitHub) Meteor (Check out the project on GitHub)
Frontend Technologies Requires React / React Native and configuration of Babel plugin Framework and platform agnostic (works with any JS framework such as React, Angular or Vue as well as on the native mobile platforms)
GraphQL API Requires a certain structure in the GraphQL schema Works with any GraphQL schema
Complexity Slow learning curve: Lots of powerful magic happening behind the scenes Low entrance barrier: Let's you get started quickly and involves more manual work for certain features
Flexibility Almost no flexibility, strict rules how to
@nikolasburk
nikolasburk / nextjs-and-prisma.md
Last active July 1, 2023 22:59
Fullstack Apps with Next.js and Prisma (PostgreSQL, MySQL & SQLite)

🚀 Fullstack Apps with Next.js and Prisma

Next.js blurs the lines between client and server. It supports pre-rendering pages at build time (SSG) or request time (SSR). Prisma is the perfect companion if you need to work with a database in a Next.js app.

Here is a list of example apps that are based on Next.js and use Prisma on the server to access data from a database:

✍️ Language 🤖 Server 🔐 Authentication 🔗 URL
TypeScript API Routes Yes (via NextAuth.js) URL
TypeScript API Routes No
import "isomorphic-fetch";
console.log("Start ...");
const numberOfRequests = 100;
async function main() {
// 1. Create x requests (as unresolved promises)
console.log(`Creating ${numberOfRequests} requests ...`);
const requests = [];
grant usage on schema public to supabase_auth_admin;
grant all on public."Profile" to supabase_auth_admin;
create or replace function create_profile_on_user_creation() returns trigger as
$$
begin
insert into
public."Profile"(id, "modifiedAt")
values(new.id, current_timestamp);

In Prisma 1, it wasn't necessary to specify both sides of a relation, this means this was allowed:

type User {
  id: ID! @unique @id
  questions: [Question]
}

type Question {
  id: ID! @unique @id

The fine print.

This page contains a lot of legalese pertaining to policies and terms. It's all very formal but everything here is guided by the following principles:

Our Guiding Principles

  • Your data is safe.
  • You own your data.
  • Stability and uptime of the Graphcool cloud platform are paramount.
  • Prisma is built by developers for developers. We will strive to make every interaction with Prisma an easy and painless experience.