Skip to content

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
my-service/
├── .env.example
├── .gitignore
├── index.php
└── pam.json

index.php is the whole application: it registers a handler with Pam\Http\Server and starts listening.

index.php
<?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.

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.php
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/.

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.

bootstrap/app.php
<?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.

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.

Created during installation and autoloaded under Database\Factories\ and Database\Seeders\. pam make:migration, pam make:factory and pam make:seeder write here.

bin/nimbus opens an interactive shell over your application:

Terminal window
pam bin/nimbus tinker

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 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.php

What 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:

Terminal window
pam bin/migrate
pam dev index.php

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.js

pam.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:

pam.php
<?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.

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:

Terminal window
pam clean --dry-run # measure only
pam clean # remove regenerable artifacts
pam clean --all # also remove generated native hosts and Cargo targets