Directory Structure
A PAM project is an ordinary Composer project with one extra file, pam.json, at its root. There is no hidden framework directory and no PAM-specific lockfile: composer.json, composer.lock, PSR-4 autoloading and vendor/autoload.php work exactly as you know them.
What else you get depends on the template you pick with pam init <directory> --template <name>. This page shows the four server templates side by side. For mobile, desktop and product workspaces, see Choose a Target.
| Template | Use it for | Entry point |
|---|---|---|
raw |
The bare runtime contract: one file, no framework. | index.php |
api (alias http) |
A JSON API with Nimbus and the Arcano ORM. | index.php |
web |
A server-rendered web application with login, registration and password reset. | index.php |
laravel |
A Laravel 13 application served by PAM’s Laravel host. | pam.php |
The Raw Template
Section titled “The Raw Template”my-service/├── .env.example├── .gitignore├── index.php└── pam.jsonindex.php is the whole application: it registers a handler with Pam\Http\Server and starts listening.
<?php
declare(strict_types=1);
use Pam\Http\Request;use Pam\Http\Response;use Pam\Http\Server;
Server::create(static fn (Request $request, Response $response): Response => match ($request->path) { '/api/ping' => $response->json(['message' => 'pong']), default => $response->json(['error' => 'Not Found'], 404),})->listen((int) (getenv('PAM_PORT') ?: 3000));There is no composer.json. The Pam\Http, Pam\Async and other runtime classes are built into PAM, so nothing needs to be installed. Add Composer later with pam composer init when you need packages. The HTTP Server page documents this contract.
The API Template
Section titled “The API Template”my-api/├── app/│ └── Controllers/│ └── PingController.php├── bin/│ └── nimbus├── bootstrap/│ └── app.php├── database/│ ├── factories/│ ├── migrations/│ └── seeders/├── tests/│ ├── ApplicationTest.php│ └── TestCase.php├── vendor/├── .env.example├── .gitignore├── composer.json├── composer.lock├── index.php├── pam.json├── phpunit.xml└── routes.phpThe Root Files
Section titled “The Root Files”| File | Purpose |
|---|---|
index.php |
The server entry point. It requires bootstrap/app.php and calls $app->listen(). This is the file you pass to pam dev, pam start and pam build --entry. |
routes.php |
Every route of the application. It receives the router as $router. |
pam.json |
The project manifest (type: 1). See Configuration. |
composer.json |
Requires php ^8.5, pushinbr/nimbus ^0.7 and pushinbr/arcano ^0.2.9; dev dependencies are PHPUnit, Pint, Faker and PsySH. It also defines the dev, start and test Composer scripts. |
phpunit.xml |
PHPUnit configuration. Its cache lives in .pam/phpunit-cache. |
.env.example |
Documents the variables the application reads (PAM_PORT). |
.gitignore |
Ignores /vendor/ and /.pam/. |
The bootstrap Directory
Section titled “The bootstrap Directory”bootstrap/app.php builds and returns the Nimbus\App without starting a listener. index.php, tests/TestCase.php and bin/nimbus all require it, so the server, the test suite and the interactive shell run the same application.
<?php
declare(strict_types=1);
use Nimbus\App;
$root = dirname(__DIR__);
$app = new App();$app->routes($root . '/routes.php');
return $app;Register service providers, global middleware and container bindings here.
The app Directory
Section titled “The app Directory”Your application code, autoloaded under the App\ namespace. The template starts with one controller. The API generators create the usual sub-directories as you need them:
| Command | Creates |
|---|---|
pam make:controller Name |
app/Controllers/Name.php |
pam make:request Name |
app/Requests/Name.php |
pam make:resource Name |
app/Resources/Name.php |
pam make:model Name |
app/Models/Name.php |
pam make:service Name |
app/Services/Name.php |
pam make:repository Name |
app/Repositories/Name.php |
pam make:job Name |
app/Jobs/Name.php |
pam make:admin Name |
app/Admin/NameAdmin.php |
Names must start with an uppercase letter and contain only ASCII letters and digits. Generators never overwrite an existing file.
The database Directory
Section titled “The database Directory”Created during installation and autoloaded under Database\Factories\ and Database\Seeders\. pam make:migration, pam make:factory and pam make:seeder write here.
The bin Directory
Section titled “The bin Directory”bin/nimbus opens an interactive shell over your application:
pam bin/nimbus tinkerThe tests Directory
Section titled “The tests Directory”tests/TestCase.php extends Nimbus\Testing\TestCase and boots bootstrap/app.php for every test; requests are dispatched in memory. tests/ApplicationTest.php checks the starter route. Run the suite with pam test.
The Web Template
Section titled “The Web Template”The web template builds on the API layout and adds sessions, server-rendered views, translations, a database and complete authentication screens:
my-app/├── app/│ ├── Auth/Users.php│ ├── Controllers/│ │ ├── DashboardController.php│ │ ├── Form.php│ │ ├── LoginController.php│ │ ├── PasswordResetController.php│ │ └── RegisterController.php│ ├── Middleware/Authenticate.php│ ├── Models/User.php│ └── Providers/AppServiceProvider.php├── bin/│ ├── migrate│ └── nimbus├── bootstrap/app.php├── database/│ ├── factories/UserFactory.php│ ├── migrations/│ └── seeders/DatabaseSeeder.php├── lang/│ ├── en/│ └── pt_BR/├── resources/│ └── views/│ ├── auth/│ ├── components/│ └── dashboard.nim.php├── storage/├── tests/│ ├── Browser.php│ ├── Feature/│ └── TestCase.php├── .env├── .env.example├── index.php├── pam.json├── phpunit.xml└── routes.phpWhat is different from the API template:
| Path | Purpose |
|---|---|
.env |
Generated with a fresh APP_KEY. bootstrap/app.php loads it, without overriding variables that are already set. It is git-ignored. |
bootstrap/app.php |
Registers the Arcano database, file sessions, translations, views, AppServiceProvider and security headers. PAM_ENV=production switches off schema and view reloading. |
app/Providers/AppServiceProvider.php |
Container bindings for users, the session authenticator, password resets and mail notifications. |
app/Middleware/Authenticate.php |
Redirects guests away from the dashboard group in routes.php. |
resources/views/ |
Nimbus views (*.nim.php), including shared components/. Generate new ones with pam make:view products.index. |
lang/en, lang/pt_BR |
Translation files. The default locale comes from APP_LOCALE. |
bin/migrate |
Runs migrations: pam bin/migrate (also rollback [steps], status, cache and seed). pam deploy:remote runs it on every release. |
storage/ |
SQLite database, sessions and caches. Git-ignored. |
tests/Browser.php |
A test helper that keeps cookies between requests and fills the CSRF _token in forms. |
phpunit.xml |
Forces an in-memory SQLite database and memory sessions for tests. |
Create the database before the first run:
pam bin/migratepam dev index.phpThe Laravel Template
Section titled “The Laravel Template”The laravel template is a standard Laravel 13 skeleton (laravel/framework ^13.17) with two PAM additions: pam.json (type: 3) and pam.php.
my-laravel-app/├── app/├── bootstrap/├── config/├── database/├── public/├── resources/├── routes/├── storage/├── tests/├── artisan├── composer.json├── pam.json├── pam.php└── vite.config.jspam.php boots Laravel once per worker and starts the listener. It keeps one request active per worker, because Laravel’s managers and facades are process-global:
<?php
declare(strict_types=1);
use Pam\Laravel\Application;
$app = Application::boot(__DIR__);$app->listen( port: (int) (getenv('PAM_PORT') ?: 3000), host: (string) (getenv('PAM_HOST') ?: '127.0.0.1'), options: [ 'maxConcurrentRequests' => 1, 'responseStreamQueueCapacity' => 16, 'maxResponseBytes' => 256 * 1024 * 1024, 'maxResponseChunkBytes' => 1024 * 1024, 'exposeErrors' => filter_var(getenv('APP_DEBUG') ?: 'false', FILTER_VALIDATE_BOOLEAN), ],);Run it with pam dev pam.php, and use pam artisan ... for Artisan. Everything else is the Laravel structure documented at laravel.com. The Laravel section covers the request lifecycle, workers and deployment.
Generated and Ignored Directories
Section titled “Generated and Ignored Directories”| Directory | Contents |
|---|---|
vendor/ |
Composer dependencies, installed by pam composer install. |
.pam/ |
Regenerable PAM artifacts such as .pam/cache and .pam/phpunit-cache. |
dist/ |
The default output of pam build. |
pam info reports how much space these artifacts use, and pam clean removes them:
pam clean --dry-run # measure onlypam clean # remove regenerable artifactspam clean --all # also remove generated native hosts and Cargo targetsNext Steps
Section titled “Next Steps”- Configuration: environment,
pam.json,php.iniand extensions. - Routing and Controllers in a Nimbus application.
- Package Commands: add your own
pam <command>.