Gatsby Tutorial #2 - Starter Sites

Net Ninja · Beginner ·🌐 Frontend Engineering ·5y ago

Key Takeaways

Gatsby tutorial covering starter sites, installing Gatsby CLI, and creating a new project using a bare-bones starter site

Full Transcript

all right then so now we know a little bit about what gatsby is let's try making a new project so the easiest way to get started with a new gatsby project is to use what's known as a starter site now these are ready made by the plated gatsby projects that come fully baked with all the setup and configuration that we need to develop a gatsby project and they range from bare bones starter projects which contain only the essential configuration that we need to make a site right through to fully fledged blog sites and other more complex builds so you can view all the different starter sites on the gatsby website go to gatsby js.com forward slash starters like so and you can see them all here so you can see right here we have a starter blog we have a starter default starter portfolio etc and you can click on these to learn more about them and see how to install them now the one we're going to start with is a bare bones starter site and it's called hello world so i'm going to search for that and it's this one over here so this is a snapshot of what it looks like in a browser and as you can see it's very very bare bones it just contains this text so it's going to come with all the configuration we need all the setup but only the minimal setup it's a bit like when we create a react app using create react app it's that kind of setup probably less so if we scroll down here it's going to show you how to install this starter but there's one thing we need to do first and that is to install the gatsby cli and only then can we use a command like this because we start it using the gatsby cli so let's install that first of all so to do this you want to open up a terminal this can be command prompt or whatever terminal you want and we want to use npm to install package now this is why you need node installed because you can only use npm if you have node installed then we want to say we want to install then hyphen g meaning install this globally on our computer so we can use it anywhere and we want to install gatsby hyphen cli so press enter and that's going to install that tool for us [Music] and then once that's done we can go back to the starter site details page so we can copy this command right here now notice this says gatsby new which is how we start a new gatsby project then it says my gatsby project now this is what we want to call our project so we're going to call it something different and then this is a github repo and a starter project reference that we're going to install so let us now go over to the terminal and paste this in and i just want to change where it says my gatsby project is something that our project is going to be called so let me delete that and i'll change it to web warrior all right then so if i press enter now it's going to create a new project called web warrior in this directory for us and it's going to base it on this starter site [Music] all right and now that's done i'm going to cd into that new directory web warrior like so and then i want to open this up in visual studio code so to do that i can type code space and then full stop press enter and it's going to open up this project in vs code right here okay so now we can see all of these different folders and files on the left this my friends is our starter project so the first thing i want to do is give you a little tour of all these different folders and files because i said that this was a bare bones project but by the look of things we've got a lot of different files and folders here so let's take it one step at a time first of all node modules over here this is where all of the different packages are installed so react itself and gatsbit they go in there and any dependencies that they have as well any other packages that we install in the future as well for the project are going to live inside here but you never have to go in there and edit anything that's just where they live then we have this source folder right here now this is where like 95 of your code is going to go so most of the work you do will be inside this source folder and inside the source folder at the minute we just have a pages folder as well and inside that we have an index.js and this is where we have the hello world that is seen in the browser we'll see that in our browser in a minute but this is the entirety of the content at the minute so this is basically the home page so down here we also have a static folder this is where we can place any static files that will be made public to the browser we also have these files down here so git ignore this is a version control we have some prettier config files which you'll need pretty installed for them to have an effect so go to your extensions and search for prettier if you want to install that so this thing right here all right so let's go back to the files down here we have gatsby config this is where we have some different configuration options for our site as well as where we register plugins which we're going to learn about later on we have some package files down here as well so the package.json file lists all of our different dependencies which we can see down here and also we have some scripts which we're going to use along the way as well the ones we'll mainly be using are this towards the end when we build our project maybe serve as well and we will use develop this is what we're going to use to actually preview the website in a browser and then we also have a license file and a readme file as well so it's pretty simple most of the things you're not going to need to touch and like i said most of the work will be inside the source folder and inside this gatsby config file as well all right then so how do we then preview this in a browser well all we need to do is run this command right here gatsby develop and what this does is spin up a local development server so that we can preview it in a browser so let me open up a terminal you can do that by going to terminal and new terminal and i'm going to say gatsby develop like so so press enter and this is going to spin up that local development server so it says right here something else is already running at port 8000 for me so i'll say yep run this on a different port for you as long as you've got nothing else running it will just spin up a local development server using port 8000 now we can see if we scroll up we get this link this is for graphical we'll talk about that later on but we also get this one right here now yours will probably say 8 000 instead of 8001 but i'm going to control and click on that to open this up in a browser and we can see this is our website right here hello world so there's one more thing i want to show you and that is if we head back to the code you'll also see this public folder now now this folder was generated by gatsby when we ran gatsby develop and inside here is all of the stuff that is being served to the browser when we preview it including this html file right here this is the html file we're currently seeing in the browser for this homepage index.js file right here so this stuff right here is being served in the browser and later on when you come to deploy your application this will be the folder that you deploy as well after we've run the build command because all of the built files will then go into this public folder so that's your introduction to the starter site next up we're going to start talking about pages and routes so that we can add more content

