2. Create the project
In this step you create shop, see it running, and make your first request to its API.
Create it
Go to the folder where you keep your projects, and run:
npm create @fusion-stack@latest shop -- --nuxt --yesThis downloads Fusion Stack's project creator and runs it. --nuxt asks for an API with a Nuxt frontend, and --yes takes the defaults for everything else. It takes a few minutes the first time, while Composer and npm download the packages. It ends with:
└ Your Fusion Stack app is ready. Commit everything: from here on it is your code.The project is one folder with three parts:
| Folder | What it is |
|---|---|
shop/api | The API: a Laravel app with Fusion Stack. Most of this tutorial happens here. |
shop/web | The frontend: a Nuxt app that calls the API. |
shop/packages/client | A TypeScript client for the API, generated from it, which web uses. You never edit it. |
Run it
cd shopnpm run devThis starts both apps, and keeps running until you press Ctrl+C. Leave it running for the rest of the tutorial. Changes you make are picked up without restarting it.
Open http://localhost:3000 in your browser, and sign in as test@example.com with the password password. You see a list of teams. The project comes with an example resource, teams, and some made-up ones in its database. A resource is a kind of thing the API serves, such as teams or, soon, orders.
Make your first request
Open a second terminal, go to the shop folder, and from there into the API:
cd apiYou talk to the API with HTTP requests, here with curl. Ask for the root of the API:
curl localhost:8000{
"name": "My API",
"docs": "http://localhost:8000/docs",
"openapi": "http://localhost:8000/docs/openapi.json"
}The name comes from APP_NAME in api/.env, the API's settings file. Change it there if you like.
http://localhost:8000/docs is the API's reference: every endpoint, what it accepts and what it returns. Fusion Stack generates it from your code, so it is always up to date. Open it in your browser.
Now ask for the teams:
curl localhost:8000/v1/teams{
"errors": [
{
"status": "401",
"code": "unauthenticated",
"title": "Unauthorized",
"detail": "Authenticate to use this endpoint.",
"meta": { "request_id": "req_01m8rbskxwq3nwtpjz3qpg1cck" }
}
]
}The API does not know who you are, so it refuses. Every error from a Fusion Stack API looks like this: an HTTP status, a code that programs can check, and a detail for people. The request_id identifies this request in the API's logs, so when something goes wrong, it tells you which request to look for.
The v1 in the URL keeps room for a future, very different API. Day-to-day changes are handled with versions instead, which you meet in step 8.
Create an API key
Programs prove who they are with an API key: a long secret sent with each request. Create one:
php artisan api:key:create "Tutorial" --scope='*' INFO Created API key 1. Copy it now: it is not stored and cannot be shown again.
fs_live_…
Scopes ................................................................. *
Pinned version ....................................... the default versionphp artisan runs Laravel's commands, and api:key:create is one of Fusion Stack's. Each key has scopes: what it may do, such as read teams. * allows everything, which is fine on your own machine. In step 5 you give keys only the scopes they need.
The key is shown only once. Keep it in a variable, so you can use it as $KEY. Replace fs_live_… with your key:
export KEY=fs_live_…Ask for the teams again, with the key, two at a time:
curl -g "localhost:8000/v1/teams?page[size]=2" -H "Authorization: Bearer $KEY"{
"data": [
{
"id": "12",
"type": "teams",
"attributes": {
"name": "Ferry-Adams",
"plan": "enterprise",
"created_at": "2026-12-01T10:12:40.000000Z",
"updated_at": "2026-12-01T10:12:40.000000Z"
}
},
{
"id": "11",
"type": "teams",
"attributes": {
"name": "Goyette Ltd",
"plan": "free",
"created_at": "2026-12-01T10:12:40.000000Z",
"updated_at": "2026-12-01T10:12:40.000000Z"
}
}
],
"links": {
"first": "http://localhost:8000/v1/teams?page%5Bsize%5D=2",
"prev": null,
"next": "http://localhost:8000/v1/teams?page%5Bsize%5D=2&page%5Bafter%5D=eyJ0…"
},
"meta": { "page": { "size": 2 } }
}Your teams have other names: they are made up when the project is created.
This response is in the JSON:API format, a standard for JSON APIs. Every resource has an id, a type and its attributes. A list comes in pages: links.next is the URL of the next page, and is null on the last one. Because every endpoint works the same way, clients, including the generated TypeScript client, handle them all alike. The JSON:API page has more.
curl: (7) Failed to connect to localhost port 8000
The API is not running. Check the first terminal: npm run dev must still be running, without errors. If it stopped, start it again from the shop folder.
npm run dev says the port is already in use
Another program uses port 8000 or 3000, often another project's server. Stop it, or close the terminal it runs in, then run npm run dev again.
curl says "bad range in URL"
curl reads [ in a URL as a pattern. Pass -g, as above.
The request gets a 401 with the key
$KEY is set only in the terminal where you ran export. Run it again in the terminal you use, with your key. If you lost the key, create another one.
Next: your first resource.