3.7 KiB
title |
---|
freesewing.org |
This is the source code for FreeSewing.org, our main website.
It's a JAMStack site powered by Gatsby and hosted by Netlify.
The content (documentation, blog posts, and so on) is kept in our markdown repository and included in this repository as a submodule.
Getting started
To run your own copy of our website, follow these steps:
git clone --recurse-submodules git@github.com:freesewing/freesewing.org.git
cd freesewing
npm install
cp .env.example .env
npm run develop
We're using the --recurse-submodules
option to fetch the markdown submodule in one go.
However, this is only available in newer versions of git.
If after cloning the markdown
directory is empty,
please check these alternatives.
We're creating a copy of the .env.example
file here as it contains required environment variables.
For more details, see Environment variables below.
Gatsby will build your site and make it avaialable on http://localhost:8000.
There's also very useful GraphQL playground on http://localhost:8000/___graphql
Dependencies
Backend
Without a backend, certain aspects of the website won't work.
The backend needs to be configured in the GATSBY_BACKEND
environment variable.
To facilitate development, our backend is available as a Docker image that you can spin up. See the backend repo for more info.
Tiler (svg2pdf)
Without an svg2pdf backend (aka the tiler), the website won't be able to generate PDFs for patterns.
The svg2pdf backend needs to be configured in the GATSBY_TILER
environment variable.
You can spin up your own version of our svg2pdf repository. FreeSewing contributors can also simply point to https://tiler.freesewing.org.
Oauth
The website allows signing up/logging in via your Github or Google account.
We use Oauth for this, which has a few dependencies:
- You need to create/configure an app with Github and Google for Oauth
- You need to configure the various environment variables (see below)
If you don't setup/configure Oauth, everything will work, except Oath (duh).
Algolia
Algolia handles the search on the website.
This feature is not yet implemented.
Environment variables
The following variables configure different aspects of our website.
The .env.example
file contains the required variables to get the site up and running.
Var | Purpose | Example |
---|---|---|
GATSBY_LANGUAGE |
Determines the language of the site | en |
GATSBY_FRONTEND |
URL under which the website is served | http://localhost:8000/ |
GATSBY_BACKEND |
The location of the data backend | http://localhost:3000/ |
GATSBY_TILER |
The location of the tiler backend | http://localhost:4000/ |
GATSBY_GITHUB_CLIENT_ID |
The Github client ID used for Oauth | 13734754d4aa03f5c70e |
GATSBY_GOOGLE_CLIENT_ID |
The Google client ID used for Oauth | 730107872143-l1gfa3e0eerads4clqu458pblgpnu54h.apps.googleusercontent.com |
GATSBY_ALGOLIA_API_ID |
The Algolia client ID for search (under construction) | MA0Y5A2PF0 |
GATSBY_ALGOLIA_SEARCH_KEY |
The Algolia read only key for search (under construction) | 9209470ad243eee797156aa2874d886c |
GATSBY_ALGOLIA_UPDATE_KEY |
The write key to update the Algolia search index at build time (under construction) | ba780a3afe2118062ee08ea4fb54c097 |