Original Description

In this Gatsby tutorial we'll take a look at Gatsby starter sites & choose a bare-bones "hello world" starter to create a new project. 🐱‍💻 🐱‍💻 Course Files: + https://github.com/iamshaunjp/gatsby-tutorial 🐱‍👤🐱‍👤 JOIN THE GANG - https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg/join 🐱‍💻 🐱‍💻 My Udemy Courses: + Modern JavaScript - https://www.thenetninja.co.uk/udemy/modern-javascript + Vue JS 3 & Firebase - https://www.thenetninja.co.uk/udemy/vue-and-firebase + D3.js & Firebase - https://www.thenetninja.co.uk/udemy/d3-and-firebase 🐱‍💻 🐱‍💻 Useful playlists: + Full React tutorial - https://www.youtube.com/watch?v=j942wKiXFu8&list=PL4cUxeGkcC9gZD-Tvwfod2gaISzfRiP9d + GraphQL tutorial - https://www.youtube.com/watch?v=Y0lDGjwRYKw&list=PL4cUxeGkcC9iK6Qhn-QLcXCXPQUov1U7f 🐱‍💻 🐱‍💻 Other links: + Gatsby docs - https://www.gatsbyjs.com/docs/ + Markdown guide - https://guides.github.com/features/mastering-markdown/ + Download Git - https://git-scm.com/downloads + Get VS Code - https://code.visualstudio.com/ 🐱‍💻 🐱‍💻 Social Links: Facebook - https://www.facebook.com/thenetninjauk Twitter - https://twitter.com/thenetninjauk Instagram - https://www.instagram.com/thenetninja/
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Net Ninja · Net Ninja · 0 of 60

