All Projects → ptpaterson → netlify-faunadb-graphql-auth

ptpaterson / netlify-faunadb-graphql-auth

Licence: other
Netlify functions example with faunadb, graphql, and authorization

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to netlify-faunadb-graphql-auth

Gatsby Starter Procyon
An opinionated Gatsby starter designed for trash-eating pandas.
Stars: ✭ 88 (+54.39%)
Mutual labels:  apollo, netlify
auth-flow-react-apollo-saga
Full stack login/register flow with React, Apollo, Redux, Redux-saga and MongoDB.
Stars: ✭ 22 (-61.4%)
Mutual labels:  apollo, auth
Mvfsillva
My personal website
Stars: ✭ 13 (-77.19%)
Mutual labels:  apollo, netlify
Apollo Universal Starter Kit
Apollo Universal Starter Kit is an SEO-friendly, fully-configured, modular starter application that helps developers to streamline web, server, and mobile development with cutting-edge technologies and ultimate code reuse.
Stars: ✭ 1,645 (+2785.96%)
Mutual labels:  apollo, auth
shopnote
shopnote is a JAMstack application that helps in creating notes with shopping items. This application is built to showcase the JAMstack concept using Fauna, Netlify Serverless Functions and GatsbyJS.
Stars: ✭ 15 (-73.68%)
Mutual labels:  netlify, faunadb
svelte-commerce
Svelte ecommerce - Headless, Authentication, Cart & Checkout, TailwindCSS, Server Rendered, Proxy + API Integrated, Animations, Stores, Lazy Loading, Loading Indicators, Carousel, Instant Search, Faceted Filters, Typescript, Open Source, MIT license. 1 command deploy to your own server, 1 click deploy to netlify.
Stars: ✭ 695 (+1119.3%)
Mutual labels:  auth, netlify
testimonial
Jamstack app using Gatsby, Netlify, and FaunaDB.
Stars: ✭ 23 (-59.65%)
Mutual labels:  netlify, faunadb
virtual-lolly
JAMstack demo site - prerendered with serverless API fallbacks
Stars: ✭ 110 (+92.98%)
Mutual labels:  netlify, faunadb
nuxt-netlify-lambda-starter
🛠️ SEO-friendly website starter backed by Netlify lambda functions in a simple, friendly repo
Stars: ✭ 60 (+5.26%)
Mutual labels:  netlify
archive-jul.sh
archive of my personal website built w gatsby.js
Stars: ✭ 31 (-45.61%)
Mutual labels:  netlify
cadhub
We're out to raise awareness and put CodeCAD on the map. The success of CadHub can be measured by the amount it promotes the use of CodeCAD within the mechanical/manufacturing industry and the strength the CadHub community.
Stars: ✭ 204 (+257.89%)
Mutual labels:  apollo
apollo-chat-graphql-server
Apollo Chat is a Chat Service build on GraphQL Apollo with Subscriptions
Stars: ✭ 13 (-77.19%)
Mutual labels:  apollo
React-Realtime-Chat
A full-stack reproduction of the popular realtime chat application, Slack (http://slack.com) using React and GraphQL Subscriptions.
Stars: ✭ 16 (-71.93%)
Mutual labels:  apollo
DeepThought
A simple blog theme focused on writing powered by Bulma and Zola.
Stars: ✭ 100 (+75.44%)
Mutual labels:  netlify
fauna-workers
A template for building fast, globally distributed applications using Cloudflare Workers and Fauna, the data API for modern applications.
Stars: ✭ 35 (-38.6%)
Mutual labels:  faunadb
nuxt-starter-netlify-cms
Example nuxt + netlify cms project. Nuxt port of Gatsby starter app.
Stars: ✭ 13 (-77.19%)
Mutual labels:  netlify
udacity-alumni-fe
A front-end web application and bespoke publishing platform, built by Udacity Alumni for Udacity Alumni
Stars: ✭ 45 (-21.05%)
Mutual labels:  apollo
rn-chat
Chat app made with React Native, NativeBase, Apollo Hooks and Sequelize.
Stars: ✭ 37 (-35.09%)
Mutual labels:  apollo
Casbin4D
An authorization library that supports access control models like ACL, RBAC, ABAC in Delphi
Stars: ✭ 25 (-56.14%)
Mutual labels:  auth
deved-platform
Nuxt.js for the new Vonage Developer Education site.
Stars: ✭ 15 (-73.68%)
Mutual labels:  netlify

Netlify + FaunaDB + GraphQL + Auth    

Example of using FaunaDB with Netlify functions.

This example shows how to use HTTP only cookies for auth with FaunaDB's native Graphql API.

About this application

This application is using React for the frontend, Netlify Functions for API calls, and FaunaDB as the backing database, utilizing the Graphql API with Apollo. This project is bundled with Parcel.

The todo editing is enabled by Draft.js

This project is primarily derived from netlify-faunadb-example

It has been updated to be better and more responsive stylings!

Easy setup with Netlify dev

Netlify Dev works with parcel-bundler out of the box!

(it also works with create-react-app)

So there is no need to install netlify-lambda and set up function proxies.

Setup

1. Clone down the repository

git clone https://github.com/ptpaterson/netlify-faunadb-graphql-auth.git

2. Enter the repo directory

cd netlify-faunadb-example

3. Install the dependencies

npm install
# -OR-
yarn

4. Sign up for a FaunaDB account

https://dashboard.fauna.com/accounts/register

5. Create a master database

It will become the parent database for the app database generated by the script provided.

In the Fauna Cloud Console:

  • Click “New Database”
  • Enter any name, e.g. “Netlify”, as the “Database Name”
  • Click “Save”

6. Create a database access key

In the Fauna Cloud Console:

  • Click “Security” in the left navigation
  • Click “New Key”
  • Make sure that the “Database” field is set to “Netlify” (or whatever you named it)
  • Make sure that the “Role” field is set to “Admin”
  • Enter any name, e.g. “Netlify Admin key” as the “Key Name”
  • Click “Save”

7. Copy the database access key

You will save it in a .env file in the next step. You won’t get a second chance to see it!

8. Bootstrap the database

Create a .env file in the project directory and store the server secret as an environment variable:

# .env
FAUNADB_ADMIN_KEY="YOUR_SECRET_KEY_HERE"

NOTE: The bootstrap script will store another environment variable in this file called FAUNADB_PUBLIC_KEY.

9. Bootstrap your FaunaDB collection and indexes

# create database and fill with example data
npm run bootstrap

This bootstrap package.json script will create a Fauna database called auth-example using scripts/create-database.js and then fill it with example data using scripts/create-example-data.js.

Output should be similar to:

Creating your FaunaDB Database...

1) Create database "auth-example"
+ Created Database "auth-example"

2) Creating temporary key
+ Created Key "temp admin key for auth-example"

3) Uploading Graphql Schema...
o GraphQL schema imported

4) Update generated User Defined Functions...
o Updated Function "login"
o Updated Function "logout"
o Updated Function "me"
o Updated Function "user_create_todo"

5) Create custom roles...
+ Created Role "public"
+ Created Key "Public key for auth-example"
! Public client key: fnADmZcVSKFYEykYVRyVaQ5WN9RQ3OEmEMtweMWk
+ Created Role "user"
-Deleted Key "temp admin key for auth-example"

Fauna Database schema has been created
Claim your fauna database with "netlify addons:auth fauna"

10. Get netlify-cli

npm install netlify-cli -g

11. Start developing!

# serve development version
netlify dev

Updating the Schema

This project uses apollo-server-lambda for the lambda function. Lambdas are not a great solution for constantly polling remote schemas. I've also had trouble with async lambda's in general. Because of this, any time a new schema is uploaded to FaunaDB, the SDL should be downloaded and placed as a string in functions/graphql/remoteSchema.js.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].