{"id":19865116,"url":"https://github.com/glweems/gatsby-starter-rendering-modes","last_synced_at":"2025-07-07T01:04:31.430Z","repository":{"id":97290902,"uuid":"429830589","full_name":"glweems/gatsby-starter-rendering-modes","owner":"glweems","description":"An example starter using new rendering modes in Gatsby 4","archived":false,"fork":false,"pushed_at":"2021-11-19T14:41:33.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-01T00:32:37.574Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glweems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-19T14:41:02.000Z","updated_at":"2021-11-19T14:41:36.000Z","dependencies_parsed_at":"2023-06-26T09:00:28.612Z","dependency_job_id":null,"html_url":"https://github.com/glweems/gatsby-starter-rendering-modes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/glweems/gatsby-starter-rendering-modes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glweems%2Fgatsby-starter-rendering-modes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glweems%2Fgatsby-starter-rendering-modes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glweems%2Fgatsby-starter-rendering-modes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glweems%2Fgatsby-starter-rendering-modes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glweems","download_url":"https://codeload.github.com/glweems/gatsby-starter-rendering-modes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glweems%2Fgatsby-starter-rendering-modes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263996042,"owners_count":23541399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T15:21:12.923Z","updated_at":"2025-07-07T01:04:31.412Z","avatar_url":"https://github.com/glweems.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- AUTO-GENERATED-CONTENT:START (STARTER) --\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.gatsbyjs.com\"\u003e\n    \u003cimg alt=\"Gatsby\" src=\"https://www.gatsbyjs.com/Gatsby-Monogram.svg\" width=\"60\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003e\n  Gatsby Starter Rendering Modes\n\u003c/h1\u003e\n\nKick off your project with this example boilerplate, which includes examples of how to use the different rendering modes available for gatsby. Now, you can render ahead of time(SSG), just in time(SSR), or fashionably late(DSG)💃.\n\n_Have another more specific idea? You may want to check out our vibrant collection of [official and community-created starters](https://www.gatsbyjs.com/starters/)._\n\n## 🚀 Quick start (Gatsby Cloud)\n\nDeploy this starter with one click on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/):\n\n[\u003cimg src=\"https://www.gatsbyjs.com/deploynow.svg\" alt=\"Deploy to Gatsby Cloud\"\u003e](https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-starter-rendering-modes)\n\n\n## 🚀 Quick start (CLI)\n\n1.  **Create a Gatsby site.**\n\n    Use the Gatsby CLI ([install instructions](https://www.gatsbyjs.com/docs/tutorial/part-0/#gatsby-cli)) to create a new site, specifying the rendering-modes starter.\n\n    ```shell\n    # create a new Gatsby site using the hello-world starter\n    npx gatsby new gatsby-starter-rendering-modes https://github.com/gatsbyjs/gatsby-starter-rendering-modes\n    ```\n\n2.  **Start developing.**\n\n    Navigate into your new site’s directory and start it up.\n\n    ```shell\n    cd gatsby-starter-rendering-modes/\n    npm start\n    ```\n\n3.  **Open the source code and start editing!**\n\n    Your site is now running at `http://localhost:8000`!\n\n    _Note: You'll also see a second link: _`http://localhost:8000/___graphql`_. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the [Gatsby tutorial](https://www.gatsbyjs.com/tutorial/part-five/#introducing-graphiql)._\n\n    Open the `gatsby-starter-rendering-modes` directory in your code editor of choice and edit `src/pages/index.js`. Save your changes and the browser will update in real time!\n\n\n## Important Pages\n- `src/pages/ssr.js` uses the `getServerData` API to enable SSR mode\n- `src/templates/dsg.js` uses the `createPages` API to enable DSG\n\n## Using Deferred Static Generation(DSG) and Server Side Rendering(SSR)\n\n### DSG\n\nDeferred static Generation gives you the power to build only a part of your page and leave the rest until run-time\n\nto enable DSG, you simply add the `defer` property when creating pages in `gatsby-node` as shown below:\n\n``` gatsby-node.js\nconst path = require('path')\n\nexports.createPages = ({\n  actions,\n}) =\u003e {\n\n  actions.createPage({\n    path: '/dsg', // expected relative path\n    component: path.resolve('src/templates/dsg.js'), // this path goes to where the defered page should be expected\n    defer: true,\n  })\n}\n```\n\nAdd the link to an existing page in order to allow access to the page\n\n```\n  \u003cLink to='/dsg'\u003eDSG page\u003c/Link\u003e\n```\n\n### SSR\n\nto enable SSR, export an asynchronous function `getServerData` within the file where you wish to be able to dynamically retrieve content.\n\n```\nexport async function getServerData ({ params }) {\n  const data = await fetch(`https://dog.ceo/api/breeds/image/random`)\n    .then(res =\u003e res.json())\n\n  return {\n    props: {\n     // data has the shape of \"message\", \"status\" where message is the image src\n      image: data.message\n    }\n  }\n}\n```\n\naccess the data within the page using props:\n\n```\nexport default function SSR (props) {\n  const { image } = props.serverData\n  // ...rest of code\n}\n```\n\n## 🧐 What's inside?\n\nA quick look at the top-level files and directories you'll see in a Gatsby project.\n\n    .\n    ├──── src\n    │   └── pages\n    │       └── ssr.js\n    │   └── templates\n    │       └── dsg.js\n    ├── .gitignore\n    ├── gatsby-config.js\n    ├── gatsby-node.js\n    ├── LICENSE\n    ├── package-lock.json\n    ├── package.json\n    └── README.md\n\n1.  **`/src`**: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. `src` is a convention for “source code”.\n1.  **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.\n1.  **`gatsby-config.js`**: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the [config docs](https://www.gatsbyjs.com/docs/reference/config-files/gatsby-config/) for more detail).\n1.  **`gatsby-node.js`**: This file is where Gatsby expects to find any usage of the [Gatsby Node APIs](https://www.gatsbyjs.com/docs/reference/config-files/gatsby-node/) (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.\n1.  **`LICENSE`**: This Gatsby starter is licensed under the 0BSD license. This means that you can see this file as a placeholder and replace it with your own license.\n1. **`package-lock.json`** (See `package.json` below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(You won’t change this file directly).**\n1. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.\n1. **`README.md`**: A text file containing useful reference information about your project.\n\n\n## 🎓 Learning Gatsby\n\nLooking for more guidance? Full documentation for Gatsby lives [on the website](https://www.gatsbyjs.com/). Here are some places to start:\n\n- **For most developers, we recommend starting with our [in-depth tutorial for creating a site with Gatsby](https://www.gatsbyjs.com/tutorial/).** It starts with zero assumptions about your level of ability and walks through every step of the process.\n\n- **To dive straight into code samples, head [to our documentation](https://www.gatsbyjs.com/docs/).** In particular, check out the _Guides_, _API Reference_, and _Advanced Tutorials_ sections in the sidebar.\n\n## 💫 Deploy\n\n[Build, Deploy, and Host On The Only Cloud Built For Gatsby](https://www.gatsbyjs.com/products/cloud/)\n\nGatsby Cloud is an end-to-end cloud platform specifically built for the Gatsby framework that combines a modern developer experience with an optimized, global edge network.\n\n\u003c!-- AUTO-GENERATED-CONTENT:END --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglweems%2Fgatsby-starter-rendering-modes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglweems%2Fgatsby-starter-rendering-modes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglweems%2Fgatsby-starter-rendering-modes/lists"}