← Previous Next →
1 Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
2 Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
3 Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
4 GraphQL Tutorial #1 - Introduction to GraphQL
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
5 GraphQL Tutorial #2 - A Birdseye View of GraphQL
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
6 GraphQL Tutorial #3 - Project (stack) Overview
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
7 GraphQL Tutorial #4 - Making Queries (front-end preview)
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
8 GraphQL Tutorial #5 - Express App Setup
GraphQL Tutorial #5 - Express App Setup
Net Ninja
9 GraphQL Tutorial #6 - Setting up GraphQL
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
10 GraphQL Tutorial #7 - GraphQL Schema
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
11 GraphQL Tutorial #8 - Root Query
GraphQL Tutorial #8 - Root Query
Net Ninja
12 GraphQL Tutorial #9 - The Resolve Function
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
13 GraphQL Tutorial #10 - Testing Queries in Graphiql
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
14 GraphQL Tutorial #11 - GraphQL ID Type
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
15 GraphQL Tutorial #12 - Author Type
GraphQL Tutorial #12 - Author Type
Net Ninja
16 GraphQL Tutorial #13 - Type Relations
GraphQL Tutorial #13 - Type Relations
Net Ninja
17 GraphQL Tutorial #14 - GraphQL Lists
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
18 GraphQL Tutorial #15 - More on Root Queries
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
19 GraphQL Tutorial #16 - Connecting to mLab
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
20 GraphQL Tutorial #17 - Mongoose Models
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
21 GraphQL Tutorial #18 - Mutations
GraphQL Tutorial #18 - Mutations
Net Ninja
22 GraphQL Tutorial #19 - More on Mutations
GraphQL Tutorial #19 - More on Mutations
Net Ninja
23 GraphQL Tutorial #20 - Updating the Resolve Functions
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
24 GraphQL Tutorial #21 - GraphQL NonNull
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
25 GraphQL Tutorial #22 - Adding a Front-end
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
26 GraphQL Tutorial #23 - Create React App
GraphQL Tutorial #23 - Create React App
Net Ninja
27 GraphQL Tutorial #24 - Book List Component
GraphQL Tutorial #24 - Book List Component
Net Ninja
28 GraphQL Tutorial #25 - Apollo Client Setup
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
29 GraphQL Tutorial #26 - Making Queries from React
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
30 GraphQL Tutorial #27 - Rendering Data in a Component
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
31 GraphQL Tutorial #28 - Add Book Component
GraphQL Tutorial #28 - Add Book Component
Net Ninja
32 GraphQL Tutorial #29 - External Query File
GraphQL Tutorial #29 - External Query File
Net Ninja
33 GraphQL Tutorial #30 - Updating Component State
GraphQL Tutorial #30 - Updating Component State
Net Ninja
34 GraphQL Tutorial #31 - Composing Queries
GraphQL Tutorial #31 - Composing Queries
Net Ninja
35 GraphQL Tutorial #32 - query variables
GraphQL Tutorial #32 - query variables
Net Ninja
36 GraphQL Tutorial #33 - Re-fetching Queries
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
37 GraphQL Tutorial #34 - Book Details Component
GraphQL Tutorial #34 - Book Details Component
Net Ninja
38 GraphQL Tutorial #36 - Styling the App
GraphQL Tutorial #36 - Styling the App
Net Ninja
39 GraphQL Tutorial #35 - Making a Single Query
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
40 Build Apps with Vue & Firebase - Udemy Course
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
41 Updated Vue & Firebase Course (Udemy)
Updated Vue & Firebase Course (Udemy)
Net Ninja
42 Vue & Firebase Real-time Chat (Preview) #1 - Intro
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
43 Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
44 Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
45 Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
46 Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
47 Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
48 Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
49 Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
50 Object Oriented JavaScript Tutorial #1 - Introduction
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
51 Object Oriented JavaScript Tutorial #2 - Object Literals
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
52 Object Oriented JavaScript Tutorial #3 - Updating Properties
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
53 Object Oriented JavaScript Tutorial #4 - Classes
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
54 Object Oriented JavaScript Tutorial #5  - Class Constructors
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
55 Object Oriented JavaScript Tutorial #6 - Class Methods
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
56 Object Oriented JavaScript Tutorial #7 - Method Chaining
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
57 Object Oriented JavaScript Tutorial #8 - Class Inheritance
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
58 Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
59 Object Oriented JavaScript Tutorial #10 - Prototype
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
60 Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja

This video tutorial introduces Gatsby and covers creating a new project using a starter site. It explains how to install Gatsby CLI, configure project settings, and preview the site in a browser.

Key Takeaways
  1. Install Node.js and npm
  2. Install Gatsby CLI using npm
  3. Create a new Gatsby project using a starter site
  4. Configure project settings in gatsby-config.js
  5. Preview the site in a browser using Gatsby develop
💡 Gatsby starter sites provide a quick way to get started with a new project, and the Gatsby CLI makes it easy to create and configure projects.

Related Reads

📰
Stop installing giant icon packages — write SVGs as source with a CLI + MCP
Learn to create SVG icons from scratch using a CLI and MCP, reducing dependency on giant icon packages
Dev.to · arialus
📰
Frontend Engineers Are Quietly Becoming the New Overhead.
Frontend engineers are being bypassed in the development process, with features being shipped without their involvement, highlighting a potential shift in their role
Medium · AI
📰
Building an Interactive Fashion Hero with HTML, CSS & GSAP
Learn to build an interactive fashion hero using HTML, CSS, and GSAP, and discover how to create immersive digital experiences
Dev.to AI
📰
Out-of-Order HTML Streaming Moves from JS Frameworks into the Browser
Out-of-order HTML streaming is moving from JS frameworks to browsers, enabling faster page loading and interaction
InfoQ AI/ML
Up next
Sports on the Go: Africa makes history at 2026 FIFA World Cup
CGTN Africa
Watch →