All Projects → gothinkster → Gcp Datastore Cloud Functions Realworld Example App

gothinkster / Gcp Datastore Cloud Functions Realworld Example App

Serverless GCP Cloud Functions + Datastore implementation of RealWorld Backend

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Gcp Datastore Cloud Functions Realworld Example App

Wild Workouts Go Ddd Example
Complete application to show how to apply DDD, Clean Architecture, and CQRS by practical refactoring of a Go project.
Stars: ✭ 756 (+519.67%)
Mutual labels:  serverless, google-cloud
Examples
Infrastructure, containers, and serverless apps to AWS, Azure, GCP, and Kubernetes... all deployed with Pulumi
Stars: ✭ 1,085 (+789.34%)
Mutual labels:  serverless, gcp
Ethereum Etl
Python scripts for ETL (extract, transform and load) jobs for Ethereum blocks, transactions, ERC20 / ERC721 tokens, transfers, receipts, logs, contracts, internal transactions. Data is available in Google BigQuery https://goo.gl/oY5BCQ
Stars: ✭ 956 (+683.61%)
Mutual labels:  gcp, google-cloud
Terraformer
CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code
Stars: ✭ 6,316 (+5077.05%)
Mutual labels:  gcp, google-cloud
Fog Google
Fog for Google Cloud Platform
Stars: ✭ 83 (-31.97%)
Mutual labels:  gcp, google-cloud
React Firebase Starter
Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay
Stars: ✭ 4,366 (+3478.69%)
Mutual labels:  serverless, gcp
Airflow Toolkit
Any Airflow project day 1, you can spin up a local desktop Kubernetes Airflow environment AND one in Google Cloud Composer with tested data pipelines(DAGs) 🖥 >> [ 🚀, 🚢 ]
Stars: ✭ 51 (-58.2%)
Mutual labels:  gcp, google-cloud
Cloud Custodian
Rules engine for cloud security, cost optimization, and governance, DSL in yaml for policies to query, filter, and take actions on resources
Stars: ✭ 3,926 (+3118.03%)
Mutual labels:  serverless, gcp
Pragmaticai
[Book-2019] Pragmatic AI: An Introduction to Cloud-based Machine Learning
Stars: ✭ 79 (-35.25%)
Mutual labels:  serverless, gcp
Ng Toolkit
⭐️ Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
Stars: ✭ 1,116 (+814.75%)
Mutual labels:  serverless, google-cloud
Awesome Firebase
🔥 List of Firebase talks, tools, examples & articles! Translations in 🇬🇧 🇷🇺 Contributions welcome!
Stars: ✭ 448 (+267.21%)
Mutual labels:  serverless, google-cloud
Iap Desktop
IAP Desktop is a Windows application that provides zero-trust Remote Desktop and SSH access to Linux and Windows VMs on Google Cloud.
Stars: ✭ 96 (-21.31%)
Mutual labels:  gcp, google-cloud
Cloud Functions Go
Unofficial Native Go Runtime for Google Cloud Functions
Stars: ✭ 427 (+250%)
Mutual labels:  gcp, google-cloud
Firebase Gcp Examples
🔥 Firebase app architectures, languages, tools & some GCP things! React w Next.js, Svelte w Sapper, Cloud Functions, Cloud Run.
Stars: ✭ 470 (+285.25%)
Mutual labels:  serverless, gcp
Magic Modules
Automatically generate Google Cloud Platform support for OSS IaaC Projects
Stars: ✭ 358 (+193.44%)
Mutual labels:  gcp, google-cloud
Grpc Gke Nlb Tutorial
gRPC load-balancing on GKE using Envoy
Stars: ✭ 42 (-65.57%)
Mutual labels:  gcp, google-cloud
Grant
OAuth Proxy
Stars: ✭ 3,509 (+2776.23%)
Mutual labels:  serverless, gcp
Rpc Websockets
JSON-RPC 2.0 implementation over WebSockets for Node.js and JavaScript/TypeScript
Stars: ✭ 344 (+181.97%)
Mutual labels:  serverless, gcp
Pulumi
Pulumi - Developer-First Infrastructure as Code. Your Cloud, Your Language, Your Way 🚀
Stars: ✭ 10,887 (+8823.77%)
Mutual labels:  serverless, gcp
Unity Solutions
Use Firebase tools to incorporate common features into your games!
Stars: ✭ 95 (-22.13%)
Mutual labels:  gcp, google-cloud

