Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A minimal Gatsby starter for building documentation sites with content managed by Cosmic JS.
Gatsby Docs is a minimal Gatsby starter for building documentation sites, with content managed through the Cosmic JS headless CMS.
Gatsby Docs is a starter project that combines the Gatsby static site generator with the Cosmic JS content management system to produce a lightweight documentation website. It takes a configured Cosmic JS bucket (with read and write keys) as its content source and generates a static site with pages built at build time. The project runs on Gatsby's development workflow, offering live reload and a built-in GraphQL playground at /___graphql. It is distributed as a public GitHub repository by Jacob Knaack, with a live demo hosted at cosmicjs.com/apps/gatsby-docs.
The README's quick start outlines a straightforward workflow: clone the repository, run npm install or yarn install to install dependencies, create a .env file with the Cosmic JS bucket and API keys, then start the development server with yarn develop or npm run develop. The site runs at http://localhost:8000 and refreshes in real time when you edit source files. The same configuration is then built into static files for production deployment.
Clone the GitHub repository, then run npm install or yarn install from the project directory. Create a .env file with the Cosmic JS bucket and keys as described in the README before starting the development server.
The project needs three environment variables inside a .env file: COSMIC_BUCKET (your bucket title), COSMIC_READ_KEY (the read key), and COSMIC_WRITE_KEY (the write key). Without these, the site cannot fetch content from Cosmic JS.
The README links to a live demo at cosmicjs.com/apps/gatsby-docs, hosted on the Cosmic JS platform. This demo shows the template's appearance and behavior with sample documentation.
The Gatsby build produces static files, which means the output can be hosted on any static file server. The README also includes app.json and static.json specifically for deploying to Heroku or Cosmic JS.
The project follows the standard Gatsby starter layout: source code in src, configuration in gatsby-config.js, and API extensions in gatsby-browser.js, gatsby-node.js, and gatsby-ssr.js. Other files include app.json, static.json, and Prettier configuration.