How would be the structure to a movie database with casts?

System Information
  • Strapi Version: Latest
  • Operating System: Windows 10
  • Database: SQLite 3
  • Node Version: v16.16.0
  • Yarn Version: 1.22.19

Hi everyone!

I just started using Strapi and I’m loving it, but I’m having quite the conundrum. I’m building a movie database, but I want to have casts.

For example:

A movie has:

  • Title
  • Year
  • Synopsis
  • Actor from Actors collection which plays a character (and can play more than one character)

I created a Movie and Actors collection and in the movie one I added a “Movie has many Actors” relation.
However, when I add a Movie, it won’t let an actor more than one time. Plus how would I associate that actor to a character? Is this possible in Strapi?

In JSON it would be something like:

  "title": "Pulp Fiction",
  "year": "1994",
  "synopsys": "Synopsis here...",
  "cast": {
    "actor1": "role",
    "actor1": "role",
    "actor2": "role"

you can define a new repetable component for cast which will have actor(one to one relation) and role and link this component with movie collection. In this way if one actor play 2 roles, you can add 2 rows for same actor and different roles.

Just tried and it works perfectly, thank you.
I just have one question related to this: will I be able to get all the movies where an actor participated and their roles?
Because I’ll want to have a page for each actor where it lists their movies and their roles.

Yes its possible. To achieve this, you need to write your own custom controller. I would suggest you to have different routes for different pages(if you need different type of data) and write respective controller to get data in desired format.