Gatsby Tutorial #2 - Starter Sites
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/
Playlist
Uploads from Net Ninja · Net Ninja · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
GraphQL Tutorial #5 - Express App Setup
Net Ninja
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
GraphQL Tutorial #8 - Root Query
Net Ninja
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
GraphQL Tutorial #12 - Author Type
Net Ninja
GraphQL Tutorial #13 - Type Relations
Net Ninja
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
GraphQL Tutorial #18 - Mutations
Net Ninja
GraphQL Tutorial #19 - More on Mutations
Net Ninja
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
GraphQL Tutorial #23 - Create React App
Net Ninja
GraphQL Tutorial #24 - Book List Component
Net Ninja
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
GraphQL Tutorial #28 - Add Book Component
Net Ninja
GraphQL Tutorial #29 - External Query File
Net Ninja
GraphQL Tutorial #30 - Updating Component State
Net Ninja
GraphQL Tutorial #31 - Composing Queries
Net Ninja
GraphQL Tutorial #32 - query variables
Net Ninja
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
GraphQL Tutorial #34 - Book Details Component
Net Ninja
GraphQL Tutorial #36 - Styling the App
Net Ninja
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
Updated Vue & Firebase Course (Udemy)
Net Ninja
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja
More on: JavaScript Fundamentals
View skill →Related Reads
📰
📰
📰
📰
Stop installing giant icon packages — write SVGs as source with a CLI + MCP
Dev.to · arialus
Frontend Engineers Are Quietly Becoming the New Overhead.
Medium · AI
Building an Interactive Fashion Hero with HTML, CSS & GSAP
Dev.to AI
Out-of-Order HTML Streaming Moves from JS Frameworks into the Browser
InfoQ AI/ML
🎓
Tutor Explanation
DeepCamp AI