Quick Bucket setup code sample using the Cosmic JS NPM module


This is a quick example to show some of the powerful things you can do with the Cosmic JS NPM Module.  This script adds a Bucket to your Cosmic JS account, adds a Pages Object Type and adds a few Pages.

To run the code:

1. Copy the bucketSetupExample.js file locally into a new folder.
2. cd your-folder; npm i cosmicjs
3. Add your secret authentication token to the code found in Account Settings > Authentication
4. node bucketSetupExample.js

Was this article helpful?

Thank you! Your input helps us improve our articles and resources. If you have any other questions or comments, please contact support.

You may also like


Here we build a progressive web app in React.js with the power of Cosmic JS. It respond with status 200 and carries data when you disconnected to internet and in Chrome browser (both mobile and desktop) it gives an option to install the app on home screen.
Single page app that allows you to showcase you digital products and accepts credit card payment online. Very similar to the marketing sales funnel, but done in simple single page sales funnel.
In this tutorial I'm going to show you how to create a "Conference" app using a little bit of Node, and Cosmic JS.
Now editors can use the new Unsplash Photos Extension to find and add stock photography to their media library, all from the comfort of their Bucket Dashboard without having to interface with a third-party website like Unsplash.
Metadata is extremely important for SEO as it speaks to search engines directly from each page crawled, to communicate important information or request a specific action from the search engine. Cosmic JS provides an easy modal to manage media metadata.
Creating a static React App without worrying about language boundaries