Build your first API
This tutorial takes you from an empty machine to an API for orders with a Nuxt frontend. It assumes no knowledge of Fusion Stack, and only a little of PHP and the command line. Each step shows the commands to run and what you should see, so you can tell it worked before moving on, and ends with what to do when it did not.
The tutorial uses Laravel (PHP). With Laravel for Rust, start from the Rust quickstart; the concepts, the API it serves and the Nuxt app are the same.
You will build shop: a Laravel API where teams place orders, and a Nuxt app that shows them. Along the way you meet the ideas Fusion Stack is built on. Each is explained the first time it comes up, and in the glossary.
The steps
- Install the prerequisites: PHP, Composer and Node.
- Create the project: the API and the Nuxt app, running.
- Your first resource: orders you can create, list and fetch.
- Filtering, sorting and includes: only the queries you allow.
- Authentication and scopes: keys, tokens and what each may do.
- A custom action: emailing an invoice, modelled as a resource.
- Generate the SDK and build a Nuxt page: a typed client, and an orders page that uses it.
- Your first breaking change: rename a field without breaking a client.
- Deploy: a production build, rehearsed, then online.
Tested on every change
The commands and code on these pages are run, in order, on a fresh machine whenever Fusion Stack changes, and the output must match what each page shows. If a step does not work for you, it is a bug: please open an issue.