Let me just zoom in a bit. This is our admin panel. So this is what you see when you first get into Strapi. We have an admin user called Daniel Piri that we just created and now we get to build collection types.
So CMSs, like I mentioned, have the concept, headless CMSs have the concept of content modeling which is just creating like a data schema for how you want your data to be presented to your front end. In our case, we have what we call components, which I think would make a lot of sense because they're based on the components that we all know and these are just reusable sections. So these are a collection of fields that are reusable in multiple, multiple places. We have what we call collection types which are repeatable collection of fields. And then we have single types which are one use collections for fields.
So let's go ahead and build out our first content type. And we want this to be a collection type. One that I usually find very relatable is books. So we'll create a collection type called books. And what Strapi does and that's something that I really like is each collection type you create, you have a corresponding endpoint. So when we're done creating these collection types and we want to query the books endpoint, all we have to do is go to our URL. If this is localhost, that's localhost 1337, splash books, and then we'll be able to retrieve all the entries on that endpoint. Which is pretty cool.
So yeah, these are the fields that you can pick out. You have the text field, rich text field, a number field, a date boolean relation. The relation is really cool because it has polymorphic relations. Sorry, you have email, you have password enum, media for videos, links, audio, a JSON field and a UID field. And then these are the components that I talked about. And then we have what we call dynamic zones, which is a really, really interesting feature of Strapi that lets you dynamically add components to an entry and paired with like a lot of, like some magic or I don't want to call it magic because it's a bit of a word, paired with some like creative programming, you can sort of create some very interesting turnarounds and workflows. We've seen people create like forms or like page builders, like no code page builders where you have a bunch of components Strapi and these are matched to a bunch of components in your front end. And then by adding new pages in Strapi and using the dynamic zones, you can sort of build out pages in your front end, which is pretty cool. But yeah, let me keep demonstrating books and let's think about what a book's end point would look like or what books, what type of fields a book would need. I think a book could need a title, very important. A book would need an author, and one thing we have a chance of doing here, but I won't, is we could create another collection type called author, and then form a relation. And these are the relations that I talked about. Hey, are you asking me a question? I heard someone say something. Nevermind, okay. Yeah, as I was saying, one really cool thing we could do is we could make it so that, if we had an author field, or let's say user, and let's just, this is the Vennus letter, and what we could make it say is that every book could be there related to, maybe that's not the best one. But anyway, yeah, one could either be related to one, they could be related to each other. One book could be related to multiple authors, multiple books to one author, many to many, and all these really cool relations. So yeah, I think the relation field is pretty cool. So besides title, what else could we need, maybe like number of pages, number of pages, page, number. No, number of pages doesn't make sense. And then format, we have really interesting, I think page numbers are usually integer. Oops. That window doesn't look the best. And we'll add another field, and maybe cover. Let's see, cover, cover is usually like a single thing. It's like a picture. It's not necessarily multiple files. So once you've sort of created this, that is this supposed to be a page. Great, so we saved that into like a schema.json. I saw a question. Okay, well, the server is restarting. Let me look at that. Yeah, that is possible. So someone asked if it's possible to populate the different collection types that we could create in Strapi from a dataset like a CSV or a spreadsheet. We have seen that work. You can sort of create custom scripts that can fetch that data from whatever it is, a CSV or a spreadsheet, a markdown file, or a couple of markdown files, and then send that into the Strapi database. This would have to be custom, of course, but yes, it is possible. Great. So we have our books collection type here. And now we can start to enter data. So I don't know. What books do people read? Let me look at my shelf. It's quiet. Oh, number of pages. Then we could actually pick something. I don't know if I have images. Do I have any images that I can pick up? Ah, nice. It's just like random pictures that I have, and we'll upload that. And then one really cool thing we have also is we have a draft and publish feature of course, which is, the events have that. So right now our content is in the draft mode. And then if we want to publish that, so it's visible now we have a published piece. Okay, so now we have one entry, you can see this and then you can see the number of pages and then you have a cover. That's pretty cool.
Comments