Skip to content

root-systems/cobuy

Repository files navigation

cobuy

🌱 πŸ“¦ 🍲 πŸ‘ͺ Helping people buy good food at good prices, together.

Waffle.io - Columns and their card count

Table of Contents

Setup

Before we start, please

git lfs install
git clone git@github.com:root-systems/cobuy
cd cobuy
npm run burnthemall # TODO npm install
# see 'How to get private development config' section below
npm run db migrate:latest
npm run db seed:run
npm run dev

System Dependencies

How our stack works

Technical breakdown and references for/as examples

Basic relationships between things (very roughly and probably slightly incorrectly)

  • Dumb components
    • components && style files
    • components && their local state
  • Higher-order components (HOC) or containers
    • (container && getters && props && actions) && dumb component/s
  • Dataflow within the client
    • from state to components
      • state -> getters -> HOC components (containers) -> dumb components
    • from components to state
      • dumb components -> HOC components (containers) -> actions -> updaters && epics -> state
    • from components to state with redux-form
      • dumb components -> redux-form -> redux-form state
  • Dataflow between client and server
    • actions -> services && hooks -> db
    • services && hooks && db tables

Also see the Captain's Log for more epistolary notes

Stack

dogstack! 🐢 🐢 🐢

Folder Structure

We're following the dogstack folder structure convention.

  • root
    • actions.js (combines all actions)
    • client.js
    • epic.js (combines all epics)
    • layout.js
    • package.json
    • root.js
    • routes.js
    • server.js
    • store.js (combines top-level epic and updater)
    • style.js
    • updater.js (combines all updaters)
    • topic (e.g. agents)
      • containers
      • components
      • helpers
      • getters
      • services
      • dux
      • styles
      • stories
      • util

Available Scripts

npm start

Starts production server

npm start

npm run dev

Starts development server

npm run dev

npm run storybook

Starts storybook server

npm run storybook

npm test

Runs ava tests

Can optionally take a glob

npm test -- './todos/**/*.test.js'

Default glob is ./**/*.test.js ignoring node_modules

npm run lint

Checks for standard style

Can optionally take a glob

npm run lint -- './todos/**/*.js'

default glob is ./**/*.js ignoring node_modules

npm run db

Runs knex command, with any arguments.

npm run db migrate:latest
npm run db seed:run

Developer Notes

Anything that a developer working on Cobuy should know about.

TODO organize all the miscy mushy magic

Postgres DEV setup

Use a ~/.pgpass file to automate your passwords!

echo "localhost:5432:*:postgres:password" > ~/.pgpass
chmod 600 ~/.pgpass

Create your database with:

createdb cobuy_development -h localhost -U postgres

Drop your database with:

dropdb cobuy_development -h localhost -U postgres

Connect to your database with:

psql -h localhost -U postgres -d cobuy_development

How to get private development config

Our development config is stored in a private repository:

cd ../
git clone git@github.com:Enspiral-Pods-Swarm/cobuy-config
cp cobuy-config/*.js cobuy/config

After deploy: migrate on heroku!

heroku run npm run db migrate:latest --app=cobuy

JSON schema

All models must have an assoicated JSON schema. See #118 for more info.

We're using json-schema-faker to fake data for tests and storybook.

How to storybook

So you want to tell a story about dumb React components, ey?

Start storybook with npm run storybook

The configuration for storybook lives in .storybook/.

The stories are in ${topic}/stories/index.js. The dumb components are in ${topic}/components/${name}.js

If you add a "story", please add your topic story to .storybook/config.js

Check out app/stories/index.js for example stories, which you can copy into a new topic.

NOTE: At the moment, hot-reload does not work when changing messages in app/locales/*.json.

Numbers

All numbers should be represented as strings and manipulated with bigmath.

Spelling in the code

Developers should be using British spelling in the codebase

Assets

All assets (binary files) should be checked in using Git LFS:

git lfs add <file>

They must also be manually added to our production OpenStack Object storage cobuy-assets container.

This can be found at: https://dashboard.cloud.catalyst.net.nz/project/containers/container/cobuy-assets

Ensure the name of the file is the same locally and remotely.

License

AGPL-3.0

Emoji artwork is provided by EmojiOne and is licensed under CC-BY 4.0

About

🌱 πŸ“¦ 🍲 πŸ‘ͺ Helping people buy good food at good prices, together.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published