Backend customization: An examples cookbook using FoodAdvisor
Page summary:A cookbook of real-world backend customization examples using the FoodAdvisor demo application, demonstrating how to implement custom routes, controllers, services, policies, and middlewares in Strapi.
These examples are built around FoodAdvisor, which is no longer Strapi's featured demo application (it has been superseded by LaunchPad). What matters here is understanding the backend mechanisms being demonstrated, not FoodAdvisor itself. These pages will be revisited to use LaunchPad.
The present section of the documentation is intended for developers who would like to get a deeper understanding of the Strapi back end customization possibilities.
The section is a collection of examples that demonstrate how the core components of the back-end server of Strapi can be used in a real-world project. Front-end code that interacts with the back end may also be part of some examples, but displayed in collapsed blocks by default since front-end code examples are not the main focus of this cookbook.
Examples are meant to extend the features of FoodAdvisor, the official Strapi demo application. FoodAdvisor builds a ready-made restaurants directory powered by a Strapi back end (included in the /api folder) and renders a Next.js-powered front-end website (included in the /client folder).
- ๐ You have read the Quick Start Guide and/or understood that Strapi is a headless CMS that helps you create a content structure with the Content-Type Builder and add some content through the Content Manager, then exposes the content through APIs.
- ๐ You have read the back-end customization introduction to get a general understanding of what routes, policies, middlewares, controllers, and services are in Strapi.
- ๐ท If you want to test and play with the code examples by yourself, ensure you have cloned the FoodAdvisor repository, setup the project, and started both the front-end and back-end servers. The Strapi admin panel should be accessible from `localhost:1337/admin` and the Next.js-based FoodAdvisor front-end website should be running on `localhost:3000`.
This section can be read from start to finish, or you might want to jump directly to a specific page to understand how a given core element from the Strapi back end can be used to solve a real-world use case example:
| I want to understandโฆ | Dedicated page |
|---|---|
| How to authenticate my queries | Authentication flow with JWT |
| How and when to use custom controllers and services | Custom controllers and services examples |
| How to use custom policies and send custom errors | Custom policies examples |
| How to configure and use custom routes | Custom routes examples |
| How and when to use custom global middlewares | Custom middleware example |