Files, Folders, and Project Structure
📁 Before You Write a Single Line of Code…
Imagine you just moved into a brand new house. You have boxes of stuff everywhere — clothes, books, kitchen supplies, random cables. You could just dump everything on the floor and start living. But within a week you won’t be able to find anything, and you’ll dread coming home.
Web projects are exactly the same. Before you write any HTML, CSS, or JavaScript, you need a clean, organised place to put it all. This tutorial is about building that house — the folder structure, file names, and conventions that professional developers use every single day.
- Have you ever lost a file because you couldn’t remember where you saved it?
- Do you have a Downloads folder with hundreds of unsorted files right now?
- What would happen if two people tried to work on a project with no agreed file structure?
In the next 20 minutes, you’ll learn the simple system that prevents all of these headaches — and you’ll set up your first proper project folder.
Learning Objectives
By the end of this lesson, you'll be able to:
- ✓ Create Create a standard web project folder structure from scratch
- ✓ Apply Apply professional file and folder naming conventions
- ✓ Explain Explain why index.html is the default entry point for websites
- ✓ Organise CSS, JavaScript, and image files into logical folders
- ✓ Identify Identify common mistakes that break file paths and links
Why This Matters:
Every website you build — from a one-page portfolio to a full web app — starts with the same foundation: a well-organised project folder. Getting this right from day one saves you hours of debugging broken links, missing images, and tangled file paths. It also makes your projects instantly understandable to other developers (and to future-you).
Why Project Structure Matters
When you visit a website, your browser needs to find and load several files: the HTML page, stylesheets, scripts, images, and fonts. Every one of those files lives at a specific path on the server. If the path is wrong, the file doesn’t load — and you get a broken page.
A consistent folder structure means:
- Your links always work — because files are where you expect them to be
- Other people can help — because the layout follows industry conventions
- Your project scales — adding new pages or features doesn’t create chaos
- Deployment is simpler — hosting platforms expect standard structures
- The cabinet is your project folder
- Each drawer is a subfolder (css, js, images)
- Each file inside is labelled clearly so you can grab it instantly
Nobody labels a drawer “stuff2-FINAL(1)” — and you shouldn’t name your files that way either.
The Standard Project Folder
Here is the folder structure used by most simple websites. You’ll see this pattern everywhere — in courses, documentation, and real production sites:
my-first-website/
├── index.html
├── about.html
├── contact.html
├── css/
│ └── style.css
├── js/
│ └── main.js
└── images/
├── logo.png
├── hero-banner.jpg
└── icons/
├── email.svg
└── phone.svgLet’s break down each piece:
The root folder
The top-level folder (my-first-website/) is your project root. Everything lives inside it. When you open this folder in VS Code, it becomes your workspace.
index.html — The front door
Web servers look for a file called index.html by default. When someone visits yoursite.com, the server automatically serves index.html. That’s why your homepage should always be called index.html — not home.html, not main.html, not page1.html.
The name comes from the early web, when servers would show an index (a directory listing) of files if no default page was specified. The convention stuck, and today every web server in the world knows to look for index.html first.
Additional HTML pages
Other pages like about.html and contact.html sit in the root alongside index.html. You link between them with simple relative paths:
<a href="about.html">About Us</a>
<a href="contact.html">Contact</a>The css/ folder
All your stylesheets go here. Start with a single style.css file. As your project grows, you might add more:
css/
├── style.css <!-- Main styles -->
├── reset.css <!-- Browser reset (optional) -->
└── responsive.css <!-- Media queries (optional) -->You link to it from your HTML like this:
<link rel="stylesheet" href="css/style.css">The js/ folder
JavaScript files live here. Start with main.js and add more as needed:
<script src="js/main.js"></script>The images/ folder
All images, icons, and graphics go here. For larger projects, you can create subfolders like images/icons/ or images/blog/ to keep things tidy.
⏸️ ⏸️ Pause & Check: The Basics
Make sure you’ve got the fundamentals before we continue:
- Why should your homepage always be called index.html?
- Name the three standard subfolders in a web project and what goes in each.
- What does the project root mean?
Check Your Answers
- Web servers look for index.html by default. When someone visits your domain without specifying a filename, the server automatically serves index.html.
- css/ for stylesheets, js/ for JavaScript files, and images/ for pictures, icons, and graphics.
- The top-level folder that contains your entire project. When you open it in VS Code, it becomes your workspace. All other folders and files sit inside it.
How confident are you with this concept?
😕 Still confused | 🤔 Getting there | 😊 Got it! | 🎉 Could explain it to a friend!
File and Folder Naming Rules
Bad file names are one of the most common causes of broken websites. Follow these rules and you’ll avoid hours of frustration:
The golden rules
- Always use lowercase
style.css— notStyle.cssorSTYLE.CSSWeb servers (especially Linux) treat uppercase and lowercase as different files.
Style.cssandstyle.cssare two different files on a Linux server, even though they look the same on your Mac. - Use hyphens instead of spaces
my-first-website— notmy first websiteorMy First WebsiteSpaces in file names get converted to
%20in URLs, which looks messy and can cause bugs. - Stick to letters, numbers, and hyphens
Avoid special characters like
# @ ! & ( ). They have special meanings in URLs and can break your links. - Be descriptive but short
hero-banner.jpg— notIMG_20240315_142356.jpgYou should be able to tell what a file is without opening it.
- Never remove file extensions
Every file needs its extension:
.html,.css,.js,.png,.jpg. The extension tells the browser (and you) what type of file it is.
Good names
index.htmlabout-us.htmlstyle.csshero-banner.jpgmain.jscontact-form.js
Bad names
Home Page.htmlAbout_Us (copy).HTMLStyle_Final_v2.CSSIMG_20240315.JPGscript(no extension!)my code!.js
Understanding File Paths
When you link to a stylesheet, image, or another page, you’re writing a file path — directions that tell the browser where to find that file. There are two types:
Relative paths (what you’ll use most)
Relative paths start from the current file’s location:
<!-- From index.html in the root -->
<link rel="stylesheet" href="css/style.css">
<img src="images/logo.png" alt="Logo">
<a href="about.html">About</a>If you need to go up a directory level, use ../:
<!-- From a file inside a subfolder, e.g. pages/about.html -->
<link rel="stylesheet" href="../css/style.css">
<img src="../images/logo.png" alt="Logo">Absolute paths (for external resources)
Absolute paths include the full URL. Use these for external resources like fonts or CDN libraries:
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Raleway">- Relative: “Go two doors down the hall and turn right” — depends on where you’re starting from
- Absolute: “Go to 42 Smith Street, Sydney” — works from anywhere
⏸️ ⏸️ Quick Knowledge Check
Test your understanding of naming and paths:
- What is wrong with the filename "About Us.HTML"?
- If your HTML file is in the root folder and your stylesheet is in css/style.css, what href do you use?
- You moved style.css from the root into a css/ folder. What will happen if you don't update your HTML?
Check Your Answers
- Three problems: (1) it has a space instead of a hyphen, (2) the extension is uppercase (.HTML instead of .html), and (3) the first letters are capitalised. It should be about-us.html.
- href="css/style.css" — a relative path that goes into the css folder from the current location.
- The browser won't find the stylesheet because the old path is now wrong. Your page will load with no styles — just plain unstyled HTML.
How confident are you with this concept?
😕 Still confused | 🤔 Getting there | 😊 Got it! | 🎉 Could explain it to a friend!
Common Mistakes That Break Websites
Here are the problems that trip up beginners most often — and how to avoid them:
Mistake 1: Wrong case in file names
Your stylesheet is called style.css but your HTML says href="css/Style.css". Works on your Mac, breaks when you deploy to a Linux server.
Fix: Always use lowercase. Always.
Mistake 2: Broken relative paths
You moved a file into a subfolder but forgot to update the links that point to it. The browser can’t find it and your images or styles disappear.
Fix: After moving any file, search your project for references to the old path and update them.
Mistake 3: Spaces in folder names
Your project folder is called My Website and suddenly your file paths have %20 in them. Some tools and hosting platforms choke on spaces entirely.
Fix: Use hyphens: my-website.
Mistake 4: Files outside the project folder
You drag an image from your Desktop into your HTML, and the path is something like /Users/yourname/Desktop/photo.jpg. It works on your computer but nobody else can see it.
Fix: Always copy files into your project’s images/ folder first, then reference them with a relative path.
Guided Practice: Set Up Your First Project
Create Your Project Folder
Create the project folder
Create the subfolders
Create your files
Add starter HTML
Add a test style
Open in your browser
You're on track if you can:
- ☐ You have a folder called black-swan-bistro on your computer
- ☐ Inside it you have index.html, a css/ folder with style.css, a js/ folder with main.js, and an images/ folder
- ☐ Your index.html links to css/style.css and js/main.js correctly
- ☐ Opening index.html in your browser shows your heading and styled text
Independent Challenge: Portfolio Starter
💪 Build a Portfolio Project Structure
Now try this on your own without hints!
Your Task:
Requirements:
- Create a project folder called my-portfolio
- Add index.html, about.html, and projects.html in the root
- Create css/, js/, and images/ folders
- Inside images/, create subfolders: profile/ and projects/
- Add a style.css and main.js in the right folders
- In index.html, link to your stylesheet and script with correct relative paths
- Add at least one placeholder image in each images subfolder
Stretch Goals (Optional):
- Add a fonts/ folder and research how to use a custom web font from a local file
- Create a docs/ folder with a README.md file describing your project
- Try opening your project in VS Code and use the file explorer to verify the structure looks clean
Summary
🏁 Lesson Complete: Your Project Has a Home
Key Takeaways:
- Every web project starts with a root folder containing index.html, css/, js/, and images/ subfolders
- File names must be lowercase, use hyphens instead of spaces, and always include their extension
- index.html is the default homepage because web servers look for it automatically
- Relative paths (like css/style.css) tell the browser where to find files relative to the current file
- Common mistakes — wrong case, spaces, files outside the project — are easy to avoid once you know the rules
Learning Objectives Review:
Look back at what you set out to learn. Can you now:
- ✅ Create a standard web project folder structure from scratch Check!
- ✅ Apply professional file and folder naming conventions Got it!
- ✅ Explain why index.html is the default entry point Can explain it!
- ✅ Organise CSS, JS, and image files into logical folders Could teach this!
- ✅ Identify common mistakes that break file paths Check!
If you can confidently answer "yes" to most of these, you're ready to move on!
Think & Reflect:
💭 💭 Reflection Questions
- How is this folder structure different from how you normally save files on your computer?
- Why do you think the convention is lowercase-with-hyphens instead of camelCase or spaces?
- What would you do first if an image wasn't showing up on your page?
- How will you set up your next project differently after this tutorial?
🤔 Real-World Test:
From now on, every project you create should start the same way:
- Create a project folder with a clear, hyphenated name
- Add index.html, css/, js/, and images/ folders
- Name every file in lowercase with hyphens
- Use relative paths to link everything together
This structure will carry you through every tutorial on this platform — and into professional work.
🎯 Looking Ahead:
Now that your files have a home, it’s time to fill them with content! In the next tutorial you’ll learn HTML essentials and start building real web pages inside the structure you just created.
Recommended Next Steps
Related Topics
Explore these related tutorials to expand your knowledge:
Additional Resources
Deepen your understanding with these helpful resources:
- MDN: Dealing with Files - How to set up a sensible file structure for your website.
- MDN: A Typical HTTP Session - How browsers request and receive files from servers.
- File Paths Explained (CSS-Tricks) - Quick visual reference for relative and absolute file paths.
Progress tracking is disabled. Enable it in to track your completed tutorials.
Cookie Settings