Skip to content

Awesome boilerplate with smooth CI/CD developing-staging-production pipeline.

License

Notifications You must be signed in to change notification settings

tripheo0412/jamstack-javascript-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Node Version React Version Gatsby Version License: MIT
Netlify Status Master Branch Live Preview
Netlify Status Develop Branch Live Preview
Netlify Status Storybook Documentation
CircleCI Test status

React Gatsby Contenful Storybook CircleCI Netlify

JAMStack Boilerplate

Kick off your project with this default boilerplate. This starter ships with the main Gatsby configuration files the blazing fast app generator for React. Integrating with Jest for unit testing. Provide smooth development experience and CI/CD pipeline with CircleCI and Netlify built in.

πŸš€ Quick start

  1. Clone this Repo

    # clone this repo via github link
    git clone https://github.com/tripheo0412/jamstack-javascript-boilerplate.git
  2. Install all packages

    Using either yarn/npm install

    cd jamstack-javascript-boilerplate
    yarn

    or

    cd jamstack-javascript-boilerplate
    npm install
  3. Add Contentful

    Sign up account on Contentful.

    Create new space.

    Go to Space's setting -> Api keys -> Generate new Personal Access Tokens -> Add token to .env file.

    CONTENTFUL_SPACE_ID <your generated Contentful personal access token>
    CONTENTFUL_ACCESS_TOKEN <your Space ID>

    Go to Space's setting -> Add Space's ID to .env file.

    CONTENTFUL_SPACE_ID <your generated Contentful personal access token>
    CONTENTFUL_ACCESS_TOKEN <your Space ID>

    Go to gatsby-config.js remove comment on contentful plugin.

    Add Gatsby-Contentful-Plugin

    yarn add gatsby-source-contentful

    Voila! You are ready to go!

  4. Setting up CI/CD

    Registered your account on CircleCI and Netlify.

    Get Netlify Site ID + generate Netlify personal access token.

    Connect project github repo to CircleCI, go to project settings, click on environment variables and add 2 variables.

    NETLIFY_ACCESS_TOKEN <your generated Netlify personal access token>
    NETLIFY_SITE_ID <your Netlify Site ID>

    After setting this up, everytime you push, CircleCI will check for lint + testing error, if passed you can click details in CircleCI check and see the Web URL deployed on Netlify.

    Note that for master branch, CircleCI will build the App and release to Netlify with tag --prod for Production deployment.

  5. Open the source code and start editing!

    yarn start

    or

    npm run start

    Your site is now running at http://localhost:8000!

    Note: You'll also see a second link: http://localhost:8000/___graphql. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.

    Open the jamstack-javascript-boilerplate directory in your code editor of choice and edit src/pages/index.js. Save your changes and the browser will update in real time!

🧐 What's inside?

A quick look at the top-level files and directories you'll see in this boilerplate.

.
β”œβ”€β”€ .circleci/config.yml
β”œβ”€β”€ .storybook
β”œβ”€β”€ config
β”œβ”€β”€ node_modules
β”œβ”€β”€ src
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .prettierrc
β”œβ”€β”€ gatsby-browser.js
β”œβ”€β”€ gatsby-config.js
β”œβ”€β”€ gatsby-node.js
β”œβ”€β”€ gatsby-ssr.js
β”œβ”€β”€ jest-preprocess.js
β”œβ”€β”€ jest.config.js
β”œβ”€β”€ LICENSE
β”œβ”€β”€ loadershim.js
β”œβ”€β”€ README.md
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ tslint.json
└── yarn.lock/package-lock.json
  1. /circleci: This directory contains CircleCI configuration file. Note that there are 2 types of job: build (for every push to any branch beside master) and release (for master branch - production deployment).

  2. .storybook/: This directory contains all the configuration files for Storybook.

  3. /config: This directory contains all the configuration files for Jest testing.

  4. /node_modules: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.

  5. /src: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. src is a convention for β€œsource code”.

  6. .gitignore: This file tells git which files it should not track / not maintain a version history for.

  7. .prettierrc: This is a configuration file for Prettier. Prettier is a tool to help keep the formatting of your code consistent.

  8. gatsby-browser.js: This file is where Gatsby expects to find any usage of the Gatsby browser APIs (if any). These allow customization/extension of default Gatsby settings affecting the browser.

  9. gatsby-config.js: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the config docs for more detail).

  10. gatsby-node.js: This file is where Gatsby expects to find any usage of the Gatsby Node APIs (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.

  11. gatsby-ssr.js: This file is where Gatsby expects to find any usage of the Gatsby server-side rendering APIs (if any). These allow customization of default Gatsby settings affecting server-side rendering.

  12. jest-preprocess.js: This file contains babel options to build gatsby project for Jest testing

  13. jest.config.js: This file contains all of Jest configurations.

  14. LICENSE: This boilerplate is licensed under the MIT license.

  15. loadershim.js: This files contains loader setting for Jest.

  16. package.json: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.

  17. README.md: A text file containing useful reference information about your project.

  18. tsconfig.json: This file contains all of typescript configurations for type checking.

  19. tslint.json: This file contains all of typescript linting configurations, integrating with prettier.

  20. yarn.lock/package-lock.json (See package.json below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. (You won’t change this file directly).

🏎 Core technologies

πŸ’Ž Rich utilities: Git hooks - code formatting - code documenting

πŸ›‘ Testing

πŸ† Contious integration

πŸ“² Networking

🎁 Other NPM modules

Prerequisites


  • NodeJS.
  • Storybook.
  • IDE of your choice.
  • Command Line Tools.

Testing


Run test suites:

  npm run test

or

  yarn test

In watch mode:

  npm run test:watch

or

  yarn test:watch

Useful scripts


Format code and write based on Prettier rules

  npm run format

or

  yarn format

🌟 Developers

Tri Hoang

About

Awesome boilerplate with smooth CI/CD developing-staging-production pipeline.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •