Back to templates

Template details

Gatsby Starter ReasonML

Gatsby starter for building type-safe static sites with ReasonML, BuckleScript, and React.

About this template

Gatsby Starter ReasonML is a Gatsby v2 boilerplate that builds static sites with ReasonML, BuckleScript v4, and React, giving developers type-safe functional programming on the Gatsby platform.

What is Gatsby Starter ReasonML?

Gatsby Starter ReasonML is a starter project created by iwilsonq, inspired by Gatsby's default blog starter but rewritten to support ReasonML. It takes ReasonML source files as input and compiles them through BuckleScript to JavaScript that runs in Gatsby, producing a static site with blog-style pages. The starter runs on the Gatsby framework and uses the npm scripts dev:bsb and dev:gatsby to start development.

What makes it stand out?

  • Type-safe ReasonML — components are written in ReasonML, a strongly typed functional language that compiles to JavaScript via BuckleScript.
  • Gatsby v2 — the starter targets Gatsby version 2, the React-based static site generator.
  • BuckleScript v4 — uses BuckleScript platform v4 as the compiler for ReasonML.
  • bs-css — CSS-in-JS bindings based on emotion, enabling type-safe styling in ReasonML components.
  • bs-date-fns — bindings for the date-fns date utility library, usable from ReasonML code.
  • Blog starter structure — inspired by Gatsby's default starter blog, so it includes blog-oriented pages and routing.
  • GraphiQL access — accessible at http://localhost:8000/___graphql for experimenting with Gatsby's data query layer.

Who should use Gatsby Starter ReasonML?

  • ReasonML or OCaml developers — who want to build Gatsby sites while writing components in a statically typed functional language.
  • Gatsby users exploring typed alternatives — anyone interested in replacing JavaScript or TypeScript with ReasonML in their Gatsby project.
  • Functional programming enthusiasts — who want to use BuckleScript bindings like bs-css and bs-date-fns in a real project.
  • Developers starting a new static site — who want a starter that already includes ReasonML plumbing so they can skip configuration.

What can you do with it?

  • Create a type-safe blog — build blog pages and posts in ReasonML, relying on Gatsby's file-based data and GraphQL queries.
  • Prototype a static site — quickly scaffold a Gatsby site with ReasonML components and style it with bs-css.
  • Learn ReasonML in context — explore the starter's source to see how ReasonML binds to React and to Gatsby APIs.

How does it work?

Create a new site by installing the Gatsby CLI globally and running gatsby new my-super-neat-reasonml-site https://github.com/iwilsonq/gatsby-starter-reasonml. Inside the project, run npm run dev:bsb to compile ReasonML and npm run dev:gatsby to start the development server at http://localhost:8000. Editing src/pages/index.js triggers hot reload in the browser.

FAQ

Is Gatsby Starter ReasonML free?

Yes, the starter is open source and available on GitHub, so you can use it without paying any license fees.

Do I need to know ReasonML to use this starter?

No, you can still run and customize the site, but writing custom components assumes familiarity with ReasonML syntax and BuckleScript, since that is the language the starter is built around.

What versions of tools does it use?

The starter specifies Gatsby v2 and BuckleScript platform v4, with bs-css and bs-date-fns as included dependencies.

Does this starter support TypeScript?

No, it uses ReasonML rather than TypeScript; that is its main differentiator from many other Gatsby starters.

Can I deploy the output anywhere?

Since Gatsby generates a static site, the built output can be hosted on any static hosting service, though the page does not specify deployment steps.

Alternatives

Other Gatsby starters include the official gatsby-starter-default and gatsby-starter-blog, which use plain JavaScript instead of ReasonML.