Skip to content
Greg Bowler edited this page May 17, 2026 · 3 revisions

Local development flow

gt serve starts the PHP development server, but in real applications there's more to running than just running a server.

gt run is the commonly-used development command because it starts the local server and also takes care of the other background tasks a project may need, such as asset building and cron jobs. In a tiny project there may be no visible difference yet, but in a fuller application gt run is what we'll use to get the project running in a web browser.

Use gt serve when you only want to test the PHP page handling layer and do not need those supporting background processes. Use gt build separately when you want to compile or copy client-side assets without also starting the server.

Background jobs

When gt run starts, the public files served by the browser still come from www/, while page requests that are not static files are passed through WebEngine's go.php entry point, to be routed to our application's source code.

That means two kinds of work are happening locally:

  • ordinary static file serving from www/ (served directly from web servers).
  • dynamic page rendering through WebEngine.

On top of that, the build system may be watching your asset source files for asset compilation, and the cron runner may be watching for scheduled tasks. Those jobs are not part of every project, but it is useful to understand early that "running the app" often means running more than one process.

Background tasks using crontab

If your project needs scheduled tasks during development, add a crontab file in the project root. That file describes which commands should run and when they are due.

The important idea is that these jobs are part of the application, not part of the web request itself. Typical examples include:

  • refreshing cached data
  • sending queued emails
  • importing data from another system
  • cleaning up expired files or sessions

When you use gt run, the cron watcher can run alongside the web server and asset pipeline. When you want to work with scheduled tasks directly, use gt cron.

See Background cron tasks for the project-side setup, and [[gt commands#gt cron]] for the command reference.


Next, let's learn about the request-response lifecycle.

Clone this wiki locally