Skip to content

Running the backend

The webservice is a Laravel 11 application. It holds your data, exposes the REST API, and runs the agent. These steps get a development instance running.

Terminal window
git clone https://github.com/trakli/trakli.git
cd trakli/webservice
composer install

Copy the example environment file and generate an application key.

Terminal window
cp .env.example .env
php artisan key:generate

Open .env and set your database connection and any other settings. Use real values only on the server, never in committed files.

APP_NAME=Trakli
APP_ENV=local
APP_URL=http://localhost:8000
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=trakli
DB_USERNAME=your-db-user-here
DB_PASSWORD=your-db-password-here

Create the schema.

Terminal window
php artisan migrate
Terminal window
php artisan serve

The API is now available under /api. Authenticated routes live under /api/v1 and require a Sanctum bearer token. See Authentication.

The agent is configured through the eloquent-agents package. To use it you supply a model provider and an API key, and you decide whether the agent may write. By default the agent can read but not write. See Configuration and API keys for the exact keys and the write opt-in.

A quick way to confirm the server is up is the public info endpoint, which does not require auth:

Terminal window
curl http://localhost:8000/api/info
Terminal window
php artisan test