# File Organization

Decide where a file belongs, and let your AI follow the same rules.

Zenos works with your app's existing folders. Keep your framework's routes and naming conventions, then place new code beside the feature that uses it.

You do not need to set up a folder template before building. If you use a coding assistant, the optional [Zenos development skill](/getting-started/working-with-ai/#add-the-development-skill) guides it through inspecting, building, and checking a feature.

Where should this file go?:

Follow the framework first, then choose the smallest owner.

1. **A route or page entry?.** `app/ or routes/`. Keep routing files where your framework expects them.
2. **Used by one feature?.** `features/projects/`. Keep its UI, requests, hooks, and tests together.
3. **Shared across features?.** `components/, hooks/, or lib/`. Share code when multiple features need the same behavior.

## Start with one feature

For a new app without an established structure, a project-management feature could look like this:

```text
src/
├── routes/                        Framework route files
├── features/
│   └── projects/
│       ├── _components/
│       │   ├── project-form.tsx
│       │   └── project-form.test.tsx
│       ├── _api/
│       │   └── create-project.ts
│       ├── _hooks/
│       │   └── use-create-project.ts
│       └── index.ts               Exports used outside this feature
├── components/                    UI shared across features
└── index.css                      Global styles and theme overrides
```

The route displays the page. The feature owns its form, save request, and related state. Shared components receive data and callbacks from the feature.

Add folders as the code needs them. A small form may start in one file. Keep your router's actual folder name, and use the naming convention already in your app. Underscores mark private intent; they do not prevent imports by themselves.

## Keep feature details local

For example, a route can import a feature's public entry:

```tsx
import { ProjectForm } from "~/features/projects";
```

That entry explicitly exports what other code may use:

```ts title="src/features/projects/index.ts"
export { ProjectForm } from "./_components/project-form";
```

Use your app's configured alias; `~/` works only when your TypeScript and bundler configuration define it. Inside the feature, use relative imports. Other features should use the public entry instead of importing private files.

Move a component into the shared `components` folder when multiple features need the same behavior. Two uses inside the Projects feature still belong to Projects. Keep API calls and project-specific types out of generic shared UI.

Zenos components come from `@zentara-co/zenos-ui`. Installed recipes stay at the local destination printed by the CLI, such as `src/components/ui`. Feature components can use both.

## Let your AI follow the workflow

Install the [development skill](/getting-started/working-with-ai/#add-the-development-skill), then give your assistant a concrete task:

```text
Use zenos-app-development to add a project creation form.
Inspect our existing routes and features first. Reuse our save API
and validation, keep project-only code together, and check the form's
keyboard behavior and the app's tests.
```

The skill reads relevant CLI guidance, including `zenos docs organization --dense`, when structure matters. It follows an existing app's conventions and uses feature folders as a starting point for a new app.

Keep team-specific decisions in your project's AI instructions, outside the generated Zenos block. For example: “Use our existing routes folder and keep project-only components under the projects feature.” The skill supplements those instructions.

## Before you finish

Check that each new file has a clear owner, shared UI receives data through props, and imports respect feature boundaries. Run the app's checks and try the changed flow. Instructions guide the AI; the working result is what you review.

Continue with [Working with AI](/getting-started/working-with-ai/) for setup, or [Project Setup](/getting-started/project-setup/) for global styles and themes.

Source: https://zenos-ui.pages.dev/getting-started/file-organization/