Skip to content
Node.js client for Google Cloud Datastore: a highly-scalable NoSQL database for your web and mobile applications.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github chore: move to root (#321) Feb 7, 2019
.kokoro chore: publish to npm using wombat (#367) Mar 20, 2019
protos/google/datastore/v1 chore: update proto docs and code style Feb 26, 2019
samples Release v3.1.2 (#353) Mar 6, 2019
src chore: update require statement code style Mar 12, 2019
test refactor(ts): enable noImplicitAny in tsconfig (#355) Mar 8, 2019
.cloud-repo-tools.json Delete reference to non-existent sample. (#149) Aug 2, 2018
.eslintignore chore: update nyc and eslint configs (#284) Dec 11, 2018
.jsdoc.js build: check broken links in generated docs (#292) Jan 15, 2019
.prettierrc Repo migration (#4) Dec 16, 2017 Release v3.1.2 (#353) Mar 6, 2019 Repo migration (#4) Dec 16, 2017 docs: update links in contrib guide (#334) Feb 14, 2019
synth.metadata chore: update require statement code style Mar 12, 2019 refactor(ts): convert to typescript (#236) Nov 7, 2018
tslint.json refactor(ts): convert to typescript (#236) Nov 7, 2018

Google Cloud Platform logo

Google Cloud Datastore: Node.js Client

release level npm version codecov

Cloud Datastore is a NoSQL document database built for automatic scaling, high performance, and ease of application development. While the Cloud Datastore interface has many of the same features as traditional databases, as a NoSQL database it differs from them in the way it describes relationships between data objects.

Using the client library

  1. Select or create a Cloud Platform project.

  2. Enable billing for your project.

  3. Enable the Google Cloud Datastore API.

  4. Set up authentication with a service account so you can access the API from your local workstation.

  5. Install the client library:

     npm install --save @google-cloud/datastore
  6. Try an example:

// Imports the Google Cloud client library
const {Datastore} = require('@google-cloud/datastore');

async function quickStart() {
  // Your Google Cloud Platform project ID
  const projectId = 'YOUR_PROJECT_ID';

  // Creates a client
  const datastore = new Datastore({
    projectId: projectId,

  // The kind for the new entity
  const kind = 'Task';
  // The name/ID for the new entity
  const name = 'sampletask1';
  // The Cloud Datastore key for the new entity
  const taskKey = datastore.key([kind, name]);

  // Prepares the new entity
  const task = {
    key: taskKey,
    data: {
      description: 'Buy milk',

  // Saves the entity
  console.log(`Saved ${}: ${}`);


Samples are in the samples/ directory. The samples' has instructions for running the samples.

Sample Source Code Try it
Tasks source code Open in Cloud Shell
Concepts source code Open in Cloud Shell

The Cloud Datastore Node.js Client API Reference documentation also contains samples.


This library follows Semantic Versioning.

This library is considered to be General Availability (GA). This means it is stable; the code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against GA libraries are addressed with the highest priority.

More Information: Google Cloud Platform Launch Stages


Contributions welcome! See the Contributing Guide.


Apache Version 2.0


What's Next

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

You can’t perform that action at this time.