RealWorld Backend TravisCI Coverage Status Docs dependencies Status Known Vulnerabilities

Google Cloud Platform (Datastore + Cloud Functions) serverless codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld API Spec.

This codebase was created to demonstrate a fully fledged fullstack application built with Google Cloud Platform (Datastore + Cloud Functions) including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to community style guides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

How it works

Background

This codebase is meant to be deployed to Google Cloud Functions, a serverless environment which allows you to run NodeJS code in response to events like HTTP triggers scaling up and down elastically without the need for spinning up or maintaining servers.

Life of a Request

For every API call made, a new invocation of the top level function index.js occurs. It calls Router.js which parses the HTTP route and calls the appropriate handler in User.js or Article.js. The handler applies business logic and returns a response which is marshalled back to the caller by Cloud Functions.

For data persistence, Google Cloud Datastore is used which is a fully managed NoSQL database as a service. Cloud Datastore multitenancy is supported and can be leveraged by specifying a DATASTORE_NAMESPACE environment variable at runtime.

Datastore Schema

User

{ username: 'Julie_Stracke',
  password: '$2a$05$Unbla43FRv5Zb...',
  email: '[email protected]',
  image: '',
  bio: '',
  followers: [],
  following: [],
  [Symbol(KEY)]:
   Key {
     namespace: 'test-unit',
     name: 'Julie_Stracke',
     kind: 'User',
     path: [Getter] } }

Article

{ slug: 'In-enim-nur2bx',
  title: 'In enim',
  description: 'Suscipit voluptas minima...',
  body: 'Voluptates doloremque unde...',
  tagList: [ 'temporibus', 'quae', 'omnis', 'aut' ],
  createdAt: 1509036552780,
  updatedAt: 1509036552780,
  author: 'author_Paul_Heaney',
  favoritedBy: [],
  [Symbol(KEY)]:
   Key {
     namespace: 'test-unit',
     name: 'In-enim-nur2bx',
     kind: 'Article',
     path: [Getter] } }

Comment

{ body: 'Voluptatem dolorem repellat...',
  author: 'Wiegand_Hattie',
  createdAt: 1509036740596,
  updatedAt: 1509036740596,
  [Symbol(KEY)]:
   Key {
     namespace: 'test-unit',
     id: '5629499534213120',
     kind: 'Comment',
     parent:
      Key {
        namespace: 'test-unit',
        name: 'In-enim-nur2bx',
        kind: 'Article',
        path: [Getter] },
     path: [Getter] } }

Testing

Unit Tests

Unit tests live adjacent to source code as src/*.test.js and can be run by executing npm run test:unit. They use mocha as a test runner and istanbul/nyc for coverage.

API Tests

You can also run Postman based API tests by executing npm run test:api. These are run using the newman command line runner. The code is deployed locally to a Cloud Functions Local Emulator environment and tested. See run-api-tests.sh for details.

Linting

Code linting is enforced using eslint configured by .eslintrc.js. You can run the linter by executing npm run lint.

CI

Continuous integration is performed by TravisCI. See .travis.yml for details.

CD

If all tests pass, the code is automatically deployed to a Cloud Functions Endpoint. See deploy-to-cloud.sh for details.

Getting started

Setup Google Cloud Platform (GCP)

  • Signup for a Google Cloud Platform (GCP) Free Account here and create a new project
  • Setup Cloud Datastore for this project by following steps here
  • Install and setup gcloud CLI tool by following help here

Setup local development environment

Note: Node.js 8.0 or greater is required

  • Clone this repo
  • Create GCP Datastore indexes
gcloud datastore indexes create index.yaml
  • Create a service account and store the credentials as service-account-key.json in the repo root folder - DO NOT SHARE THIS FILE!
  • Ensure Datastore indexes are created before proceeding by checking here
  • Specify details about your GCP project,
export GOOGLE_APPLICATION_CREDENTIALS=service-account-key.json
export GCP_PROJECT_ID=<your-GCP-project-id>
  • Install dependencies
npm install
npx functions config set projectId $GCP_PROJECT_ID
  • Test
npm test

Deploy to Cloud Functions

npm run deploy

More details in deploy-to-cloud.sh.

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