Project Structure for AI Coders
Your project is like a house. Every file and folder has a purpose, just like rooms and furniture. Here is what each part does, in plain English.
In this chapter
- What every folder in an AI-generated project is for
- How to find the file you need to change
- Why some files belong in
public/and others inapp/ - How to ask AI to reorganize messy projects
Your Project is a House
Every project has a few main folders. Think of them as different parts of your house.
Other Important Folders
You will see a few more folders in your project. Here is what they are for.
Special Files You Will See
Inside each folder, some filenames have special meanings. Your AI tool creates these for you, but it helps to know what they do.
This is the content of a page. Every folder in app/ that has one of these becomes a real page on your website.
The interior design of a room: what visitors actually see when they walk in.
The shared wrapper around your pages. Your navigation bar and footer usually live here so they appear on every page.
The walls, ceiling, and floor that every room shares.
What visitors see while a page is still loading. A spinner, a progress bar, or a nice animation.
A 'Please wait' sign on a door while the room is being prepared.
What visitors see if something goes wrong on a page. A friendly message instead of a scary crash.
An 'Oops, something broke' note taped to the door.
What visitors see when they type a URL that does not exist. Your custom 404 page.
A sign that says 'This room does not exist' when someone wanders to the wrong address.
The overall look and feel of your entire site (colors, fonts, spacing). Shared by all pages.
The paint colors and flooring style you chose for the whole house.
How Files Get Their Names
You do not need to memorize these rules. Your AI tool handles naming for you. But knowing the patterns helps you understand what is going on.
Use lowercase with dashes between words.
A page about your pricing plans would live in a folder called pricing-plans, not "PricingPlans" or "pricing_plans". Dashes are the standard because they work well in website addresses.
Use capitalized words pushed together.
A navigation bar component would be called Navbar. A sign-up form would be SignUpForm. This capitalization tells your project "this is a building block I can reuse."
Use ALL CAPS with underscores.
Secret values like your database password or API key use names like DATABASE_URL or API_KEY. The caps make them stand out as important settings you should not change casually.
Like [slug]: this means "a page that changes."
If you have a blog, you do not make a separate folder for every post. Instead, a folder called [slug] automatically creates a page for each one. Think of it as a template room that transforms based on who walks in.
What to Tell Your AI Tool
Instead of writing any of this yourself, just tell your AI tool what you want. Here are prompts you can copy and paste.
“Create a new page at /pricing that shows three pricing tiers in cards. Add it to the navigation bar too.”
“Make a reusable testimonial card component that I can use on both the homepage and the about page. It should show a quote, person's name, and their photo.”
“I have a logo image. Where should I put it in my project so I can use it on my website? Add it to the navigation bar.”
“Explain what each file and folder in my project does. I am a beginner and do not know how to read code.”
“I need to add my Stripe API key to this project. Set it up securely so it is not visible to website visitors and not shared publicly on GitHub.”
How to Ask Your AI Tool to Reorganize Files
As your project grows, it might get messy. That is totally normal. Here is how to ask your AI tool to tidy things up.
“I have too many files in my components folder. Can you organize them into subfolders by category, like layout, forms, and shared UI pieces? Update all the imports too.”
“Rename my /services page to /what-we-do. Make sure all links and navigation still work after the rename.”
“Are there any unused files or components in my project that I can safely delete? Show me what each one is before removing anything.”
“I keep repeating the same date formatting logic on different pages. Can you move it into a shared helper in the lib folder and update everywhere it is used?”
Frequently Asked Questions
Do I need to create these folders myself?
No. When you start a new project with a tool like Claude Code, Cursor, or Bolt, it creates all the folders for you. You just describe what you want to build.
What happens if I put a file in the wrong folder?
Nothing will explode, but things might not work as expected. For example, if you put an image in app/ instead of public/, your site will not be able to show it. If something is not working, ask your AI tool: "I added a file but it is not showing up. Can you check if it is in the right place?"
Can I rename folders to whatever I want?
Some folders have special names that your project depends on, like app/, public/, and components/. You can rename the folders inside app/ (those become your page URLs), but do not rename the main ones unless your AI tool says it is safe.
What is the src/ folder I keep seeing?
It stands for "source". It is just a container that holds your app/, components/, and lib/ folders. Think of it as the property line around your house. Everything inside it is your project's actual work.
My project looks different from what is shown here. Is that okay?
Yes. Different AI tools and project templates set things up slightly differently. The core ideas are the same: pages go in one place, reusable pieces go in another, and public files are accessible to everyone. Ask your AI tool to explain your specific setup.
How do I add a new page to my website?
Just ask your AI tool. Say something like: "Add a new page called /contact with a contact form." It will create the right folder and files for you in the app/ directory.