> For the complete documentation index, see [llms.txt](https://dinush-chathurya.gitbook.io/kustomize-e-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dinush-chathurya.gitbook.io/kustomize-e-book/kustomize-fundamentals/04-folder-structure.md).

# Folder Structure

A well-organized folder structure is the foundation of a maintainable Kustomize project, especially in enterprise environments where configuration complexity scales quickly.

***

## Recommended Folder Layout

Here’s a scalable folder structure used by many production teams:

```yaml
kustomize/
├── base/
│   ├── deployment.yaml
│   ├── service.yaml
│   └── kustomization.yaml
└── overlays/
    ├── dev/
    │   ├── kustomization.yaml
    │   └── patches/
    ├── staging/
    │   ├── kustomization.yaml
    │   └── patches/
    └── prod/
        ├── kustomization.yaml
        └── patches/
```

## Explanation

* **base/**: Common configurations that are shared across all environments.
* **overlays/**: Environment-specific customizations (dev, staging, prod).
* **patches/**: Optional directory to store patch YAMLs (e.g., to change replicas, resources, image tags, etc.).

***

## Why This Structure?

* ✅ **Separation of Concerns**: Base is reusable, overlays are isolated.
* ✅ **GitOps Friendly**: Easy to track changes per environment.
* ✅ **CI/CD Ready**: Pipelines can target specific overlay directories.

***

## Real-World Tip (Enterprise Practice)

In large companies, overlays are sometimes placed in entirely separate Git repositories. This allows:

* Fine-grained access control per environment.
* Promoting changes through Pull Requests (e.g., from dev → staging → prod).
* Better separation of duties between Dev, QA, and Ops teams.

***

## Best Practices

* Name overlays clearly (`dev`, `staging`, `prod`, not `test1`, `env2`).
* Use a `patches/` directory when overlays get complex.
* If possible, follow a consistent folder structure across all services.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://dinush-chathurya.gitbook.io/kustomize-e-book/kustomize-fundamentals/04-folder-structure.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
