This is a simple starter for Gatsby based on on the default Gatsby starter.
- Demo for this starter: simple.rickkln.com
- My personal site: rickkln.com
- This Coronavirus Pandemic Tracker: corona.rickkln.com
- This farewell page: baobablogic.com
-
TypeScript is used for a better developer experience.
-
ESLint and the AirBnB TypeScript style guide help you avoid, and fix, simple issues in your code.
-
The default Gatsby formating tool, Prettier, has been removed in order to avoid conflicts with the ESLint + AirBnB TypeScript tools described above.
-
Firebase Hosting is supported and configured for Gatsby from the start.
-
Blog posts are implemented from the start via Gatsby dynamic pages, you can simply add any markdown file to the posts directory with the appropriate frontmatter.
-
Fork or clone this repository.
Use the fork button on the Github repository, or clone the repo as follows:
# Clone the repo git clone https://github.com/rickkln/gatsby-starter-simple.git my-new-site
-
Navigate into the cloned folder.
Navigate into your new site’s directory, install the libraries and start it up:
cd my-new-site/ npm install gatsby develop
-
Open the source code and start editing.
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
my-new-site
directory in your code editor of choice and editsrc/pages/index.tsx
. Save your changes and the browser will update in real time! -
Deploy your new site!
Once you are ready to deploy your changes you can do so using Firebase, or your hosting provider of choice. If you choose to go with firebase you can use the default configuration in the project.
Simply follow the instructions on the Firebase website to initialize and connect the firebase CLI.
Once Firebase CLI is connected to your Firebase project you are ready to deploy:
# To build the Gatsby site and deploy to Firebase hosting in one go npm run deploy
A quick look at the top-level files and directories you'll see in this project.
.
├── node_modules
├── src
├── .eslintrc.js
├── .gitignore
├── firebase.json
├── gatsby-config.js
├── gatsby-node.js
├── LICENSE.md
├── package-lock.json
├── package.json
├── README.md
└── tsconfig.json
-
/node_modules
: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed. -
/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”. -
.eslintrc.js
: This is a configuration file for ESLint. ESLint is a tool to help you avoid and fix simple issues in your code. -
.gitignore
: This file tells git which files it should not track / not maintain a version history for. -
firebase.json
: This is a configuration file that lists your Firebase project configuration. Learn more about this file in the Firebase docs. -
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). -
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. -
LICENSE.md
: Gatsby itself, along with the code for this starter are licensed under the MIT license. -
package-lock.json
(Seepackage.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). -
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. -
README.md
: This text file, which contains useful reference information about your project. -
tsconfig.json
: This is a configuration file for TypeScript. The tsconfig.json file specifies the root files and the compiler options required for the TypeScript compiler to compile the project. More details are available in the TypeScript docs.
While you're welcome to fork and use this code, as per the license below, I don't have time to help you fix issues. If you are looking for more guidance you can use the official documentation for Gatsby. Here are some useful places to start:
-
The official in-depth tutorial for creating a site with Gatsby. It starts with zero assumptions about your level of ability and walks through every step of the process.
-
The Gatsby code samples. In particular, check out the Guides, API Reference, and Advanced Tutorials sections in the sidebar.
-
The documentation on the TypeScript Plugin. This is specifically useful if you are forking this project, as it uses TypeScript.
The original code in this repo is licensed under the MIT License. For more information view the LICENSE file.