Automate setting up a Contentful space


6 minute read

Last week I posted about a quick starter kit for Contentful that I put together using AngularJS.

I’ve made some significant improvements to the project since initially posting it that I wanted to share. Shout-out to Stefan Judis from Contentful for submitting some great ideas and and a pull request https://github.com/stefanjudis.

I think the process is super simple for setting up a project now. You just have to register for a Contentful account and create a space, which is just a collection of content. You grab a couple of API keys from your space and run the init scripts, and boom! You’re done and the project is up and running.

Registering at Contentful

First – register at Contentful and setup a space:

Locate your space ID, content delivery access token and finally the content management token.

You’ll need to register if you don’t already have an account, but they offer single sign-on with GitHub, Gmail and others.

Finding your API keys

Once you’re in Contentful, you just need to grab your space ID, and a couple of API tokens.

Initialize the project

Run the npm run init command which will kick off the build process. You’ll be asked for the space ID and API keys which I just showed how to find in the previous step.

If everything goes through successfully the project will build and you’ll be ready to open the project in your browser. The app will be pointed at the space you just created. You can now start creating and pulling your own content, create new models, and experiment.