11 | ) {
12 | res.status(200).json({ name: 'John Doe' })
13 | }
14 |
--------------------------------------------------------------------------------
/nextjs-13/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/nextjs-13/public/favicon.ico
--------------------------------------------------------------------------------
/nextjs-13/queries.graphql:
--------------------------------------------------------------------------------
1 | query GetProducts {
2 | product(limit: 10) {
3 | id
4 | name
5 | }
6 | }
7 |
8 | query GetProduct($id: Int!) {
9 | product_by_pk(id: $id) {
10 | id
11 | description
12 | name
13 | price
14 | image_urls(path: "$[0]")
15 | }
16 | }
17 |
18 | mutation PlaceOrder($products: order_product_arr_rel_insert_input!) {
19 | insert_order_one(
20 | object: {
21 | products: $products
22 | billing_address_id: 222
23 | user_id: 225
24 | shipping_address_id: 222
25 | }
26 | ) {
27 | id
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/nextjs-13/service/client.ts:
--------------------------------------------------------------------------------
1 | import { GraphQLClient } from "graphql-request";
2 |
3 | export const gqlClient = new GraphQLClient(process.env.NEXT_PUBLIC_HASURA_GRAPHQL_URL!, { fetch });
4 |
--------------------------------------------------------------------------------
/nextjs-13/service/queries.graphql:
--------------------------------------------------------------------------------
1 | query GetProducts {
2 | product(limit: 10) {
3 | id
4 | name
5 | }
6 | }
7 |
8 | query GetProduct($id: Int!) {
9 | product_by_pk(id: $id) {
10 | id
11 | description
12 | name
13 | price
14 | image_urls(path: "$[0]")
15 | }
16 | }
17 |
18 | mutation PlaceOrder($products: order_product_arr_rel_insert_input!) {
19 | insert_order_one(
20 | object: {
21 | products: $products
22 | billing_address_id: 222
23 | user_id: 225
24 | shipping_address_id: 222
25 | }
26 | ) {
27 | id
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/app/next.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | target: "serverless"
3 | }
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/app/now.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 2,
3 | "builds": [
4 | { "src": "next.config.js", "use": "@now/next" }
5 | ]
6 | }
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/app/pages/_app.js:
--------------------------------------------------------------------------------
1 | import App, { Container } from 'next/app'
2 | import React from 'react'
3 | import withApolloClient from '../lib/with-apollo-client'
4 | import { ApolloProvider } from 'react-apollo'
5 |
6 | class MyApp extends App {
7 | render () {
8 | const { Component, pageProps, apolloClient } = this.props
9 | return (
10 |
11 |
12 |
13 |
14 |
15 | )
16 | }
17 | }
18 |
19 | export default withApolloClient(MyApp)
20 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/app/pages/articles.js:
--------------------------------------------------------------------------------
1 | import Router from 'next/router'
2 | import fetch from 'isomorphic-unfetch'
3 | import nextCookie from 'next-cookies'
4 | import Layout from '../components/layout'
5 | import ArticleList from '../components/ArticleList'
6 | import { withAuthSync } from '../utils/auth'
7 |
8 | const Articles = props => {
9 | return (
10 |
11 |
12 |
13 | )
14 | }
15 |
16 | export default withAuthSync(Articles)
17 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/actions.graphql
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: SAMPLE_APPS_DATABASE_URL
7 | isolation_level: read-committed
8 | pool_settings:
9 | connection_lifetime: 600
10 | idle_timeout: 180
11 | max_connections: 50
12 | retries: 1
13 | use_prepared_statements: false
14 | tables: "!include default/tables/tables.yaml"
15 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/databases/default/tables/public_article.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: article
3 | schema: public
4 | object_relationships:
5 | - name: user
6 | using:
7 | foreign_key_constraint_on: user_id
8 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/databases/default/tables/public_role.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: role
3 | schema: public
4 | array_relationships:
5 | - name: user_roles
6 | using:
7 | foreign_key_constraint_on:
8 | column: role_id
9 | table:
10 | name: user_role
11 | schema: public
12 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/databases/default/tables/public_user.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: user
3 | schema: public
4 | array_relationships:
5 | - name: articles
6 | using:
7 | foreign_key_constraint_on:
8 | column: user_id
9 | table:
10 | name: article
11 | schema: public
12 | - name: user_roles
13 | using:
14 | foreign_key_constraint_on:
15 | column: user_id
16 | table:
17 | name: user_role
18 | schema: public
19 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/databases/default/tables/public_user_role.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: user_role
3 | schema: public
4 | object_relationships:
5 | - name: role
6 | using:
7 | foreign_key_constraint_on: role_id
8 | - name: user
9 | using:
10 | foreign_key_constraint_on: user_id
11 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/databases/default/tables/tables.yaml:
--------------------------------------------------------------------------------
1 | - "!include public_article.yaml"
2 | - "!include public_role.yaml"
3 | - "!include public_user.yaml"
4 | - "!include public_user_role.yaml"
5 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/rest_endpoints.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo-jwt/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo/components/ErrorMessage.js:
--------------------------------------------------------------------------------
1 | export default ({ message }) => (
2 |
13 | )
14 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo/next.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | target: "serverless"
3 | }
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo/now.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 2,
3 | "builds": [
4 | { "src": "next.config.js", "use": "@now/next" }
5 | ]
6 | }
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo/pages/_app.js:
--------------------------------------------------------------------------------
1 | import App, { Container } from 'next/app'
2 | import React from 'react'
3 | import withApolloClient from '../lib/with-apollo-client'
4 | import { ApolloProvider } from 'react-apollo'
5 |
6 | class MyApp extends App {
7 | render () {
8 | const { Component, pageProps, apolloClient } = this.props
9 | return (
10 |
11 |
12 |
13 |
14 |
15 | )
16 | }
17 | }
18 |
19 | export default withApolloClient(MyApp)
20 |
--------------------------------------------------------------------------------
/nextjs-8-serverless/with-apollo/pages/index.js:
--------------------------------------------------------------------------------
1 | import App from '../components/App'
2 | import Header from '../components/Header'
3 | import AuthorList from '../components/AuthorList'
4 |
5 | export default () => (
6 |
7 |
8 |
9 |
10 | )
11 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/.env.local.example:
--------------------------------------------------------------------------------
1 | SECRET_TOKEN=HELLO
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080
3 | metadata_directory: metadata
4 | actions:
5 | kind: synchronous
6 | handler_webhook_baseurl: http://localhost:3000
7 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/nextjs-incremental-static-regeneration/hasura/metadata/actions.graphql
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: PG_DATABASE_URL
7 | isolation_level: read-committed
8 | use_prepared_statements: false
9 | tables: "!include default/tables/tables.yaml"
10 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/databases/default/tables/public_post.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: post
3 | schema: public
4 | event_triggers:
5 | - definition:
6 | delete:
7 | columns: "*"
8 | enable_manual: true
9 | insert:
10 | columns: "*"
11 | update:
12 | columns: "*"
13 | headers:
14 | - name: SECRET
15 | value_from_env: SECRET_TOKEN
16 | name: update_blog
17 | retry_conf:
18 | interval_sec: 10
19 | num_retries: 0
20 | timeout_sec: 60
21 | webhook: http://host.docker.internal:3000/api/revalidate
22 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/databases/default/tables/tables.yaml:
--------------------------------------------------------------------------------
1 | - "!include public_post.yaml"
2 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/rest_endpoints.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/hasura/migrations/default/1647304090289_init/up.sql:
--------------------------------------------------------------------------------
1 | SET check_function_bodies = false;
2 | CREATE TABLE public.post (
3 | id uuid DEFAULT gen_random_uuid() NOT NULL,
4 | title text NOT NULL,
5 | content text NOT NULL
6 | );
7 | ALTER TABLE ONLY public.post
8 | ADD CONSTRAINT blog_pkey PRIMARY KEY (id);
9 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | // NOTE: This file should not be edited
5 | // see https://nextjs.org/docs/basic-features/typescript for more information.
6 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {
3 | reactStrictMode: true,
4 | };
5 |
6 | module.exports = nextConfig;
7 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | import '../styles/globals.css'
2 | import type { AppProps } from 'next/app'
3 |
4 | function MyApp({ Component, pageProps }: AppProps) {
5 | return
6 | }
7 |
8 | export default MyApp
9 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/nextjs-incremental-static-regeneration/public/favicon.ico
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/styles/globals.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7 | }
8 |
9 | a {
10 | color: inherit;
11 | text-decoration: none;
12 | }
13 |
14 | * {
15 | box-sizing: border-box;
16 | }
17 |
--------------------------------------------------------------------------------
/nextjs-incremental-static-regeneration/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true
17 | },
18 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
19 | "exclude": ["node_modules"]
20 | }
21 |
--------------------------------------------------------------------------------
/nextjs-postgres-graphql/.env.example:
--------------------------------------------------------------------------------
1 | NEXT_PUBLIC_HASURA_APP_URL='YOUR_HASURA_APP_URL'
2 |
--------------------------------------------------------------------------------
/nextjs-postgres-graphql/.gitignore:
--------------------------------------------------------------------------------
1 | package-lock.json
2 | node_modules
3 | .next
4 | .env
--------------------------------------------------------------------------------
/nextjs-postgres-graphql/assets/Permissions-Table-Data-Hasura.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/nextjs-postgres-graphql/assets/Permissions-Table-Data-Hasura.png
--------------------------------------------------------------------------------
/nextjs-postgres-graphql/assets/add-variable.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/nextjs-postgres-graphql/assets/add-variable.png
--------------------------------------------------------------------------------
/nextjs-postgres-graphql/assets/demo-app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/nextjs-postgres-graphql/assets/demo-app.png
--------------------------------------------------------------------------------
/nextjs-postgres-graphql/assets/hasura-variables.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/nextjs-postgres-graphql/assets/hasura-variables.png
--------------------------------------------------------------------------------
/nextjs-postgres-graphql/assets/nextjs-postgres-graphql.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/nextjs-postgres-graphql/assets/nextjs-postgres-graphql.png
--------------------------------------------------------------------------------
/nextjs-postgres-graphql/pages/AuthorList.js:
--------------------------------------------------------------------------------
1 | const AuthorList = ({ authors }) => (
2 |
3 | {authors &&
4 | authors.map((a, i) => (
5 |
6 |
{a.name}
7 |
8 | ))}
9 |
10 | );
11 |
12 | export default AuthorList;
13 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/apollo/clientConfig.js:
--------------------------------------------------------------------------------
1 | import { InMemoryCache } from "apollo-cache-inmemory";
2 |
3 | export default function (context) {
4 | return {
5 | httpLinkOptions: {
6 | uri: "http://localhost:8080/v1/graphql",
7 | credentials: "same-origin",
8 | },
9 | cache: new InMemoryCache(),
10 | wsEndpoint: "ws://localhost:8080/v1/graphql",
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/apollo/queries/fetchArticle.gql:
--------------------------------------------------------------------------------
1 | query article($id: Int) {
2 | article(where: { author_id: { _eq: $id } }) {
3 | id
4 | title
5 | content
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/apollo/queries/fetchAuthor.gql:
--------------------------------------------------------------------------------
1 | query {
2 | author {
3 | id
4 | name
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/assets/README.md:
--------------------------------------------------------------------------------
1 | # ASSETS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.
6 |
7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).
8 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/components/README.md:
--------------------------------------------------------------------------------
1 | # COMPONENTS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | The components directory contains your Vue.js Components.
6 |
7 | _Nuxt.js doesn't supercharge these components._
8 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/layouts/README.md:
--------------------------------------------------------------------------------
1 | # LAYOUTS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your Application Layouts.
6 |
7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts).
8 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/middleware/README.md:
--------------------------------------------------------------------------------
1 | # MIDDLEWARE
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your application middleware.
6 | Middleware let you define custom functions that can be run before rendering either a page or a group of pages.
7 |
8 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware).
9 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/pages/README.md:
--------------------------------------------------------------------------------
1 | # PAGES
2 |
3 | This directory contains your Application Views and Routes.
4 | The framework reads all the `*.vue` files inside this directory and creates the router of your application.
5 |
6 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing).
7 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/plugins/README.md:
--------------------------------------------------------------------------------
1 | # PLUGINS
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains Javascript plugins that you want to run before mounting the root Vue.js application.
6 |
7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins).
8 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/plugins/apollo-error-handler.js:
--------------------------------------------------------------------------------
1 | export default (error, nuxtContext) => {
2 | console.log("Global error handler");
3 | console.error(error);
4 | };
5 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/static/README.md:
--------------------------------------------------------------------------------
1 | # STATIC
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your static files.
6 | Each file inside this directory is mapped to `/`.
7 |
8 | Example: `/static/robots.txt` is mapped as `/robots.txt`.
9 |
10 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static).
11 |
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/nuxtjs-postgres-graphql/static/favicon.ico
--------------------------------------------------------------------------------
/nuxtjs-postgres-graphql/store/README.md:
--------------------------------------------------------------------------------
1 | # STORE
2 |
3 | **This directory is not required, you can delete it if you don't want to use it.**
4 |
5 | This directory contains your Vuex Store files.
6 | Vuex Store option is implemented in the Nuxt.js framework.
7 |
8 | Creating a file in this directory automatically activates the option in the framework.
9 |
10 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).
11 |
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/.eslintignore:
--------------------------------------------------------------------------------
1 | /dist
2 | /src-bex/www
3 | /src-capacitor
4 | /src-cordova
5 | /.quasar
6 | /node_modules
7 | .eslintrc.js
8 | babel.config.js
9 |
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/.postcssrc.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | // https://github.com/michael-ciniawsky/postcss-load-config
3 |
4 | module.exports = {
5 | plugins: [
6 | // to edit target browsers: use "browserslist" field in package.json
7 | require('autoprefixer')
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/apollo.config.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | /* eslint-env node */
3 | // See https://www.apollographql.com/docs/devtools/apollo-config/
4 | module.exports = {
5 | client: {
6 | service: {
7 | name: 'my-service',
8 | url: 'http://localhost:3000/graphql',
9 | },
10 | // Files processed by the extension
11 | includes: ['src/**/*.vue', 'src/**/*.js', 'src/**/*.ts'],
12 | },
13 | }
14 |
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/babel.config.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 |
3 | module.exports = api => {
4 | return {
5 | presets: [
6 | [
7 | '@quasar/babel-preset-app',
8 | api.caller(caller => caller && caller.target === 'node')
9 | ? { targets: { node: 'current' } }
10 | : {}
11 | ]
12 | ]
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/quasar-framework-vue-graphql/public/favicon.ico
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/public/icons/favicon-128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/quasar-framework-vue-graphql/public/icons/favicon-128x128.png
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/public/icons/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/quasar-framework-vue-graphql/public/icons/favicon-16x16.png
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/public/icons/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/quasar-framework-vue-graphql/public/icons/favicon-32x32.png
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/public/icons/favicon-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/quasar-framework-vue-graphql/public/icons/favicon-96x96.png
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/quasar.extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "@quasar/apollo": {
3 | "typescript": false
4 | }
5 | }
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/src/boot/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/quasar-framework-vue-graphql/src/boot/.gitkeep
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/src/css/app.scss:
--------------------------------------------------------------------------------
1 | // app global css in SCSS form
2 |
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/src/pages/IndexPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
18 |
--------------------------------------------------------------------------------
/quasar-framework-vue-graphql/src/router/routes.js:
--------------------------------------------------------------------------------
1 | const routes = [
2 | {
3 | path: "/",
4 | component: () => import("layouts/MainLayout.vue"),
5 | children: [
6 | {
7 | path: "/author/:authorId",
8 | component: () => import("pages/Articles.vue"),
9 | },
10 | { path: "", component: () => import("pages/IndexPage.vue") },
11 | ],
12 | },
13 |
14 | // Always leave this as last one,
15 | // but you can also remove it
16 | {
17 | path: "/:catchAll(.*)*",
18 | component: () => import("pages/ErrorNotFound.vue"),
19 | },
20 | ];
21 |
22 | export default routes;
23 |
--------------------------------------------------------------------------------
/react-apollo-todo/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/react-apollo-todo/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "es6": true
5 | },
6 | "extends": ["eslint:recommended", "plugin:react/recommended"],
7 | "parserOptions": {
8 | "ecmaFeatures": {
9 | "jsx": true
10 | },
11 | "ecmaVersion": 2018,
12 | "sourceType": "module"
13 | },
14 | "plugins": ["react", "prettier"],
15 | "rules": {
16 | "indent": "off",
17 | "linebreak-style": ["error", "unix"],
18 | "quotes": ["error", "double"],
19 | "semi": ["error", "always"],
20 | "prettier/prettier": "error",
21 | "no-console": "off"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/react-apollo-todo/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | package-lock.json
3 |
4 |
--------------------------------------------------------------------------------
/react-apollo-todo/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | This app uses environment variables.
2 |
3 | ```
4 | REACT_APP_GRAPHQL_URL=https://hasura-todo-test.herokuapp.com/v1/graphql
5 |
6 | REACT_APP_REALTIME_GRAPHQL_URL=wss://hasura-todo-test.herokuapp.com/v1/graphql
7 |
8 | REACT_APP_CALLBACK_URL=http://localhost:3000/callback
9 |
10 | REACT_APP_AUTH0_DOMAIN=todo-hasura-test.auth0.com
11 |
12 | REACT_APP_AUTH0_CLIENT_ID=lgKxyHzCDUWCALdAOkjg3QI2D6eglGes
13 | ```
14 |
15 | Create a `.env` file and apply these environment variables to work with your React app. Replace it with your Auth0 values appropriately.
16 |
--------------------------------------------------------------------------------
/react-apollo-todo/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:carbon as builder
2 | ENV NODE_ENV=PRODUCTION
3 | WORKDIR /app
4 | COPY package.json ./
5 | RUN npm install --production
6 | COPY . .
7 | RUN npm run build
8 |
9 | FROM node:8-alpine
10 | RUN npm -g install serve
11 |
12 | WORKDIR /app
13 | COPY --from=builder /app/build .
14 | CMD ["serve", "-s", "-p", "8080"]
--------------------------------------------------------------------------------
/react-apollo-todo/Procfile:
--------------------------------------------------------------------------------
1 | web: npm start
2 |
--------------------------------------------------------------------------------
/react-apollo-todo/README.md:
--------------------------------------------------------------------------------
1 | ## Live demo
2 |
3 | [](https://codesandbox.io/s/github/hasura/sample-apps/tree/main/react-apollo-todo?fontsize=14)
4 |
5 | - [React App](https://react-apollo-todo.demo.hasura.app/)
6 | - [Hasura Console](https://react-apollo-todo.hasura.app/console)
7 |
8 | ## Tech stack
9 |
10 | - Frontend
11 |
12 | - React v0.16.3
13 | - Apollo Client 2.1
14 |
15 | - Backend
16 | - Hasura GraphQL Engine
17 |
18 | ## Run the React app
19 |
20 | Run `npm start` to start the todo app.
21 |
--------------------------------------------------------------------------------
/react-apollo-todo/cypress.env.json:
--------------------------------------------------------------------------------
1 | {
2 | "AUTH0_DOMAIN": "todo-hasura-test.auth0.com",
3 | "AUTH0_CLIENT_ID": "lgKxyHzCDUWCALdAOkjg3QI2D6eglGes",
4 | "AUTH0_USERNAME": "praveen@hasura.io",
5 | "AUTH0_PASSWORD": "praveen123@"
6 | }
--------------------------------------------------------------------------------
/react-apollo-todo/cypress.json:
--------------------------------------------------------------------------------
1 | {
2 | "baseUrl": "http://localhost:3000",
3 | "env": {
4 | "BASE_URL": "http://localhost:3000",
5 | "TEST_MODE": "parallel"
6 | },
7 | "ignoreTestFiles": ["*spec.js", "validators.js"],
8 | "viewportWidth": 1280,
9 | "viewportHeight": 720,
10 | "chromeWebSecurity": false,
11 | "video": false
12 | }
13 |
--------------------------------------------------------------------------------
/react-apollo-todo/cypress/fixtures/example.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Using fixtures to represent data",
3 | "email": "hello@cypress.io",
4 | "body": "Fixtures are a great way to mock data for responses to routes"
5 | }
6 |
--------------------------------------------------------------------------------
/react-apollo-todo/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/react-apollo-todo/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/react-apollo-todo/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/react-apollo-todo/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/react-apollo-todo/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/react-apollo-todo/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: SAMPLE_APPS_DATABASE_URL
7 | pool_settings:
8 | idle_timeout: 180
9 | max_connections: 50
10 | retries: 1
11 | tables:
12 | - "!include default/tables/public_online_users.yaml"
13 | - "!include default/tables/public_todos.yaml"
14 | - "!include default/tables/public_users.yaml"
15 | functions: []
16 |
--------------------------------------------------------------------------------
/react-apollo-todo/hasura/metadata/databases/default/tables/public_online_users.yaml:
--------------------------------------------------------------------------------
1 | select_permissions:
2 | - permission:
3 | columns:
4 | - name
5 | - last_seen
6 | filter: {}
7 | role: user
8 | table:
9 | name: online_users
10 | schema: public
11 |
--------------------------------------------------------------------------------
/react-apollo-todo/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/react-apollo-todo/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/react-apollo-todo/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/react-apollo-todo/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-apollo-todo/public/favicon.ico
--------------------------------------------------------------------------------
/react-apollo-todo/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-apollo-todo/public/favicon.png
--------------------------------------------------------------------------------
/react-apollo-todo/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/react-apollo-todo/src/components/Auth/auth0-variables.js:
--------------------------------------------------------------------------------
1 | import { authDomain, authClientId, callbackUrl } from "../../utils/constants";
2 |
3 | export const AUTH_CONFIG = {
4 | domain: authDomain,
5 | clientId: authClientId,
6 | callbackUrl: callbackUrl
7 | };
8 |
--------------------------------------------------------------------------------
/react-apollo-todo/src/images/React-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-apollo-todo/src/images/React-logo.png
--------------------------------------------------------------------------------
/react-apollo-todo/src/images/apollo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-apollo-todo/src/images/apollo.png
--------------------------------------------------------------------------------
/react-apollo-todo/src/images/auth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-apollo-todo/src/images/auth.png
--------------------------------------------------------------------------------
/react-apollo-todo/src/images/checked.svg:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/react-apollo-todo/src/images/graphql.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-apollo-todo/src/images/graphql.png
--------------------------------------------------------------------------------
/react-apollo-todo/src/images/right-img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-apollo-todo/src/images/right-img.png
--------------------------------------------------------------------------------
/react-apollo-todo/src/images/right-img1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-apollo-todo/src/images/right-img1.png
--------------------------------------------------------------------------------
/react-apollo-todo/src/index.js:
--------------------------------------------------------------------------------
1 | import ReactDOM from "react-dom";
2 | import { makeMainRoutes } from "./routes";
3 |
4 | const routes = makeMainRoutes();
5 | ReactDOM.render(routes, document.getElementById("root"));
6 |
--------------------------------------------------------------------------------
/react-apollo-todo/src/utils/history.js:
--------------------------------------------------------------------------------
1 | import createHistory from "history/createBrowserHistory";
2 |
3 | export default createHistory();
4 |
--------------------------------------------------------------------------------
/react-apollo-todo/src/utils/utils.js:
--------------------------------------------------------------------------------
1 | const getHeaders = () => {
2 | const token = localStorage.getItem("auth0:id_token");
3 | const headers = {
4 | authorization: token ? `Bearer ${token}` : ""
5 | };
6 | return headers;
7 | };
8 |
9 | export { getHeaders };
10 |
--------------------------------------------------------------------------------
/react-relay/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["relay"]
3 | }
4 |
--------------------------------------------------------------------------------
/react-relay/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/react-relay/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-relay/public/favicon.ico
--------------------------------------------------------------------------------
/react-relay/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-relay/public/logo192.png
--------------------------------------------------------------------------------
/react-relay/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-relay/public/logo512.png
--------------------------------------------------------------------------------
/react-relay/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/react-relay/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/react-relay/relay.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | // Configuration options accepted by the `relay-compiler` command-line tool and `babel-plugin-relay`.
3 | src: "./src",
4 | schema: "./schema.graphql",
5 | exclude: ["**/node_modules/**", "**/__mocks__/**", "**/__generated__/**"],
6 | };
7 |
--------------------------------------------------------------------------------
/react-relay/src/components/shared/Badge.js:
--------------------------------------------------------------------------------
1 | import styled from "@emotion/styled";
2 |
3 | export const Badge = styled.span`
4 | display: inline-block;
5 | padding: 0.5rem 1rem;
6 | font-size: 1.6rem;
7 | font-weight: 600;
8 | line-height: 1;
9 | text-align: center;
10 | white-space: nowrap;
11 | vertical-align: middle;
12 | border-radius: 0.25rem;
13 | color: #fff;
14 | background-color: #17a2b8;
15 | margin: 0 1rem;
16 | `;
17 |
--------------------------------------------------------------------------------
/react-relay/src/components/shared/InputForm.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import styled from "@emotion/styled";
3 | import { Input, Button } from "./Form";
4 |
5 | const Container = styled.div`
6 | display: flex;
7 | align-items: center;
8 | > button {
9 | margin-left: 1rem;
10 | }
11 | `;
12 |
13 | const InputForm = ({ inputVal, onChange, onSubmit, buttonText }) => {
14 | return (
15 |
16 |
17 |
18 |
19 | );
20 | };
21 |
22 | export default InputForm;
23 |
--------------------------------------------------------------------------------
/react-relay/src/components/shared/Logo.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import styled from "@emotion/styled";
3 |
4 | const LogoText = styled.h1`
5 | font-family: "Open Sans", "Helvetica Neue", sans-serif;
6 | font-size: 10rem;
7 | color: grey;
8 | margin: 0;
9 | text-align: center;
10 | `;
11 |
12 | const Logo = () => {
13 | return Demo;
14 | };
15 |
16 | export default Logo;
17 |
--------------------------------------------------------------------------------
/react-relay/src/fetchGraphQL.js:
--------------------------------------------------------------------------------
1 | async function fetchGraphQL(text, variables) {
2 | const response = await fetch(
3 | "https://[MY_HASURA_ENDPOINT_ROOT]/v1beta1/relay",
4 | {
5 | method: "POST",
6 | headers: {
7 | "Content-Type": "application/json",
8 | },
9 | body: JSON.stringify({
10 | query: text,
11 | variables,
12 | }),
13 | }
14 | );
15 |
16 | return await response.json();
17 | }
18 |
19 | export default fetchGraphQL;
20 |
--------------------------------------------------------------------------------
/react-relay/src/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import "./index.css";
4 | import App from "./App";
5 | import * as serviceWorker from "./serviceWorker";
6 |
7 | ReactDOM.render(
8 |
9 |
10 | ,
11 | document.getElementById("root")
12 | );
13 |
14 | // If you want your app to work offline and load faster, you can change
15 | // unregister() to register() below. Note this comes with some pitfalls.
16 | // Learn more about service workers: https://bit.ly/CRA-PWA
17 | serviceWorker.unregister();
18 |
--------------------------------------------------------------------------------
/react-static-graphql/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["react-static/babel-preset.js"]
3 | }
4 |
--------------------------------------------------------------------------------
/react-static-graphql/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: 'react-tools',
3 | }
4 |
--------------------------------------------------------------------------------
/react-static-graphql/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .next
3 | .cache
4 | dist
5 | .tempdist
6 | .DS_Store
7 | yarn-error.log
8 | .history
9 | tmp
10 |
--------------------------------------------------------------------------------
/react-static-graphql/assets/author_fk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-static-graphql/assets/author_fk.png
--------------------------------------------------------------------------------
/react-static-graphql/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 |
--------------------------------------------------------------------------------
/react-static-graphql/src/apollo.js:
--------------------------------------------------------------------------------
1 | import { ApolloClient } from 'apollo-client'
2 | import { HttpLink } from 'apollo-link-http'
3 | import { InMemoryCache } from 'apollo-cache-inmemory'
4 | import fetch from 'node-fetch'
5 |
6 | const client = new ApolloClient({
7 | link: new HttpLink({
8 | uri: 'http://localhost:8080/v1/graphql', // replace this with your own Hasura GraphQL Endpoint
9 | fetch
10 | }),
11 | cache: new InMemoryCache(),
12 | })
13 |
14 | export default client
--------------------------------------------------------------------------------
/react-static-graphql/src/app.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial,
3 | 'Lucida Grande', sans-serif;
4 | font-weight: 300;
5 | font-size: 16px;
6 | margin: 0;
7 | padding: 0;
8 | }
9 |
10 | a {
11 | text-decoration: none;
12 | color: #108db8;
13 | font-weight: bold;
14 | }
15 |
16 | img {
17 | max-width: 100%;
18 | }
19 |
20 | nav {
21 | width: 100%;
22 | background: #108db8;
23 | }
24 |
25 | nav a {
26 | color: white;
27 | padding: 1rem;
28 | display: inline-block;
29 | }
30 |
31 | .content {
32 | padding: 1rem;
33 | }
34 |
--------------------------------------------------------------------------------
/react-static-graphql/src/containers/Post.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withRouteData } from 'react-static'
3 | import { Link } from '@reach/router'
4 |
5 | export default withRouteData(({ articles }) => {
6 | const articlesList = articles.map((article, index) => {
7 | return (
8 |
9 |
{article.title}
10 |
{article.content}
11 |
12 | )}
13 | )
14 | return (
15 |
16 | {'<'} Back
17 |
18 | {articlesList.length ? articlesList : 'There are no posts by this author'}
19 |
20 | )}
21 | )
22 |
--------------------------------------------------------------------------------
/react-static-graphql/src/graphql/queries.js:
--------------------------------------------------------------------------------
1 | import gql from "graphql-tag";
2 |
3 | const GET_AUTHOR = gql`
4 | query {
5 | author {
6 | id
7 | name
8 | }
9 | }
10 | `;
11 |
12 | const GET_ARTICLE = gql`
13 | query($author: Int!) {
14 | article(where: {author_id: {_eq: $author}}) {
15 | id
16 | title
17 | content
18 | created_at
19 | }
20 | }
21 | `;
22 |
23 | export { GET_ARTICLE, GET_AUTHOR };
--------------------------------------------------------------------------------
/react-static-graphql/src/pages/404.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | export default () => (
4 |
5 |
404 - Oh no's! We couldn't find that page :(
6 |
7 | )
8 |
--------------------------------------------------------------------------------
/react-static-graphql/src/pages/about.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | export default () => (
4 |
5 |
React Static is a progressive static site generator for React.
6 |
7 | )
8 |
--------------------------------------------------------------------------------
/react-static-graphql/src/pages/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { withSiteData } from 'react-static'
3 |
4 | export default withSiteData(() => (
5 |
6 |
Welcome to React-Static
7 |
This demo integrates Hasura GraphQL Engine and allows you to generate static sites with your Postgres database using GraphQL
8 |
9 | ))
10 |
--------------------------------------------------------------------------------
/react-weather-analytics-app/README.md:
--------------------------------------------------------------------------------
1 | ## Tech stack
2 |
3 | - Frontend
4 |
5 | - React v16.8.3
6 | - Apollo Client 2.6.10
7 |
8 | - Backend
9 | - Hasura GraphQL Engine
10 |
11 | ## Run the React app
12 |
13 | Follow the instructions in this [blog](https://hasura.io/blog/get-graphql-api-on-snowflake-with-hasura-sample-app/) to set up your Snowflake as a prerequisite.
14 | Post that, run `npm install` and `npm start` to start the analytics app.
15 |
16 | We have showcased a bar chart in this example; you can easily add the other types with minimal changes.
17 | You can read more here, https://github.com/hasura/graphql2chartjs
18 |
--------------------------------------------------------------------------------
/react-weather-analytics-app/app/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | build
3 |
--------------------------------------------------------------------------------
/react-weather-analytics-app/app/README.md:
--------------------------------------------------------------------------------
1 | To run this example:
2 |
3 | ```
4 | npm install
5 | npm start
6 | ```
7 |
--------------------------------------------------------------------------------
/react-weather-analytics-app/app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/react-weather-analytics-app/app/public/favicon.ico
--------------------------------------------------------------------------------
/react-weather-analytics-app/app/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": ".",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/react-weather-analytics-app/app/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './App.css';
3 | import NavBar from './Navbar';
4 |
5 | import {
6 | BasicBarChart,
7 | StyledBarChart,
8 | MultiDatasetBarChart,
9 | MixedLineBarChart,
10 | LiveChart,
11 | RealtimeTimeseriesChart
12 | } from './charts';
13 |
14 | const App = () => (
15 |
21 | );
22 |
23 | export default App;
24 |
--------------------------------------------------------------------------------
/react-weather-analytics-app/app/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/react-weather-analytics-app/app/src/charts/index.js:
--------------------------------------------------------------------------------
1 | export { BasicBarChart } from './BasicBarChart';
2 | export { StyledBarChart } from './StyledBarChart';
3 | export { MultiDatasetBarChart } from './MultiDatasetBarChart';
4 | export { MixedLineBarChart } from './MixedLineBarChart';
5 | export { LiveChart } from './LiveChart';
6 | export { RealtimeTimeseriesChart } from './RealtimeTimeseriesChart';
7 |
--------------------------------------------------------------------------------
/react-weather-analytics-app/app/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
5 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
6 | sans-serif;
7 | -webkit-font-smoothing: antialiased;
8 | -moz-osx-font-smoothing: grayscale;
9 | }
10 |
11 | code {
12 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
13 | monospace;
14 | }
15 |
--------------------------------------------------------------------------------
/react-weather-analytics-app/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080
3 | metadata_directory: metadata
4 | actions:
5 | kind: synchronous
6 | handler_webhook_baseurl: http://localhost:3000
7 |
--------------------------------------------------------------------------------
/realtime-chat-vue/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not ie <= 8
4 |
--------------------------------------------------------------------------------
/realtime-chat-vue/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true
5 | },
6 | extends: ["plugin:vue/essential"],
7 | rules: {
8 | "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
9 | "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
10 | },
11 | parserOptions: {
12 | parser: "babel-eslint"
13 | }
14 | };
15 |
--------------------------------------------------------------------------------
/realtime-chat-vue/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw*
22 |
--------------------------------------------------------------------------------
/realtime-chat-vue/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ["@vue/app"]
3 | };
4 |
--------------------------------------------------------------------------------
/realtime-chat-vue/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | autoprefixer: {}
4 | }
5 | };
6 |
--------------------------------------------------------------------------------
/realtime-chat-vue/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat-vue/public/favicon.ico
--------------------------------------------------------------------------------
/realtime-chat-vue/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/realtime-chat-vue/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat-vue/src/assets/logo.png
--------------------------------------------------------------------------------
/realtime-chat-vue/src/components/Banner.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | You have {{numOfNewMessages}} new message(s)
4 |
5 |
6 |
7 |
18 |
19 |
--------------------------------------------------------------------------------
/realtime-chat-vue/src/graphql/AddUserMutation.gql:
--------------------------------------------------------------------------------
1 | mutation ($username: String!) {
2 | insert_user (
3 | objects: [{
4 | username: $username
5 | }]
6 | ) {
7 | returning {
8 | id
9 | username
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/realtime-chat-vue/src/graphql/emitOnlineEvent.gql:
--------------------------------------------------------------------------------
1 | mutation ($userId:Int!){
2 | update_user (
3 | _set: {
4 | last_seen: "now()"
5 | }
6 | where: {
7 | id: {
8 | _eq: $userId
9 | }
10 | }
11 | ) {
12 | affected_rows
13 | }
14 | }
--------------------------------------------------------------------------------
/realtime-chat-vue/src/graphql/emitTypingEvent.gql:
--------------------------------------------------------------------------------
1 | mutation ($userId: Int) {
2 | update_user (
3 | _set: {
4 | last_typed: "now()"
5 | }
6 | where: {
7 | id: {
8 | _eq: $userId
9 | }
10 | }
11 | ) {
12 | affected_rows
13 | }
14 | }
--------------------------------------------------------------------------------
/realtime-chat-vue/src/graphql/fetchMessages.gql:
--------------------------------------------------------------------------------
1 | query ($last_received_id: Int, $last_received_ts: timestamptz){
2 | message (
3 | order_by: {timestamp:asc}
4 | where: {
5 | _and: {
6 | id: {
7 | _neq: $last_received_id
8 | },
9 | timestamp: {
10 | _gte: $last_received_ts
11 | }
12 | }
13 | }
14 | ) {
15 | id
16 | text
17 | username
18 | timestamp
19 | }
20 | }
--------------------------------------------------------------------------------
/realtime-chat-vue/src/graphql/fetchOnlineUsersSubscription.gql:
--------------------------------------------------------------------------------
1 | subscription {
2 | user_online (
3 | order_by: {username:asc}
4 | ) {
5 | id
6 | username
7 | }
8 | }
--------------------------------------------------------------------------------
/realtime-chat-vue/src/graphql/getUserTyping.gql:
--------------------------------------------------------------------------------
1 | subscription ($selfId: Int ) {
2 | user_typing (
3 | where: {
4 | id: {
5 | _neq: $selfId
6 | }
7 | },
8 | limit: 1
9 | order_by: {last_typed:desc}
10 | ){
11 | last_typed
12 | username
13 | }
14 | }
--------------------------------------------------------------------------------
/realtime-chat-vue/src/graphql/insertMessage.gql:
--------------------------------------------------------------------------------
1 | mutation insert_message ($message: message_insert_input! ){
2 | insert_message (
3 | objects: [$message]
4 | ) {
5 | returning {
6 | id
7 | timestamp
8 | text
9 | username
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/realtime-chat-vue/src/graphql/subscribeToNewMessages.gql:
--------------------------------------------------------------------------------
1 | subscription {
2 | message ( order_by: {id:desc} limit: 1) {
3 | id
4 | username
5 | text
6 | timestamp
7 | }
8 | }
--------------------------------------------------------------------------------
/realtime-chat-vue/src/images/Vue-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat-vue/src/images/Vue-logo.png
--------------------------------------------------------------------------------
/realtime-chat-vue/src/images/apollo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat-vue/src/images/apollo.png
--------------------------------------------------------------------------------
/realtime-chat-vue/src/images/auth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat-vue/src/images/auth.png
--------------------------------------------------------------------------------
/realtime-chat-vue/src/images/chat-app-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat-vue/src/images/chat-app-bg.jpg
--------------------------------------------------------------------------------
/realtime-chat-vue/src/images/chat-app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat-vue/src/images/chat-app.png
--------------------------------------------------------------------------------
/realtime-chat-vue/src/images/graphql.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat-vue/src/images/graphql.png
--------------------------------------------------------------------------------
/realtime-chat-vue/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from "vue";
2 | import App from "./App.vue";
3 | import router from "./router";
4 | import store from "./store";
5 | import style from "./App.css";
6 | import { createProvider } from "./vue-apollo";
7 | Vue.config.productionTip = false;
8 |
9 | new Vue({
10 | router,
11 | style,
12 | store,
13 | apolloProvider: createProvider(),
14 | render: h => h(App)
15 | }).$mount("#app");
16 |
--------------------------------------------------------------------------------
/realtime-chat-vue/src/store.js:
--------------------------------------------------------------------------------
1 | import Vue from "vue";
2 | import Vuex from "vuex";
3 |
4 | Vue.use(Vuex);
5 |
6 | export default new Vuex.Store({
7 | state: {},
8 | mutations: {},
9 | actions: {}
10 | });
11 |
--------------------------------------------------------------------------------
/realtime-chat/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 |
--------------------------------------------------------------------------------
/realtime-chat/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:16 as builder
2 | ENV NODE_ENV=PRODUCTION
3 | WORKDIR /app
4 | COPY package.json ./
5 | RUN npm install
6 | COPY . .
7 | RUN npm run build
8 |
9 | FROM node:16-alpine
10 | RUN npm -g install serve
11 |
12 | WORKDIR /app
13 | COPY --from=builder /app/build .
14 | CMD ["serve", "-s", "-p", "3000"]
--------------------------------------------------------------------------------
/realtime-chat/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: PG_DATABASE_URL
7 | pool_settings:
8 | idle_timeout: 180
9 | max_connections: 50
10 | retries: 1
11 | tables:
12 | - "!include default/tables/public_message.yaml"
13 | - "!include default/tables/public_user.yaml"
14 | - "!include default/tables/public_user_online.yaml"
15 | - "!include default/tables/public_user_typing.yaml"
16 | functions: []
17 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/databases/default/tables/public_message.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: message
3 | schema: public
4 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/databases/default/tables/public_user.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: user
3 | schema: public
4 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/databases/default/tables/public_user_online.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: user_online
3 | schema: public
4 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/databases/default/tables/public_user_typing.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: user_typing
3 | schema: public
4 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-chat/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/realtime-chat/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat/public/favicon.ico
--------------------------------------------------------------------------------
/realtime-chat/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat/public/favicon.png
--------------------------------------------------------------------------------
/realtime-chat/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Realtime Group Chat",
3 | "name": "Realtime Group Chat Powered by Hasura",
4 | "icons": [
5 | {
6 | "src": "favicon.png",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-png"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/realtime-chat/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Main from './components/Main';
3 | import './App.css' ;
4 |
5 | const App = () => {
6 | return
;
7 | }
8 |
9 | export default App;
10 |
--------------------------------------------------------------------------------
/realtime-chat/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/realtime-chat/src/components/Banner.js:
--------------------------------------------------------------------------------
1 | import '../App.css';
2 |
3 | const Banner = (props) => {
4 | return (
5 |
6 | You have {props.numOfNewMessages} new message(s)
7 |
8 | );
9 | };
10 |
11 | export default Banner;
12 |
--------------------------------------------------------------------------------
/realtime-chat/src/hasura_logo_200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat/src/hasura_logo_200.png
--------------------------------------------------------------------------------
/realtime-chat/src/images/React-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat/src/images/React-logo.png
--------------------------------------------------------------------------------
/realtime-chat/src/images/apollo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat/src/images/apollo.png
--------------------------------------------------------------------------------
/realtime-chat/src/images/auth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat/src/images/auth.png
--------------------------------------------------------------------------------
/realtime-chat/src/images/chat-app-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat/src/images/chat-app-bg.jpg
--------------------------------------------------------------------------------
/realtime-chat/src/images/chat-app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat/src/images/chat-app.png
--------------------------------------------------------------------------------
/realtime-chat/src/images/graphql.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-chat/src/images/graphql.png
--------------------------------------------------------------------------------
/realtime-chat/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | font-family: sans-serif;
5 | }
6 |
--------------------------------------------------------------------------------
/realtime-chat/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = (onPerfEntry) => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/realtime-location-tracking/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_GOOGLE_API_KEY=AIzaSyDLbYz4-IjX3xW4PcUg8RksjAKiT96Z1uo
2 |
--------------------------------------------------------------------------------
/realtime-location-tracking/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 |
23 | # editor
24 | .idea/
25 |
26 | package-lock.json
27 |
--------------------------------------------------------------------------------
/realtime-location-tracking/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:16 as builder
2 | ENV NODE_ENV=PRODUCTION
3 | WORKDIR /app
4 | COPY package.json ./
5 | RUN npm install --production
6 | COPY . .
7 | RUN npm run build
8 |
9 | FROM node:16-alpine
10 | RUN npm -g install serve
11 |
12 | WORKDIR /app
13 | COPY --from=builder /app/build .
14 | CMD ["serve", "-p", "8080"]
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080
3 | metadata_directory: metadata
4 | actions:
5 | kind: synchronous
6 | handler_webhook_baseurl: http://localhost:3000
7 |
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: PG_DATABASE_URL
7 | pool_settings:
8 | idle_timeout: 180
9 | max_connections: 50
10 | retries: 1
11 | tables:
12 | - "!include default/tables/public_vehicle.yaml"
13 | - "!include default/tables/public_vehicle_location.yaml"
14 | functions: []
15 |
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/metadata/databases/default/tables/public_vehicle.yaml:
--------------------------------------------------------------------------------
1 | array_relationships:
2 | - name: locations
3 | using:
4 | foreign_key_constraint_on:
5 | column: vehicle_id
6 | table:
7 | name: vehicle_location
8 | schema: public
9 | table:
10 | name: vehicle
11 | schema: public
12 |
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/metadata/databases/default/tables/public_vehicle_location.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: vehicle_location
3 | schema: public
4 |
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-location-tracking/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/realtime-location-tracking/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-location-tracking/public/favicon.ico
--------------------------------------------------------------------------------
/realtime-location-tracking/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-location-tracking/public/favicon.png
--------------------------------------------------------------------------------
/realtime-location-tracking/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/realtime-location-tracking/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/realtime-location-tracking/src/assets/carbon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-location-tracking/src/assets/carbon.png
--------------------------------------------------------------------------------
/realtime-location-tracking/src/assets/hasura.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-location-tracking/src/assets/hasura.png
--------------------------------------------------------------------------------
/realtime-location-tracking/src/hooks/usePrevious.js:
--------------------------------------------------------------------------------
1 | // Example from https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
2 |
3 | import { useEffect, useRef } from 'react';
4 |
5 | export function usePrevious(value) {
6 | const reference = useRef();
7 |
8 | useEffect(() => {
9 | reference.current = value;
10 | }, [value]);
11 |
12 | return reference.current;
13 | }
--------------------------------------------------------------------------------
/realtime-location-tracking/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | font-family: sans-serif;
5 | }
6 |
--------------------------------------------------------------------------------
/realtime-location-tracking/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
5 | import Vehicle from './Vehicle/Vehicle';
6 |
7 | // Use the client just as before
8 | // import { BrowserRouter as Router, Route } from 'react-router-dom';
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('root'));
13 |
--------------------------------------------------------------------------------
/realtime-poll/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
--------------------------------------------------------------------------------
/realtime-poll/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 |
23 | package-lock.json
24 |
--------------------------------------------------------------------------------
/realtime-poll/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:carbon as builder
2 | ENV NODE_ENV=PRODUCTION
3 | WORKDIR /app
4 | COPY package.json ./
5 | RUN npm install --production
6 | COPY . .
7 | RUN npm run build
8 |
9 | FROM node:8-alpine
10 | RUN npm -g install serve
11 |
12 | WORKDIR /app
13 | COPY --from=builder /app/build .
14 | CMD ["serve", "-p", "8080"]
--------------------------------------------------------------------------------
/realtime-poll/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/databases/default/tables/public_online_users.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: online_users
3 | schema: public
4 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/databases/default/tables/public_option.yaml:
--------------------------------------------------------------------------------
1 | object_relationships:
2 | - name: poll
3 | using:
4 | foreign_key_constraint_on: poll_id
5 | table:
6 | name: option
7 | schema: public
8 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/databases/default/tables/public_poll.yaml:
--------------------------------------------------------------------------------
1 | array_relationships:
2 | - name: options
3 | using:
4 | foreign_key_constraint_on:
5 | column: poll_id
6 | table:
7 | name: option
8 | schema: public
9 | table:
10 | name: poll
11 | schema: public
12 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/databases/default/tables/public_poll_results.yaml:
--------------------------------------------------------------------------------
1 | object_relationships:
2 | - name: option
3 | using:
4 | manual_configuration:
5 | column_mapping:
6 | option_id: id
7 | remote_table:
8 | name: option
9 | schema: public
10 | - name: poll
11 | using:
12 | manual_configuration:
13 | column_mapping:
14 | poll_id: id
15 | remote_table:
16 | name: poll
17 | schema: public
18 | table:
19 | name: poll_results
20 | schema: public
21 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/databases/default/tables/public_user.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: user
3 | schema: public
4 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/databases/default/tables/public_vote.yaml:
--------------------------------------------------------------------------------
1 | object_relationships:
2 | - name: created_by_user
3 | using:
4 | foreign_key_constraint_on: created_by_user_id
5 | - name: option
6 | using:
7 | foreign_key_constraint_on: option_id
8 | table:
9 | name: vote
10 | schema: public
11 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/realtime-poll/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/realtime-poll/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-poll/public/favicon.ico
--------------------------------------------------------------------------------
/realtime-poll/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-poll/public/favicon.png
--------------------------------------------------------------------------------
/realtime-poll/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Hasura Realtime Poll",
3 | "name": "Realtime Poll App Powered by Hasura GraphQL Engine",
4 | "icons": [
5 | {
6 | "src": "favicon.png",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/realtime-poll/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/realtime-poll/src/img/hasura_logo_200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/realtime-poll/src/img/hasura_logo_200.png
--------------------------------------------------------------------------------
/realtime-poll/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | font-family: sans-serif;
5 | }
6 |
--------------------------------------------------------------------------------
/realtime-poll/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 |
6 | ReactDOM.render(, document.getElementById('root'));
7 |
--------------------------------------------------------------------------------
/serverless-etl/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nginx:alpine
2 |
3 | COPY *.png *.html *.css *.js /usr/share/nginx/html/
--------------------------------------------------------------------------------
/serverless-etl/arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/serverless-etl/arch.png
--------------------------------------------------------------------------------
/serverless-etl/cloudfunction/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .env.yaml
--------------------------------------------------------------------------------
/serverless-etl/cloudfunction/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "message_event_handler",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "algoliasearch": "^3.30.0"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/serverless-etl/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/serverless-etl/favicon.png
--------------------------------------------------------------------------------
/serverless-etl/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/serverless-etl/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/serverless-etl/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/serverless-etl/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/serverless-etl/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/serverless-etl/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: SAMPLE_APPS_DATABASE_URL
7 | pool_settings:
8 | idle_timeout: 180
9 | max_connections: 50
10 | retries: 1
11 | tables:
12 | - "!include default/tables/public_book.yaml"
13 | functions: []
14 |
--------------------------------------------------------------------------------
/serverless-etl/hasura/metadata/databases/default/tables/public_book.yaml:
--------------------------------------------------------------------------------
1 | event_triggers:
2 | - definition:
3 | insert:
4 | columns:
5 | - title
6 | - author
7 | - id
8 | - created_at
9 | name: book_event
10 | retry_conf:
11 | interval_sec: 10
12 | num_retries: 0
13 | webhook: https://us-central1-hasura-test.cloudfunctions.net/serverless-etl
14 | table:
15 | name: book
16 | schema: public
17 |
--------------------------------------------------------------------------------
/serverless-etl/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/serverless-etl/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/serverless-etl/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/serverless-etl/hasura_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/serverless-etl/hasura_logo.png
--------------------------------------------------------------------------------
/serverless-etl/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "serverless-etl-hasura",
3 | "version": "1.0.0",
4 | "description": "Serverless ETL demo using Hasura GraphQL Engine Event Triggers and Algolia Search",
5 | "main": "index.html",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "https://github.com/hasura/graphql-engine"
12 | },
13 | "keywords": [],
14 | "author": "Praveen",
15 | "license": "MIT"
16 | }
--------------------------------------------------------------------------------
/serverless-push/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nginx:alpine
2 |
3 | COPY *.png *.html *.css *.js *.json /usr/share/nginx/html/
--------------------------------------------------------------------------------
/serverless-push/arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/serverless-push/arch.png
--------------------------------------------------------------------------------
/serverless-push/cloudfunction/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .env.yaml
--------------------------------------------------------------------------------
/serverless-push/cloudfunction/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "message_event_handler",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "node-fetch": "^2.2.0"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/serverless-push/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/serverless-push/favicon.png
--------------------------------------------------------------------------------
/serverless-push/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/serverless-push/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/serverless-push/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/serverless-push/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/serverless-push/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/serverless-push/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: SAMPLE_APPS_DATABASE_URL
7 | pool_settings:
8 | idle_timeout: 180
9 | max_connections: 50
10 | retries: 1
11 | tables:
12 | - "!include default/tables/public_message.yaml"
13 | functions: []
14 |
--------------------------------------------------------------------------------
/serverless-push/hasura/metadata/databases/default/tables/public_message.yaml:
--------------------------------------------------------------------------------
1 | event_triggers:
2 | - definition:
3 | insert:
4 | columns:
5 | - title
6 | - body
7 | - device_token
8 | - id
9 | - timestamp
10 | name: message_event
11 | retry_conf:
12 | interval_sec: 10
13 | num_retries: 0
14 | webhook: https://us-central1-hasura-test.cloudfunctions.net/push-notification
15 | table:
16 | name: message
17 | schema: public
18 |
--------------------------------------------------------------------------------
/serverless-push/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/serverless-push/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/serverless-push/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/serverless-push/hasura/migrations/default/1613664119718_init/up.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE public.message (
2 | id uuid DEFAULT public.gen_random_uuid() NOT NULL,
3 | "timestamp" timestamp with time zone DEFAULT now() NOT NULL,
4 | title text NOT NULL,
5 | body text,
6 | device_token text NOT NULL
7 | );
8 | ALTER TABLE ONLY public.message
9 | ADD CONSTRAINT message_pkey PRIMARY KEY (id);
10 |
--------------------------------------------------------------------------------
/serverless-push/hasura_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/serverless-push/hasura_logo.png
--------------------------------------------------------------------------------
/serverless-push/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "gcm_sender_id": "103953800507"
3 | }
4 |
--------------------------------------------------------------------------------
/serverless-push/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "serverless-push-hasura",
3 | "version": "1.0.0",
4 | "description": "Web notifications using Hasura GraphQL Engine Event Triggers and FCM",
5 | "main": "index.html",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "https://github.com/hasura/graphql-engine"
12 | },
13 | "keywords": [],
14 | "author": "Praveen",
15 | "license": "MIT"
16 | }
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | hasura/
3 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 | .env
23 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:16 as builder
2 | ENV NODE_ENV=PRODUCTION
3 | WORKDIR /app
4 | COPY package.json ./
5 | COPY package-lock.json ./
6 | RUN npm install
7 | COPY . .
8 | RUN npm run build
9 |
10 | FROM node:16-alpine
11 | RUN npm -g install serve
12 |
13 | WORKDIR /app
14 | COPY --from=builder /app/build .
15 | CMD ["serve", "-s", "-p", "3000"]
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: PG_DATABASE_URL
7 | pool_settings:
8 | idle_timeout: 180
9 | max_connections: 50
10 | retries: 1
11 | tables:
12 | - "!include default/tables/public_message.yaml"
13 | - "!include default/tables/public_user.yaml"
14 | - "!include default/tables/public_user_online.yaml"
15 | - "!include default/tables/public_user_typing.yaml"
16 | functions: []
17 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/databases/default/tables/public_message.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: message
3 | schema: public
4 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/databases/default/tables/public_user.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: user
3 | schema: public
4 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/databases/default/tables/public_user_online.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: user_online
3 | schema: public
4 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/databases/default/tables/public_user_typing.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: user_typing
3 | schema: public
4 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/streaming-subscriptions-chat/public/favicon.ico
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/streaming-subscriptions-chat/public/favicon.png
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Realtime Group Chat",
3 | "name": "Realtime Group Chat Powered by Hasura",
4 | "icons": [
5 | {
6 | "src": "favicon.png",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-png"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import Main from './components/Main';
4 | import './App.css';
5 |
6 | const App = () => {
7 | return ;
8 | };
9 |
10 | export default App;
11 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/components/Banner.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | import { StyledBanner } from '../styles/StyledChatApp';
4 | import '../App.css';
5 |
6 | const Banner = (props) => {
7 | return (
8 |
9 | You have {props.numOfNewMessages} new message(s)
10 |
11 | );
12 | };
13 |
14 | export default Banner;
15 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/hasura_logo_200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/streaming-subscriptions-chat/src/hasura_logo_200.png
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/images/React-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/streaming-subscriptions-chat/src/images/React-logo.png
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/images/auth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/streaming-subscriptions-chat/src/images/auth.png
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/images/chat-app-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/streaming-subscriptions-chat/src/images/chat-app-bg.jpg
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/images/chat-app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/streaming-subscriptions-chat/src/images/chat-app.png
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/images/graphql.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/streaming-subscriptions-chat/src/images/graphql.png
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | font-family: sans-serif;
5 | }
6 |
--------------------------------------------------------------------------------
/streaming-subscriptions-chat/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = (onPerfEntry) => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/svelte-apollo/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | public/bundle.*
4 |
--------------------------------------------------------------------------------
/svelte-apollo/now.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 2,
3 | "builds": [
4 | { "src": "package.json", "use": "@now/static-build", "config": { "distDir": "public" } }
5 | ]
6 | }
--------------------------------------------------------------------------------
/svelte-apollo/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/svelte-apollo/public/favicon.png
--------------------------------------------------------------------------------
/svelte-apollo/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Svelte app
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/svelte-apollo/src/main.js:
--------------------------------------------------------------------------------
1 | import App from './App.svelte';
2 |
3 | const app = new App({
4 | target: document.body,
5 | });
6 |
7 | export default app;
--------------------------------------------------------------------------------
/tic-tac-toe-react/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env
17 | .env.local
18 | .env.development.local
19 | .env.test.local
20 | .env.production.local
21 |
22 | npm-debug.log*
23 | yarn-debug.log*
24 | yarn-error.log*
25 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/client/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:carbon as builder
2 |
3 | ENV NODE_ENV=PRODUCTION
4 |
5 | WORKDIR /app
6 |
7 | COPY package.json ./
8 |
9 | RUN npm install
10 |
11 | COPY . .
12 |
13 | RUN npm run build
14 |
15 | FROM node:8-alpine
16 |
17 | RUN npm -g install serve
18 |
19 | WORKDIR /app
20 |
21 | COPY --from=builder /app/build .
22 |
23 | EXPOSE 8000
24 |
25 | CMD ["serve", "-s", "-p", "8000"]
26 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/client/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/tic-tac-toe-react/client/public/favicon.png
--------------------------------------------------------------------------------
/tic-tac-toe-react/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": ".",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/client/src/components/Utils.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Spinner } from 'react-bootstrap';
3 |
4 | export const LoadingIndicator = () => {
5 | return (
6 |
7 |
8 |
9 | )
10 | };
11 |
12 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
5 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
6 | sans-serif;
7 | -webkit-font-smoothing: antialiased;
8 | -moz-osx-font-smoothing: grayscale;
9 | color: #565656;
10 | }
11 |
12 | code {
13 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
14 | monospace;
15 | }
16 |
17 | h2 {
18 | color: #565656;
19 | }
20 |
21 | a {
22 | text-decoration: all;
23 | }
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: SAMPLE_APPS_DATABASE_URL
7 | pool_settings:
8 | idle_timeout: 180
9 | max_connections: 50
10 | retries: 1
11 | tables:
12 | - "!include default/tables/public_board.yaml"
13 | - "!include default/tables/public_move.yaml"
14 | - "!include default/tables/public_user.yaml"
15 | functions: []
16 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/databases/default/tables/public_board.yaml:
--------------------------------------------------------------------------------
1 | array_relationships:
2 | - name: moves
3 | using:
4 | foreign_key_constraint_on:
5 | column: board_id
6 | table:
7 | name: move
8 | schema: public
9 | object_relationships:
10 | - name: user1
11 | using:
12 | foreign_key_constraint_on: user_1_id
13 | - name: user2
14 | using:
15 | foreign_key_constraint_on: user_2_id
16 | table:
17 | name: board
18 | schema: public
19 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/databases/default/tables/public_move.yaml:
--------------------------------------------------------------------------------
1 | object_relationships:
2 | - name: user
3 | using:
4 | foreign_key_constraint_on: user_id
5 | table:
6 | name: move
7 | schema: public
8 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/databases/default/tables/public_user.yaml:
--------------------------------------------------------------------------------
1 | table:
2 | name: user
3 | schema: public
4 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | - name: tic-tac-toe
2 | definition:
3 | url_from_env: TIC_TAC_REMOTE_SCHEMA_URL
4 | timeout_seconds: 60
5 | forward_client_headers: true
6 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/remote-schema/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/remote-schema/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/remote-schema/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:alpine
2 |
3 | WORKDIR /app
4 |
5 | COPY package*.json ./
6 |
7 | RUN npm install
8 |
9 | COPY ./* /app/
10 |
11 | CMD ["npm", "start"]
12 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/remote-schema/README.md:
--------------------------------------------------------------------------------
1 | This is a remote schema that makes the `tic-tac-toe` move as a transaction.
2 |
--------------------------------------------------------------------------------
/tic-tac-toe-react/remote-schema/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "remote-schema-example",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "dependencies": {
7 | "apollo-server": "^2.4.8",
8 | "graphql": "^14.2.1",
9 | "graphql-tools": "^4.0.4",
10 | "knex": "^0.16.5",
11 | "node-fetch": "^2.3.0",
12 | "pg": "^7.10.0"
13 | },
14 | "scripts": {
15 | "start": "node -r esm index.js"
16 | },
17 | "devDependencies": {
18 | "esm": "^3.2.22"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/.dockerignore:
--------------------------------------------------------------------------------
1 | package-lock.json
2 | node_modules
3 | .gitignore
4 | exec.sh
5 | exec.ps1
6 | README.md
7 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/.gitignore:
--------------------------------------------------------------------------------
1 | ws
2 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: SAMPLE_APPS_DATABASE_URL
7 | pool_settings:
8 | idle_timeout: 180
9 | max_connections: 50
10 | retries: 1
11 | tables:
12 | - "!include default/tables/public_todo.yaml"
13 | functions: []
14 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/hasura/migrations/default/1613665146384_init/up.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE public.todo (
2 | id integer NOT NULL,
3 | task text NOT NULL,
4 | completed boolean NOT NULL,
5 | user_id text NOT NULL
6 | );
7 | CREATE SEQUENCE public.todo_id_seq
8 | AS integer
9 | START WITH 1
10 | INCREMENT BY 1
11 | NO MINVALUE
12 | NO MAXVALUE
13 | CACHE 1;
14 | ALTER SEQUENCE public.todo_id_seq OWNED BY public.todo.id;
15 | ALTER TABLE ONLY public.todo ALTER COLUMN id SET DEFAULT nextval('public.todo_id_seq'::regclass);
16 | ALTER TABLE ONLY public.todo
17 | ADD CONSTRAINT todo_pkey PRIMARY KEY (id);
18 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | node_modules
5 |
6 | # testing
7 | coverage
8 |
9 | # production
10 | build
11 |
12 | # misc
13 | .DS_Store
14 | .env
15 | npm-debug.log
16 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:8.7-alpine
2 |
3 | WORKDIR /home/app
4 |
5 | RUN npm install -g create-react-app
6 | ADD package.json /home/app
7 | RUN npm install
8 | ADD . /home/app
9 |
10 | CMD ["npm", "start"]
11 |
12 | EXPOSE 3000
13 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/exec.ps1:
--------------------------------------------------------------------------------
1 | docker build -t auth0-react-01-login .
2 | docker run -p 3000:3000 -it auth0-react-01-login
3 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/exec.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | docker build -t auth0-react-01-login .
3 | docker run -p 3000:3000 -it auth0-react-01-login
4 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/todo-auth0-jwt/todo-app/public/favicon.ico
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/src/App.css:
--------------------------------------------------------------------------------
1 | .btn-margin {
2 | margin: 7px 3px;
3 | }
4 |
5 | .center {
6 | display: flex;
7 | align-items: center;
8 | justify-content: center;
9 | }
10 |
11 | .container {
12 | padding-top: 50px;
13 | }
14 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | });
9 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/src/Auth/auth0-variables.js:
--------------------------------------------------------------------------------
1 | import {
2 | authDomain,
3 | authClientId
4 | } from '../constants';
5 |
6 | export const AUTH_CONFIG = {
7 | domain: authDomain,
8 | clientId: authClientId,
9 | callbackUrl: 'http://localhost:3000/callback'
10 | };
11 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/src/Todo/TodoComponent.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './Todo.css';
3 | import TodoInput from './TodoInput';
4 | import TodoList from './TodoList';
5 |
6 | export default class TodoComponent extends React.Component {
7 |
8 | render() {
9 | const userId = localStorage.getItem('auth0:id_token:sub');
10 | return (
11 |
12 |
Todos
13 |
14 |
15 |
16 | )
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/src/constants.js:
--------------------------------------------------------------------------------
1 | export const GRAPHQL_URL = 'https://hasura-todo-auth0-jwt.hasura.app/v1/graphql';
2 | export const authClientId = "xxxxxxxxxxxxxxxxxxxxx";
3 | export const authDomain = ".auth0.com";
4 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/src/history.js:
--------------------------------------------------------------------------------
1 | import createHistory from 'history/createBrowserHistory'
2 |
3 | export default createHistory()
4 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | font-family: sans-serif;
5 | }
6 |
--------------------------------------------------------------------------------
/todo-auth0-jwt/todo-app/src/index.js:
--------------------------------------------------------------------------------
1 | import ReactDOM from 'react-dom';
2 | import './index.css';
3 | import 'bootstrap/dist/css/bootstrap.css';
4 | import { makeMainRoutes } from './routes';
5 |
6 | const routes = makeMainRoutes();
7 | ReactDOM.render(
8 | routes,
9 | document.getElementById('root')
10 | );
11 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw*
22 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not ie <= 8
4 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | .git
3 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/.gitignore:
--------------------------------------------------------------------------------
1 | dist/
2 |
3 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/auth_config.json:
--------------------------------------------------------------------------------
1 | {
2 | "domain": "",
3 | "clientId": ""
4 | }
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ["@vue/app"]
3 | };
4 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/exec.ps1:
--------------------------------------------------------------------------------
1 | docker build --rm -t auth0-vue-01-login .
2 | docker run -p 3000:3000 --pid=host auth0-vue-01-login
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/exec.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | docker build --rm -t auth0-vue-01-login .
4 | docker run -p 3000:3000 --pid=host auth0-vue-01-login
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | autoprefixer: {}
4 | }
5 | };
6 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuejs-auth0-graphql/app/public/favicon.ico
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/public/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuejs-auth0-graphql/app/public/logo.png
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/server.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-console */
2 | const express = require("express");
3 | const { join } = require("path");
4 | const morgan = require("morgan");
5 | const app = express();
6 |
7 | app.use(morgan("dev"));
8 | app.use(express.static(join(__dirname, "dist")));
9 |
10 | app.use((_, res) => {
11 | res.sendFile(join(__dirname, "dist", "index.html"));
12 | });
13 |
14 | app.listen(3000, () => console.log("Listening on port 3000"));
15 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/src/plugins/auth.js:
--------------------------------------------------------------------------------
1 | import authService from "../auth/authService";
2 |
3 | export default {
4 | install(Vue) {
5 | Vue.prototype.$auth = authService;
6 |
7 | Vue.mixin({
8 | created() {
9 | if (this.handleLoginEvent) {
10 | authService.addListener("loginEvent", this.handleLoginEvent);
11 | }
12 | },
13 |
14 | destroyed() {
15 | if (this.handleLoginEvent) {
16 | authService.removeListener("loginEvent", this.handleLoginEvent);
17 | }
18 | }
19 | });
20 | }
21 | };
22 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/app/vue.config.js:
--------------------------------------------------------------------------------
1 | const webpack = require("webpack");
2 |
3 | module.exports = {
4 | devServer: {
5 | port: 3000
6 | },
7 | configureWebpack: {
8 | plugins: [
9 | new webpack.ProvidePlugin({
10 | $: "jquery",
11 | jquery: "jquery",
12 | "window.jQuery": "jquery",
13 | jQuery: "jquery"
14 | })
15 | ]
16 | }
17 | };
18 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/hasura/metadata/databases/databases.yaml:
--------------------------------------------------------------------------------
1 | - name: default
2 | kind: postgres
3 | configuration:
4 | connection_info:
5 | database_url:
6 | from_env: SAMPLE_APPS_DATABASE_URL
7 | pool_settings:
8 | idle_timeout: 180
9 | max_connections: 50
10 | retries: 1
11 | tables:
12 | - "!include default/tables/public_article.yaml"
13 | - "!include default/tables/public_users.yaml"
14 | functions: []
15 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/hasura/metadata/databases/default/tables/public_users.yaml:
--------------------------------------------------------------------------------
1 | select_permissions:
2 | - permission:
3 | columns:
4 | - auth0_id
5 | - name
6 | - created_at
7 | filter:
8 | auth0_id:
9 | _eq: X-Hasura-User-Id
10 | role: user
11 | table:
12 | name: users
13 | schema: public
14 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/vuejs-auth0-graphql/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not ie <= 10
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true
5 | },
6 | 'extends': [
7 | 'plugin:vue/essential',
8 | '@vue/standard'
9 | ],
10 | rules: {
11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
13 | },
14 | parserOptions: {
15 | parser: 'babel-eslint'
16 | }
17 | }
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw*
22 |
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/.postcssrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | autoprefixer: {}
4 | }
5 | }
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/app'
4 | ],
5 | plugins: [
6 | ["transform-imports", {
7 | "vuetify": {
8 | "transform": "vuetify/es5/components/${member}",
9 | "preventFullImport": true
10 | }
11 | }]
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/favicon.ico
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/android-chrome-192x192.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/android-chrome-512x512.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon-120x120.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon-152x152.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon-180x180.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon-60x60.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon-76x76.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/apple-touch-icon.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/favicon-16x16.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/favicon-32x32.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/msapplication-icon-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/msapplication-icon-144x144.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/img/icons/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/public/img/icons/mstile-150x150.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vuetify-vuex-todo-graphql",
3 | "short_name": "vuetify-todo",
4 | "icons": [
5 | {
6 | "src": "/img/icons/android-chrome-192x192.png",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "/img/icons/android-chrome-512x512.png",
12 | "sizes": "512x512",
13 | "type": "image/png"
14 | }
15 | ],
16 | "start_url": "/index.html",
17 | "display": "standalone",
18 | "background_color": "#000000",
19 | "theme_color": "#4DBA87"
20 | }
21 |
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
19 |
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/vuetify-vuex-todo-graphql/src/assets/logo.png
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import store from './store'
5 | import apolloProvider from './apollo'
6 | import './registerServiceWorker'
7 | import './vuetify'
8 |
9 | Vue.config.productionTip = false
10 |
11 | new Vue({
12 | router,
13 | store,
14 | apolloProvider,
15 | render: h => h(App)
16 | }).$mount('#app')
17 |
--------------------------------------------------------------------------------
/vuetify-vuex-todo-graphql/src/router.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import Home from './views/Home.vue'
4 |
5 | Vue.use(Router)
6 |
7 | const router = new Router({
8 | scrollBehavior: () => ({ y: 0 }),
9 | routes: [
10 | {
11 | path: '/:filter',
12 | name: 'home',
13 | component: Home,
14 | props: true
15 | }
16 | ]
17 | })
18 |
19 | router.beforeEach((to, from, next) => {
20 | if (['all', 'active', 'completed'].some(record => record === to.params.filter)) {
21 | next()
22 | } else {
23 | next('/all')
24 | }
25 | })
26 |
27 | export default router
28 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/auth-server/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/auth-server/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .env
3 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/auth-server/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:8.9.1
2 |
3 | RUN mkdir -p /opt/app
4 |
5 | RUN chown node:node /opt/app
6 |
7 | WORKDIR /opt/app
8 |
9 | COPY --chown=node:node package.json .
10 |
11 | USER node
12 |
13 | RUN npm install
14 |
15 | COPY --chown=node:node . .
16 |
17 | CMD npm start
18 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/auth-server/Procfile:
--------------------------------------------------------------------------------
1 | web: npm start
2 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/auth-server/db/migrations/20180917160913_users.js:
--------------------------------------------------------------------------------
1 |
2 | exports.up = function(knex, Promise) {
3 | return knex.schema.createTable('users', (table) => {
4 | table.increments();
5 | table.string('username').unique().notNullable();
6 | table.string('password').notNullable();
7 | table.timestamp('created_at').notNullable().defaultTo(knex.raw('now()'));
8 | });
9 | };
10 |
11 | exports.down = function(knex, Promise) {
12 | return knex.schema.dropTable('users');
13 | };
14 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/auth-server/knexfile.js:
--------------------------------------------------------------------------------
1 | // Update with your config settings.
2 |
3 | const databaseName = "postgres";
4 | const pg = require('pg');
5 |
6 | const connection_url = process.env.DATABASE_URL || `postgres://postgres:@localhost:5432/${databaseName}`;
7 |
8 | module.exports = {
9 | client: 'pg',
10 | connection: connection_url,
11 | migrations: {
12 | directory: __dirname + '/db/migrations'
13 | }
14 | };
15 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/hasura/config.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 | endpoint: http://localhost:8080/
3 | api_paths:
4 | v1_query: v1/query
5 | v2_query: v2/query
6 | v1_metadata: v1/metadata
7 | graphql: v1/graphql
8 | config: v1alpha1/config
9 | pg_dump: v1alpha1/pg_dump
10 | version: v1/version
11 | metadata_directory: metadata
12 | migrations_directory: migrations
13 | seeds_directory: seeds
14 | actions:
15 | kind: synchronous
16 | handler_webhook_baseurl: http://localhost:3000
17 | codegen:
18 | framework: ""
19 | output_dir: ""
20 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/hasura/metadata/actions.graphql:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/hasura/metadata/actions.yaml:
--------------------------------------------------------------------------------
1 | actions: []
2 | custom_types:
3 | enums: []
4 | input_objects: []
5 | objects: []
6 | scalars: []
7 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/hasura/metadata/allow_list.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/hasura/metadata/cron_triggers.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/hasura/metadata/query_collections.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/hasura/metadata/remote_schemas.yaml:
--------------------------------------------------------------------------------
1 | []
2 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/hasura/metadata/version.yaml:
--------------------------------------------------------------------------------
1 | version: 3
2 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
3 | .env
4 | build
5 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:carbon
2 |
3 | # Create app directory
4 | WORKDIR /app
5 |
6 | # Install app dependencies
7 | RUN npm -g install serve
8 | # A wildcard is used to ensure both package.json AND package-lock.json are copied
9 | COPY package*.json ./
10 |
11 | RUN npm install
12 |
13 | # Bundle app source
14 | COPY . /app
15 | #Build react/vue/angular bundle static files
16 | #RUN npm run generate
17 | RUN npm run build
18 |
19 | EXPOSE 8080
20 | # serve build folder on port 8080
21 | CMD ["serve", "-s", "build", "-p", "8080"]
22 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/codegen-interpreter.ts:
--------------------------------------------------------------------------------
1 | require('ts-node').register({
2 | transpileOnly: true,
3 | compilerOptions: {
4 | module: 'commonjs'
5 | }
6 | })
7 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/now.json:
--------------------------------------------------------------------------------
1 | {
2 | "name":"whatsapp-clone",
3 | "version": 1,
4 | "env": {
5 | "REACT_APP_SERVER_URL": "https://whatsapp-clone-hasura.herokuapp.com/v1/graphql",
6 | "REACT_APP_AUTH_URL": "https://warm-hamlet-82072.herokuapp.com"
7 | },
8 | "public": true,
9 | "alias": ["whatsapp-clone-hasura.now.sh"]
10 | }
11 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/public/assets/chat-background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/whatsapp-clone-typescript-react/react-app/public/assets/chat-background.jpg
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/public/assets/default-group-pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/whatsapp-clone-typescript-react/react-app/public/assets/default-group-pic.jpg
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/public/assets/default-profile-pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/whatsapp-clone-typescript-react/react-app/public/assets/default-profile-pic.jpg
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/public/assets/whatsapp-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/whatsapp-clone-typescript-react/react-app/public/assets/whatsapp-icon.png
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hasura/sample-apps/02ca14387f05914135e18352e6c3bac401b68f32/whatsapp-clone-typescript-react/react-app/public/favicon.png
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "WhatsApp Clone",
3 | "name": "WhatsApp Clone",
4 | "icons": [
5 | {
6 | "src": "favicon.png",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": ".",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "config:base",
4 | ":automergeMajor"
5 | ],
6 | "baseBranches": [
7 | "master-step1",
8 | "master-step2",
9 | "master-step3",
10 | "master-step4"
11 | ],
12 | "prHourlyLimit": 60,
13 | "recreateClosed": true
14 | }
15 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/App.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/components/SettingsScreen/index.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react'
2 | import { Suspense } from 'react'
3 | import { RouteComponentProps } from 'react-router-dom'
4 | import Navbar from '../Navbar'
5 | import SettingsForm from './SettingsForm'
6 | import SettingsNavbar from './SettingsNavbar'
7 |
8 | export default ({ history }: RouteComponentProps) => (
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | )
18 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/.gitignore:
--------------------------------------------------------------------------------
1 | introspection.json
2 | types.ts
3 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/fragments/chat.fragment.ts:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import message from './message.fragment'
3 |
4 | export default gql `
5 | fragment chat on chat {
6 | id
7 | name
8 | picture
9 | owner_id
10 | created_at
11 | messages(order_by:[{created_at: asc}]) {
12 | ...message
13 | }
14 | }
15 | ${message}
16 | `
17 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/fragments/index.ts:
--------------------------------------------------------------------------------
1 | export { default as chat } from './chat.fragment'
2 | export { default as message } from './message.fragment'
3 | export { default as messageUser } from './messageUser.fragment'
4 | export { default as user } from './user.fragment'
5 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/fragments/message.fragment.ts:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | export default gql`
4 | fragment message on message {
5 | id
6 | chat_id
7 | sender {
8 | id
9 | name
10 | }
11 | content
12 | created_at
13 | }
14 | `
15 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/fragments/messageUser.fragment.ts:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | export default gql`
4 | fragment messageUser on message_user {
5 | id
6 | chat_id
7 | sender {
8 | id
9 | name
10 | }
11 | content
12 | created_at
13 | }
14 | `
15 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/fragments/user.fragment.ts:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | export default gql`
4 | fragment user on users {
5 | id
6 | username
7 | name
8 | picture
9 | }
10 | `
11 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/queries/chats.query.ts:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import * as fragments from '../fragments'
3 |
4 | export default gql `
5 | query Chats {
6 | chat {
7 | ...chat
8 | messages {
9 | ...message
10 | }
11 | }
12 | }
13 | ${fragments.chat}
14 | ${fragments.message}
15 | `
16 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/queries/index.ts:
--------------------------------------------------------------------------------
1 | export { default as chats } from './chats.query'
2 | export { default as users } from './users.query'
3 | export { default as me } from './me.query'
4 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/queries/me.query.ts:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import * as fragments from '../fragments'
3 |
4 | export default gql `
5 | query Me {
6 | users {
7 | ...user
8 | }
9 | }
10 | ${fragments.user}
11 | `
12 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/queries/users.query.ts:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import * as fragments from '../fragments'
3 |
4 | export default gql `
5 | query Users {
6 | users {
7 | ...user
8 | }
9 | }
10 | ${fragments.user}
11 | `
12 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/subscriptions/chatUpdated.subscription.ts:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import * as fragments from '../fragments'
3 |
4 | export default gql `
5 | subscription ChatsListQuerySubUpdate($userId: Int!) {
6 | chat(order_by:[{messages_aggregate:{max:{created_at:desc}}}]) {
7 | ...chat
8 | users(where:{user_id:{_neq:$userId}}) {
9 | user {
10 | ...user
11 | }
12 | }
13 | }
14 | }
15 | ${fragments.chat}
16 | ${fragments.user}
17 | `
18 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/subscriptions/index.ts:
--------------------------------------------------------------------------------
1 | export { default as chatUpdated } from './chatUpdated.subscription'
2 | export { default as messageAdded } from './messageAdded.subscription'
3 | export { default as userUpdated } from './userUpdated.subscription'
4 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/subscriptions/messageAdded.subscription.ts:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import * as fragments from '../fragments'
3 |
4 | export default gql `
5 | subscription MessageAdded {
6 | message_user {
7 | ...messageUser
8 | }
9 | }
10 | ${fragments.messageUser}
11 | `
12 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/graphql/subscriptions/userUpdated.subscription.ts:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import * as fragments from '../fragments'
3 |
4 | export default gql `
5 | subscription UserUpdated {
6 | users(order_by:[{id:desc}]) {
7 | ...user
8 | }
9 | }
10 | ${fragments.user}
11 | `
12 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/index.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --primary-bg: #2c6157;
3 | --secondary-bg: #6fd056;
4 | --primary-text: white;
5 | --secondary-text: white;
6 | }
7 |
8 | html {
9 | height: 100%;
10 | }
11 |
12 | body {
13 | height: 100%;
14 | margin: 0;
15 | padding: 0;
16 | font-family: Roboto, "Helvetica Neue", sans-serif;
17 | }
18 |
19 | #root {
20 | height: 100%;
21 | }
22 |
23 | .Screen {
24 | position: relative;
25 | height: 100%;
26 | }
27 |
--------------------------------------------------------------------------------
/whatsapp-clone-typescript-react/react-app/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------