Quick Bucket setup code sample using the Cosmic NPM module

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

This is a quick example to show some of the powerful things you can do with the Cosmic NPM Module.  This script adds a Bucket to your Cosmic 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

You may also like


Step by step guide to build a professional developer's portfolio using React, Cosmic, and Semantic-UI
Upload media to your Cosmic Bucket using Multer.
This time, we will add filtering functionality to showcase the Cosmic Advanced Queries feature. Our data will be stored and served by Cosmic and we will use Angular for our Front-End.
Exporting Cosmic-powered data to CSV is easy with this new extension 🚀
Thanks to everyone in Dallas who came out to the Vuetiful Holiday Meetup at Simple Media, featuring Vuetify, Netlify and Cosmic. 🎉
Tony Spiro, co-founder and CEO of Cosmic, 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.

Get Started with Cosmic

Build personal projects for free. Add your team at unbeatable prices.
Start Building Talk to Sales