<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged datastudio</title>
<link>https://coderlegion.com/tag/datastudio</link>
<description>Powered by Question2Answer</description>
<item>
<title>Directus Collections Explained (Fields, Types &amp; Setup) — Directus Basics Part 1</title>
<link>https://coderlegion.com/24271/directus-collections-explained-fields-types-setup-directus-basics-part-1</link>
<description>&lt;blockquote&gt;&lt;p&gt;This is Part 1 of a three-part series on Directus fundamentals: &lt;strong&gt;Collections&lt;/strong&gt; (this post), &lt;strong&gt;Relationships&lt;/strong&gt;, and &lt;strong&gt;Permissions&lt;/strong&gt;. New to Directus? Start here.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.youtube.com/watch?v=tJGuxqhv2SY&amp;amp;t=2s&quot;&gt;Youtube Video - Directus Collections&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;introduction&quot;&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Collections are the bread and butter of the Directus Data Studio. According to &lt;a rel=&quot;nofollow&quot; href=&quot;https://directus.com/docs&quot;&gt;Directus's own docs&lt;/a&gt;, collections are database tables — with extra metadata and configuration layered on top by Directus.&lt;/p&gt;
&lt;p&gt;The part that makes this genuinely beginner-friendly: you never write a single line of SQL. The Data Studio handles all of that for you. Let's build one.&lt;/p&gt;
&lt;h3 id=&quot;two-ways-to-create-a-collection&quot;&gt;Two Ways to Create a Collection&lt;/h3&gt;
&lt;p&gt;There are two paths to collection creation inside the Data Studio.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Option 1:&lt;/strong&gt; Log into your Data Studio and look at the sidebar for the icon that looks like a 3D box — that's &lt;strong&gt;Content&lt;/strong&gt;. Click it, and on the main screen you'll see &lt;strong&gt;Create Collection&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Option 2:&lt;/strong&gt; Scroll down the sidebar to the gear icon — &lt;strong&gt;Settings&lt;/strong&gt;. Click in, and at the top you'll find &lt;strong&gt;Data Model&lt;/strong&gt;. Same deal from there — &lt;strong&gt;Create Collection&lt;/strong&gt; is right on the main screen.&lt;/p&gt;
&lt;p&gt;Either path lands you in the same place.&lt;/p&gt;
&lt;h3 id=&quot;creating-a-collection&quot;&gt;Creating a Collection&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;Create Collection&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Name it something intuitive — it should describe exactly what data you're storing. For this example, we're creating a collection called &lt;strong&gt;products&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Ignore &lt;strong&gt;Singleton&lt;/strong&gt; for now (more on this below)&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Type&lt;/strong&gt; dropdown, select &lt;strong&gt;Generated UUID&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Next&lt;/strong&gt;, select all the boxes offered, and click &lt;strong&gt;Finish Setup&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;What is Singleton?&lt;/strong&gt; You'd only check this if the collection will ever hold exactly one item — not the case here, since we're storing many products.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is the Generated UUID?&lt;/strong&gt; A unique ID automatically assigned to every item in the collection, so you never have to manage IDs manually.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Once created, you land on the collection's screen, ready to build its data structure.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bonus:&lt;/strong&gt; under &lt;strong&gt;Collection Setup&lt;/strong&gt;, you can customize how the collection looks — a color, an icon, and a short note describing its purpose. Small detail, but it pays off once your Directus project has a dozen collections in it.&lt;/p&gt;
&lt;h3 id=&quot;creating-fields-within-a-collection&quot;&gt;Creating Fields Within a Collection&lt;/h3&gt;
&lt;p&gt;Fields represent the actual data you're storing — in this case, the data that describes a single product. Every item in the collection shares this same structure, just with different values. Here's the full field breakdown for a &lt;strong&gt;products&lt;/strong&gt; collection:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Field         &lt;/th&gt;&lt;th&gt;Type            &lt;/th&gt;&lt;th&gt;Notes&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;name&lt;/code&gt;        &lt;/td&gt;&lt;td&gt;Input (string)  &lt;/td&gt;&lt;td&gt;The product's name&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;brief&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Textarea        &lt;/td&gt;&lt;td&gt;Short description — more room than Input, no special formatting needed&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;description&lt;/code&gt; &lt;/td&gt;&lt;td&gt;WYSIWYG         &lt;/td&gt;&lt;td&gt;Full rich-text formatting — paragraphs, bullet lists, H1–H4 headings&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;price&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;Input (decimal) &lt;/td&gt;&lt;td&gt;See Precision &amp;amp; Scale below&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;sale&lt;/code&gt;        &lt;/td&gt;&lt;td&gt;Input (decimal) &lt;/td&gt;&lt;td&gt;Same setup as &lt;code&gt;price&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;isOnSale&lt;/code&gt;    &lt;/td&gt;&lt;td&gt;Boolean         &lt;/td&gt;&lt;td&gt;Toggle the front end can check to decide which price to show&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;category&lt;/code&gt;    &lt;/td&gt;&lt;td&gt;Dropdown        &lt;/td&gt;&lt;td&gt;Product type — e.g. jersey, pants&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;quantity&lt;/code&gt;    &lt;/td&gt;&lt;td&gt;Input (integer) &lt;/td&gt;&lt;td&gt;Minimum value of 1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;image&lt;/code&gt;       &lt;/td&gt;&lt;td&gt;File            &lt;/td&gt;&lt;td&gt;Product photo&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id=&quot;setting-up-the-price-field-precision-amp-scale-&quot;&gt;Setting Up the Price Field (Precision &amp;amp; Scale)&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;price&lt;/code&gt; field needs a bit of extra configuration. Instead of clicking &lt;strong&gt;Save&lt;/strong&gt; right away, look just below the Save button for &lt;strong&gt;Continue in Advanced Field Creation Mode&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In there, you'll find &lt;strong&gt;Precision&lt;/strong&gt; and &lt;strong&gt;Scale&lt;/strong&gt;, defaulting to &lt;code&gt;10&lt;/code&gt; and &lt;code&gt;5&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Precision&lt;/strong&gt; — the total number of digits the field accepts&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scale&lt;/strong&gt; — how many of those digits sit after the decimal point&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Left at the defaults, you'd get something like &lt;code&gt;12345.67890&lt;/code&gt;. For a price field, that's overkill — we want 7 digits total, 2 of them after the decimal point. So: &lt;strong&gt;Precision = 7&lt;/strong&gt;, &lt;strong&gt;Scale = 2&lt;/strong&gt;. Adjust to fit your own use case if you need more decimal precision.&lt;/p&gt;
&lt;p&gt;Build &lt;code&gt;sale&lt;/code&gt; the exact same way.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;Note on relational fields:&lt;/strong&gt; collection relationships (linking one collection to another) are deliberately left out here — that's a big enough topic to earn its own post, and it's exactly what's coming next in this series.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;adding-your-data&quot;&gt;Adding Your Data&lt;/h3&gt;
&lt;p&gt;Head to the sidebar and click the box icon — &lt;strong&gt;Content&lt;/strong&gt;. You'll see your &lt;strong&gt;Products&lt;/strong&gt; collection listed. Click &lt;strong&gt;Create Item&lt;/strong&gt;, and fill in the fields with real data.&lt;/p&gt;
&lt;p&gt;For this example, add a couple of items — a jersey and a pair of jeans — to see the collection actually holding data.&lt;/p&gt;
&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;
&lt;p&gt;That's the foundation of Directus collections: the core field types, how to configure them, and how to get real data in. Next up in this series: &lt;strong&gt;relationships&lt;/strong&gt; — how collections connect to each other, which is where Directus really starts to shine.&lt;/p&gt;
&lt;p&gt;Questions or stuck on something? Drop a comment below.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/24271/directus-collections-explained-fields-types-setup-directus-basics-part-1</guid>
<pubDate>Fri, 07 Aug 2026 21:18:22 +0000</pubDate>
</item>
</channel>
</rss>