The new Cosmic dashboard is here!
Test drive it now →

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


In this tutorial I'm going to demonstrate how to build a photography portfolio website using React, Styled-Components and Cosmic. Let's get started.
In this tutorial, Cosmic co-founder Tony Spiro takes you on a tour of Cosmic Webhooks. Learn how webhooks work, see how to easily install integrations with Slack, auto-deploy websites to Netlify, and get an intro to Cosmic Functions.
This article demonstrates how to create a company website using Cosmic and Angular in a few steps.
Why should you migrate your CMS? What's the big deal about Cosmic? This article should answer some questions you have about cosmicJS and what the pros and cons are of using an API-driven Content Management System
Upload media to your Cosmic Bucket using Multer.
In this walkthrough, I'm going to show you how I build a blog application in Go Lang. I'll also talk about styling it using Tailwind CSS and lastly, I'll show you how you can utilize GitHub Actions to deploy your Go-based applications to Heroku.

Get started with Cosmic

Personal projects are free. Scale up as you grow.
Start building Talk to sales