Skip to main content

Backend customization: An examples cookbook using FoodAdvisor

πŸ— Work in progress

The content of this page might not be fully up-to-date with Strapi 5 yet.

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).

Prerequisites
  • πŸ‘€ You have read the Quick Start Guide and/or understood that Strapi is a headless CMS that helps you create a data 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 queriesAuthentication 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 routesCustom routes examples
How and when to use
custom global middlewares
Custom middleware example