Skip to content

netliferesearch/byggelig-gatsby

Repository files navigation

Netlify Status

Byggelig

This is a web application based on the research from Bygg21. It is a tool for better collaboration, planning and execution for property development and construction.

Site: https://www.byggelig.no

Tech-stack

  • Frontend: React with Gatsby
  • Styling: SASS + classnames
  • Hosting/ops: Netlify
  • CMS: Sanity
  • Serverless: Netlify Functions

Alt text

Development

Frontend

  1. npm install
  2. npm run dev
  3. You find the frontend running at localhost:8000

Sanity

  1. cd studio
  2. Install Sanity: npm install -g @sanity/cli
  3. Install dependencies: npm i
  4. Run Sanity studio: sanity start
  5. You find Sanity Studio at localhost:3333

Important!
Remember to deploy changes to Studio after making changes to schemas: Run npm run deploy.

Also important!
Remember that even though you work locally, changes made to the content in Studio will be globally. If you need to experiment with the data, download and work on a copy of the dataset: https://www.sanity.io/docs/data-store/migrating-data

Sanity - manage users
https://manage.sanity.io/

Sanity - edit content
https://byggelig.sanity.studio/

Gatsby

If something is not working, you might try to build locally, and check your terminal for errors: npm run build.

Deployment

We use Netlify as a web host. This GitHub repo is connected Netlify, and Netlify will build whenever code is pushed to the master branch. Netlify also handles our serverless functions.

Netlify is also connected to Sanity with a webhook, and will build when something is changed in Sanity.

It should build in about a minute. If nothing changes then something in the build process went wrong. The build log in Netlify should tell you what. It is recommended connecting a Slack bot between the Netlify site and your Slack user when developing. If something goes wrong the last working version will be the version deployed in production.

Project rules

Additional styling rules

  • The components should have 100% width. Only the grid or other layout components should decide the width of components, except for components with display inline.
  • The components should not concern itself with spacing. There are wrapper classes handling the spacing.
  • Don't open Pandora's box. When using BEM; don't put elements in elements, or elements in modifiers. Block, Block -> Modifier, Block -> Element or Block -> Element -> Modifier, no other patterns are allowed because it will break the BEM rules, and end up cluttering the project.

SASS dependencies

Gatsby

Our site is based on: https://github.com/gatsbyjs/gatsby-starter-default and uses a plugin for pulling data from Sanity.io into Gatsby: https://www.gatsbyjs.org/packages/gatsby-source-sanity/

Checking for broken links

Every week (wednesday 09:00) a scheduled task triggers a webhook to our serverless function which then checks for broken links on our website. It will email the web editors with a link to a list of broken links and where to find them if there are any.

This service requires three services:

  • Zapier: for scheduling
  • Netlify Functions: For finding broken links and notifying
  • Sendgrid: API service for sending email

If there are any broken links, then the serverless function creates a HTML-page, with a list with broken links. If there are no broken links it tells you that there are no broken links. The errors might have been fixed since the editor received the email. On every build it will check for errors and update the HTML-page.

Variables is handeled in Netlify -> Byggelig -> Settings -> Build & deploy -> Environment
Here you can add and remove email recipients, and handle other stuff.

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •