Going further
Configuration
Nitro works without any configuration. To change a default, publish config/nitro.php, where you set the endpoint, where components live, how state is signed, uploads, builds and rendering.
On this page
To publish the configuration files, run:
php artisan vendor:publish --tag=nitro-config
This publishes config/nitro.php, and config/nprogress.php for the progress bar.
Keep only what you change. Nitro's own files sit under yours, key by key at every depth, so a setting you leave
out, or one a later version of Nitro adds, has its default all the same. A list, such as
middleware or a view engine's extensions, is yours whole.
config/nitro.php
| Key | Default | Description |
|---|---|---|
endpoint
|
/_nitro
|
The URL prefix for
#[Server]
calls, uploads and assets
|
middleware
|
['web']
|
The middleware the endpoint runs |
components
|
App\Nitro\Components
|
The namespace, path and view path of components |
pages
|
App\Nitro\Pages
|
The namespace, path and view path of pages |
stores
|
App\Nitro\Stores
|
The namespace and path of stores |
layout
|
components.layouts.app
|
The layout of pages without
#[Layout]
|
head
|
'%s'
|
The defaults of
@nitroHead
: the title format, the description and the link-preview image
|
persistent_middleware
|
auth, can, verified, ... |
The page middleware checked again on each
#[Server]
call
|
max_payload
|
1 MB |
The largest
#[Server]
call accepted
|
state.bind_to_session
|
true
|
Also sign state with the session's secret, so it is only valid in its own session |
state.lifetime
|
null
|
How long a snapshot stays valid, in seconds. With
null
, as long as its session
|
uploads
|
directory
,
rules
,
max_files
and
throttle
|
|
public_config
|
['app.name']
|
The config keys
config()
may read in the browser. Their values are public
|
cache.store
|
null
|
The cache store
#[Cached]
keeps results in. With
null
, the application's default
|
fallbacks.enabled
|
null
|
Whether a failed component shows a fallback in its place. With
null
, on when
APP_DEBUG
is off
|
fallbacks.view
|
null
|
The fallback of components without
fallback()
. With
null
, a short message with a link that loads the page again
|
compiled
|
storage/framework/nitro
|
Where compiled files are written |
static
|
nitro
|
The directory in
public/
the build is published to
|
build.obfuscate
|
true
|
Whether builds are obfuscated |
minify_on_change
|
true
|
Whether to minify when recompiling during development |
rendering
|
'clone'
|
How the browser creates elements:
'clone'
or
'create'
|
view_transitions
|
false
|
Whether every visit changes the page inside the browser's View Transitions.
nitro:navigate.transition
turns them on for one link
|
navigation
|
'data'
|
How a visit shows a page:
'data'
or
'markup'
. A page can choose with
#[Navigate]
, which also takes
'client'
|
attributes
|
[]
|
Your own
nitro:
attributes, each run by a
Nitro.directive()
|
views
|
Vue, React, Solid, Svelte |
The engines for views written in a JavaScript framework: each one's
adapter
, the
path
s its views are in and their
extensions
|
ssr
|
off |
Server rendering for those views:
enabled
(
NITRO_SSR
in
.env
), the render service's
url
(
NITRO_SSR_URL
), a
timeout
and the
bundle
nitro:ssr
runs
|
features
|
[]
|
Classes that run around every component on the server |
devtools
|
null
|
The dev overlay and the Server-Timing header. With
null
, on when
APP_DEBUG
is on (see Debugging)
|
esbuild
|
The Node binary (
NITRO_NODE
in
.env
) and where esbuild is installed
|
Some options have a page of their own, with all the details:
head: titles, descriptions and link previews.uploads: the rules, the number of files and the throttle.navigation: data first or markup first.rendering: cloning or creating elements.state: sessions and lifetimes.attributes: your ownnitro:attributes.features: code that runs around every component on the server.
config/nprogress.php
This file configures the progress bar shown while a visit loads. You can choose whether it shows at all
(show), whether it also shows during #[Server] calls (server_calls),
how long a visit must take before it appears (delay), and the shortest time it runs once
shown (minimum_duration). You can also set its colour, height, speed and fade. These settings
live only in this file.
To use a different progress bar, set show to false. Then start your own bar on the
nitro:navigating event and finish it on nitro:navigated.
After changing configuration
When your deploy caches configuration (php artisan optimize or config:cache), Laravel reads the cache, not config/nitro.php. Run it again after you change the file or your .env.