{"result":{"depiction_url":null,"edges":{"hasreference":{"objects":[{"created":"2026-10-07T11:13:38Z","object_id":{"id":2914,"is_a":["text","documentation","developerguide"],"name":"developer_create_site","title":{"_type":"trans","tr":{"en":"Create your first site"}},"uri":"https:\/\/zotonic.com\/id\/2914"},"seq":1},{"created":"2026-10-07T11:13:38Z","object_id":{"id":2955,"is_a":["text","documentation","developerguide"],"name":"developer_datamodel_fixtures","title":{"_type":"trans","tr":{"en":"Install initial content with a datamodel"}},"uri":"https:\/\/zotonic.com\/id\/2955"},"seq":2}],"predicate":{"id":2774,"is_a":["meta","predicate"],"name":"hasreference","title":{"_type":"trans","tr":{"en":"Documentation reference"}},"uri":"https:\/\/zotonic.com\/id\/hasreference"}},"refers":{"objects":[{"created":"2026-10-07T11:13:03Z","object_id":{"id":1526,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_getting_started","title":{"_type":"trans","tr":{"en":"Set up a local development environment"}},"uri":"https:\/\/zotonic.com\/id\/1526"},"seq":1000000},{"created":"2026-10-07T11:13:03Z","object_id":{"id":2915,"is_a":["text","documentation","developerguide"],"name":"developer_first_template_change","title":{"_type":"trans","tr":{"en":"Change a template and see the result"}},"uri":"https:\/\/zotonic.com\/id\/2915"},"seq":1000000},{"created":"2026-10-07T11:13:03Z","object_id":{"id":3005,"is_a":["text","documentation","developerguide"],"name":"developer_cmd_addsite","title":{"_type":"trans","tr":{"en":"addsite: Create a site application from a skeleton"}},"uri":"https:\/\/zotonic.com\/id\/3005"},"seq":1000000},{"created":"2026-10-07T11:13:03Z","object_id":{"id":3045,"is_a":["text","documentation","developerguide"],"name":"developer_local_postgresql","title":{"_type":"trans","tr":{"en":"Prepare local PostgreSQL"}},"uri":"https:\/\/zotonic.com\/id\/3045"},"seq":1000000}],"predicate":{"id":2409,"is_a":["meta","predicate"],"name":"refers","title":{"_type":"trans","tr":{"en":"Refers"}},"uri":"https:\/\/zotonic.com\/id\/refers"}},"subject":{"objects":[{"created":"2026-10-07T11:13:38Z","object_id":{"id":2553,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_tutorial","title":"Tutorial","uri":"https:\/\/zotonic.com\/id\/2553"},"seq":1},{"created":"2026-10-07T11:13:38Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":2},{"created":"2026-10-07T11:13:38Z","object_id":{"id":2605,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_site_management","title":"Site management","uri":"https:\/\/zotonic.com\/id\/2605"},"seq":3},{"created":"2026-10-07T11:13:38Z","object_id":{"id":2568,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_content_modeling","title":"Content modeling","uri":"https:\/\/zotonic.com\/id\/2568"},"seq":4},{"created":"2026-10-07T11:13:38Z","object_id":{"id":2614,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_resource","title":"Resource","uri":"https:\/\/zotonic.com\/id\/2614"},"seq":5}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":1618,"is_a":["text","documentation","developerguide"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1618"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_bestpractices_creating_sites","page_url":{"en":"https:\/\/zotonic.com\/docs\/1618\/create-your-first-site","x-default":"https:\/\/zotonic.com\/docs\/1618\/create-your-first-site"},"preview_url":null,"resource":{"body":{"_type":"trans","tr":{"en":"<p>Start with a running Zotonic node from <a href=\"\/id\/1526\">your installation route<\/a>. Run the commands below from the repository root, inside the container or Nix shell if you chose one.<\/p>\n<h2>1. Create the example site<\/h2>\n<pre class=\"notranslate\"><code class=\"notranslate language-sh\">bin\/zotonic addsite -s blog -H garden.test garden\nbin\/zotonic status\n<\/code><\/pre>\n<p>The command creates <code>apps_user\/garden<\/code>, prepares the database schema, compiles the application, and starts it on the running node. Expect <code>garden<\/code> to reach the running state. Keep the generated admin password shown in the output; you need it for the next step.<\/p>\n<h2>2. Give your browser the local hostname<\/h2>\n<p>On the computer running your browser, add this line to its hosts file using an administrator-enabled text editor:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-text\">127.0.0.1 garden.test\n<\/code><\/pre>\n<p>The file is <code>\/etc\/hosts<\/code> on macOS\/Linux and <code>C:\\Windows\\System32\\drivers\\etc\\hosts<\/code> on Windows. For containers, edit the computer&#39;s hosts file, not just the container&#39;s. Keep any existing entries. You can skip this step if your local DNS already resolves <code>garden.test<\/code> to this machine.<\/p>\n<h2>3. Open the site and admin<\/h2>\n<p>Open <a href=\"https:\/\/garden.test:8443\/\">your garden site<\/a> in the browser. These examples use the default development HTTPS port 8443; use your configured port if different. Expect the blog home page. The generated development certificate may need a local browser exception.<\/p>\n<p>Open <a href=\"https:\/\/garden.test:8443\/admin\">the garden admin<\/a> and log in as <strong>admin<\/strong>, using the password printed by <code>addsite<\/code>. These are your site&#39;s credentials, separate from the status site&#39;s <code>wwwadmin<\/code> account.<\/p>\n<h2>4. Make your first change<\/h2>\n<p>Open <code>apps_user\/garden<\/code> in your editor, then follow <a href=\"\/id\/2915\">Change a template and see the result<\/a>. There is no need to create a custom module first.<\/p>\n<p>If the wrong site opens, check the hosts entry and <code>priv\/zotonic_site.config<\/code> hostname. If creation fails, read the error and inspect the partially created directory before retrying. Native database problems can be checked with <a href=\"\/id\/3045\">Prepare local PostgreSQL<\/a>; containers use database host <code>postgres<\/code>. See <a href=\"\/id\/3005\">addsite options<\/a> for a non-default configuration.<\/p>\n<h2>Install initial content with a datamodel<\/h2>\n<p>Use a datamodel for resources that a module needs on installation. Add this declaration and callback to the <code>mod_garden.erl<\/code> from the module-creation task:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">-include_lib(&quot;zotonic_core\/include\/zotonic.hrl&quot;).\n-mod_schema(1).\n-export([manage_schema\/2]).\n\n-spec manage_schema(Version, Context) -&gt; Datamodel\n    when Version :: install | {upgrade, pos_integer()},\n         Context :: z:context(),\n         Datamodel :: #datamodel{}.\nmanage_schema(install, _Context) -&gt;\n    #datamodel{\n        resources = [\n            {garden_welcome, text, #{\n                &lt;&lt;&quot;title&quot;&gt;&gt; =&gt; &lt;&lt;&quot;Welcome to the garden&quot;&gt;&gt;,\n                &lt;&lt;&quot;is_published&quot;&gt;&gt; =&gt; false\n            }}\n        ]\n    }.\n<\/code><\/pre>\n<p>Put declarations before functions and include the header only once. Compile and activate the module on a fresh local database-backed site. The module manager applies the returned datamodel; do not call the callback manually expecting it to create data. Confirm <code>m_rsc:rid(garden_welcome, C)<\/code> returns an ID and find the unpublished page in the admin.<\/p>\n<p>A module already installed with a schema version needs an explicit upgrade step for later changes. Give managed resources stable names, and decide which properties editors own. Test with an edited title before applying an upgrade: returning defaults must not be treated as permission to replace editorial work.<\/p>"}},"category_id":{"id":317,"is_a":["meta","category"],"name":"developerguide","title":"Developer guide","uri":"https:\/\/zotonic.com\/id\/developerguide"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2020-05-30T05:47:28Z","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"doc_editorial_bundle":true,"doc_editorial_edges":{"hasreference":[2914,2955],"subject":[2553,2564,2568,2605,2614]},"github_url":"https:\/\/github.com\/zotonic\/zotonic\/tree\/master\/doc\/best-practices\/creating-sites.rst","is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2026-10-07T11:13:46Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"name":"doc_bestpractices_creating_sites","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2022-02-15T10:01:39Z","slug":"create-your-first-site","summary":{"_type":"trans","tr":{"en":"Create the garden blog, open it in your browser, and sign in to its admin."}},"title":{"_type":"trans","tr":{"en":"Create your first site"}},"title_slug":{"_type":"trans","tr":{"en":"create-your-first-site"}},"tz":"UTC","uri":null,"version":38,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/1618","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1618"}},"status":"ok"}