---
title: Project Structure
description: A guided tour of every directory in a Nibiru project.
---

```
my-app/
├── core/                   # Framework code (don't edit)
│   ├── a/                  # Abstract classes + adapters
│   ├── c/                  # Concrete classes (router, view, form types…)
│   ├── f/                  # Factories (db, form)
│   ├── i/                  # Interfaces
│   ├── l/                  # Composer vendor (yes, in core/)
│   ├── t/                  # Traits
│   └── framework.php       # Main bootstrap
├── application/            # Your app
│   ├── controller/         # *Controller.php files
│   ├── model/              # Auto-generated models (from DB schema)
│   ├── module/             # Modules (the second M in MMVC)
│   │   └── users/          #   each with its own MVC + plugins
│   ├── settings/
│   │   └── config/
│   │       ├── settings.<env>.ini
│   │       ├── database/   #   numbered SQL migration files
│   │       └── navigation/main.json
│   └── view/
│       ├── templates/      # Smarty .tpl files
│       ├── templates_c/    # Smarty compile cache (auto)
│       ├── cache/          # HTML cache (when caching=true)
│       └── mockup/         # Static design mockups
├── public/                 # CSS / JS / images / fonts (web-served)
├── nibiru                  # CLI binary
├── index.php               # Entry point
├── composer.json
└── vhost.conf              # Sample nginx vhost
```

## Notable conventions

### Controllers
- File: `application/controller/<name>Controller.php`
- Class: `Nibiru\<name>Controller extends Nibiru\Adapter\Controller`
- Required methods: `pageAction()`, `navigationAction()`. Optional: any `<verb>Action()`.

### Views
- File: `application/view/templates/<name>.tpl` for the matching controller.
- Subviews go under `application/view/templates/<name>/<action>.tpl`.
- Shared partials live in `application/view/templates/shared/`.

### Models
- Auto-generated under `application/model/`.
- Filenames match table names. Each class extends a `Db` adapter (`MySQL\Db` or `PostgreSQL\Db`).

### Modules
- Folder: `application/module/<name>/`
- Each module is its own MVC island plus traits, plugins, interfaces and settings.
- The [Registry](/core/registry/) auto-discovers `*.ini` settings inside each module's `settings/`.

### Migrations
- `application/settings/config/database/<NNN>-<slug>.sql`
- Numbered. Run via `./nibiru -mi <env>`.
- One file per logical change — don't squash.

### Composer vendor in `core/l/`
This is intentional. `composer.json` sets `vendor-dir: core/l`. The framework's autoloader expects it there. Don't move it.

### `templates_c/` and `cache/`
Smarty must be able to write to `templates_c/`. Caching is opt-in via the INI key `[ENGINE] caching = true`. Both folders should be in your `.gitignore`.
