Community Articles Quick Bucket setup code sample using the Cosmic JS NPM module

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


In this tutorial I'm going to show you how to build a component-based website using Cosmic JS.
An easy way to add analytics dashboard in your cosmic bucket.
In this tutorial, I'm going to show you how to create a minimalistic but awesome single page app blog using Vue, Vuex, Vuetify, Cosmic JS and deploy it to Netlify.
Tony Spiro, co-founder and CEO of Cosmic JS, presented "Building for Team Success with Content-Powered Apps" to illustrate the build vs. buy concept of software development in the API-first microservices movement. The full video is embedded below and runs approximately 45 minutes.
Blazing fast blog built using React Static that utilizes the power of Cosmic JS.
Next.js is a React framework for building hybrid applications. It's flexible, extensible, and works great with any data provider. In this tutorial, we'll show how to get started with Cosmic CMS and Next.js.

Ready to Get Started?

No payment info required.
Start Now   Contact Sales