Skip to content

Latest commit

 

History

History
74 lines (52 loc) · 2.88 KB

README.md

File metadata and controls

74 lines (52 loc) · 2.88 KB

SailPan

Sailing Through the Pandemic was a website providing information to ocean voyagers and liveaboard sailors about port closures and government restrictions related to the COVID-19 pandemic. This monorepo contains all frontend and backend code for the site.

Backend

The backend API is served by Strapi using GraphQL. We persist with SQLite in development and MySQL in production, both connected to Strapi through Bookshelf.

Frontend

The frontend is written in React and Next.js. Styling is done with styled jsx. Maps are rendered by Mapbox with react-map-gl. We use Apollo to parse the GraphQL provided by the backend.

Install

You'll want node 12 LTS, yarn and a clone of this repository.

git clone git@github.com:jameshome/sailpan.git
cd sailpan
yarn install-backend
yarn install-frontend
yarn dev

This will install required node_modules and start dev instances of the frontend and backend. You can also start the frontend and backend separately, check out the root level package.json for help.

Dev Notes

  • css: Set all colors, elevations, and fonts in utils/style. Call the corresponding object properties in each component's <style jsx> elements. Use global css and inline styling sparingly.

  • js: Use the Prettier defaults. Use function components and Hooks instead of classes.

Deployment

Strapi and Next.js are both run as pm2 processes, proxied through nginx.

Production installation looks something like this:

git clone git@github.com:jameshome/sailpan.git dist
cd dist/backend
yarn
scp example.com:~/src/sailpan/frontend/.env .
env NODE_ENV=production yarn build
pm2 start ecosystem.config.js
cd dist/frontend
yarn
scp example.com:~/src/sailpan/backend/.env .
env NODE_ENV=production yarn build
pm2 start ecosystem.config.js
pm2 startup
pm2 save

Ultimately deployment will be automated, but until then:

cd dist
git pull
cd dist/backend
env NODE_ENV=production yarn build
pm2 restart ecosystem.config.js
cd ../frontend
env NODE_ENV=production yarn build
pm2 restart ecosystem.config.js

Thank you

Tools

GPS Coordinate Converter