Skip to content
/ gatsby-starter Public template

πŸ† A fully loaded starter kit for Gatsby development to get your website up and running in minutes.

License

Notifications You must be signed in to change notification settings

brionmario/gatsby-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

86 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gatsby Starter

Gatsby Starter

Tailwind CSS Β· TypeScript Β· SASS Β· ESLint Β· Style Lint Β· Font Awesome Β· React i18next Β· React Testing Library Β· Cypress

A fully loaded starter kit for Gatsby development to get your website up and running in minutes.
Code quality & Testing tools are also already configured for your ease.

All Contributors

πŸ”— Quick Links

Demo

πŸš€ Quick start

The generated project have dependencies that require node, npm and Gatsby CLI.

Make sure you have Node version >= 8.0, npm >= 5 & GatsbyCLI

# create a new Gatsby site using this template.
gatsby new my-gatsby-starter https://github.com/brionmario/gatsby-starter

# change the directory
cd my-gatsby-starter/

# start the development server. Site will run on http://localhost:8000
npm start

Table of Contents

File Structure

gatsby-starter/
 β”œβ”€β”€ coverage/                      * unit test coverage reports.
 β”œβ”€β”€ cypress/                       * cypress tests folder.
 β”œβ”€β”€ docs/                          * contains documents and document resources.
 β”œβ”€β”€ i18n/                          * contains i18n translations and config.
 β”œβ”€β”€ node_modules/                  * contains dependencies pulled from npm.
 β”œβ”€β”€ public/                        * generated public folder for distribution.
 β”œβ”€β”€ src/                           * source folder
 β”‚   β”œβ”€β”€ assets/                    
 β”‚   β”‚   β”œβ”€β”€ images/                * images and icons.
 β”‚   β”‚   └── styles                 * SASS stylesheets.
 β”‚   β”œβ”€β”€ components                 * shared reusable components.
 β”‚   β”œβ”€β”€ layouts                    * app layouts.
 β”‚   β”œβ”€β”€ models                     * typescript schemas.
 β”‚   β”œβ”€β”€ pages                      * app pages.
 β”‚   └── types                      * custom typings.
 β”œβ”€β”€ static                         * contains static assets that needs to be copied to public folder.
 β”œβ”€β”€ .eslintignore                  * files and folders that need to be ignored from linter.
 β”œβ”€β”€ .eslintrc.js                   * es-lint configuration file.
 β”œβ”€β”€ .gitignore                     * contains files that are ignored from git
 β”œβ”€β”€ gatsby-browser.js              * where Gatsby expects to find any usage of the Gatsby browser APIs.
 β”œβ”€β”€ gatsby-config.js               * main configuration file for a Gatsby site.
 β”œβ”€β”€ gatsby-node.js                 * where Gatsby expects to find any usage of the Gatsby Node APIs
 β”œβ”€β”€ gatsby-ssr.js                  * where Gatsby expects to find any usage of the Gatsby server-side rendering APIs.
 β”œβ”€β”€ CONTRIBUTING.md                * project contributing guidelines
 β”œβ”€β”€ cypress.json                   * cypress configuration file.
 β”œβ”€β”€ LICENSE.md                     * licensing information.
 β”œβ”€β”€ package.json                   * contains all the npm scripts for building, running, deploying etc. and contains all the dependencies
 β”œβ”€β”€ package.lock.json              * lock file for npm.
 β”œβ”€β”€ postcss.config.js              * post-css configurations.
 β”œβ”€β”€ README.md                      * Readme file for the repository
 β”œβ”€β”€ tailwind.config.js             * tailwind CSS configuration file.
 β”œβ”€β”€ stylelint.config.js            * style lint configuration file.
 └── tsconfig.json                  * typescript configuration file.

Getting Started

Prerequisites

What you need to run this app:

Node & npm

Make sure you have Node.js and npm installed by running the following simple commands on the command line and see if you're running the latest stable versions.

  • Node.js - Type node -v on the terminal.
  • npm - Type npm -v on the terminal.

If you do not have them installed, click here and grab the latest stable version of node and npm will be automatically installed along with it. Or if you have brew already installed in your local machine, execute brew install node command to get node.

Gatsby CLI

Follow the Gasby CLI install instructions and get it installed on your environment. This will enable the usage of gatsby command.

Setting Up

Create a Gatsby site

Use the Gatsby CLI to create a new site, specifying the default starter.

# create a new Gatsby site using this template.
gatsby new my-gatsby-starter https://github.com/brionmario/gatsby-starter

Navigate to source

Navigate into your new site’s directory and start customizing.

# change the directory
cd my-gatsby-starter/

Running the app

You can execute the below command to fire up the server.

npm 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.

Styling

The index.scss file inside the src/assets/styles directory is the main stylesheet for the project and will be compiled by Gatsby's build. If you want to add your own stylesheet, you can place it under the src/assets/styles/partials folder and import it in the index.scss file.

For example if you want to include the styles for a slider:

  1. Create a _slider.scss partial file in the src/assets/styles/partials directory.
  2. In index.scss add @import 'partials/slider.scss';

Linting

Execute the following commands to generate linting for styles and scripts.

# all
npm run lint

# JavaScript & Typescript files.
npm run lint:es

# Style files.
npm run lint:styles

Testing

All Tests

Execute the following command to run both unit test suite and e2e test suite.

npm run test

Unit Tests

Execute the following command to run your unit tests.

npm run test:unit

The following command will run the unit tests in watch mode.

npm run test:unit:watch

If you want to generate the code coverage for the project, use the following command.

npm run test:unit:coverage

We have used React Testing Library for unit testing.

End-To-End Tests

Execute the following command to run your unit tests.

npm run test:e2e

We have used Cypress for E2E testing.

Build

Execute the following command to build your app in production mode.

npm run build

Deployment

Gatsby Cloud

Deploy this starter with one click on Gatsby Cloud:

Deploy to Gatsby Cloud

Contributing

Please read CONTRIBUTING.md for contributing guidelines and to learn about our code of conduct.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Brion Mario

πŸ’» πŸ“– πŸš‡ 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

License

This project is licensed under the BSD Zero Clause License(0BSD) License - see the LICENSE.md file for details.