{"id":13554440,"url":"https://github.com/root-systems/cobuy","last_synced_at":"2025-04-03T06:31:51.413Z","repository":{"id":72007001,"uuid":"82544969","full_name":"root-systems/cobuy","owner":"root-systems","description":":seedling: :package: :stew: :family: Helping people buy good food at good prices, together.","archived":false,"fork":false,"pushed_at":"2018-02-16T06:37:19.000Z","size":3425,"stargazers_count":25,"open_issues_count":150,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-04T02:32:53.524Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/root-systems.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":"2017-02-20T10:20:20.000Z","updated_at":"2024-08-30T11:29:38.000Z","dependencies_parsed_at":"2023-03-01T03:32:12.233Z","dependency_job_id":null,"html_url":"https://github.com/root-systems/cobuy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root-systems%2Fcobuy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root-systems%2Fcobuy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root-systems%2Fcobuy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/root-systems%2Fcobuy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/root-systems","download_url":"https://codeload.github.com/root-systems/cobuy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246948113,"owners_count":20859384,"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-08-01T12:02:47.899Z","updated_at":"2025-04-03T06:31:49.922Z","avatar_url":"https://github.com/root-systems.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"readme":"# cobuy\n\n:seedling: :package: :stew: :family: Helping people buy good food at good prices, together.\n\n[![Waffle.io - Columns and their card count](https://badge.waffle.io/root-systems/cobuy.svg?columns=Ready,In%20Progress,Review,Done\u0026style=flat-square)](http://waffle.io/root-systems/cobuy)\n\n## Table of Contents\n\n- [Setup](#setup)\n- [How our stack works](#how-our-stack-works)\n- [Stack](#stack)\n- [Folder Structure](#folder-structure)\n- [Available Scripts](#available-scripts)\n  - [npm start](#npm-start)\n  - [npm run dev](#npm-run-dev)\n  - [npm test](#npm-test)\n  - [npm run lint](#npm-run-lint)\n  - [npm run db](#npm-run-db)\n- [Developer Notes](#developer-notes)\n- [License](#license)\n\n## Setup\n\nBefore we start, please\n\n- [install `node@8` and `npm@5`](https://dogstack.js.org/guides/how-to-install-js.html)\n- [install Git LFS](https://git-lfs.github.com/)\n- [install and set up Postgres for your system](https://dogstack.js.org/guides/how-to-setup-sql-db.html)\n- create a database in Postgres named `cobuy_development` (i.e. using a command like `CREATE DATABASE cobuy_development;` in `psql`)\n\n```shell\ngit lfs install\ngit clone git@github.com:root-systems/cobuy\ncd cobuy\nnpm run burnthemall # TODO npm install\n# see 'How to get private development config' section below\nnpm run db migrate:latest\nnpm run db seed:run\nnpm run dev\n```\n\n### System Dependencies\n\n- Postgres\n- [`git-lfs`](https://git-lfs.github.com/)\n\n## How our stack works\n\n### Technical breakdown and references for/as examples\n\n- Cobuy uses [`dogstack`](https://dogstack.js.org)\n- React and JSX for DOM stuff, as per, but also [Hyperscript](https://github.com/mlmorg/react-hyperscript) as an alternative to JSX\n- [Recompose](https://github.com/acdlite/recompose) in our React components for purity\n  - Files: `app/components/Navigation.js`\n  - PRs: https://github.com/root-systems/cobuy/pull/100/files\n- [Fela](https://github.com/rofrischmann/fela) to manage styles\n  - Files: `\u003cany dumb component and its style file\u003e`\n- [Material-UI](http://www.material-ui.com/) for ready-styled components\n  - Files: `\u003cany component that has buttons or text fields or sliders\u003e`\n- [React-intl](https://github.com/yahoo/react-intl) to manage internationalization\n  - Files: `app/locales/en.json`, `\u003cany component with text\u003e`\n  - https://github.com/root-systems/cobuy/pull/80\n- [Storybook](https://github.com/storybooks/storybook) for developing and testing our dumb components easily\n  - Files: `.storybook/config.js`, `agents/stories/index.js`, `agents/stories/Profile.js`\n  - PRs: https://github.com/root-systems/cobuy/pull/51/files\n- Redux for state management, as per\n- [Redux-fp](https://github.com/rvikmanis/redux-fp) for 'updaters' instead of 'reducers'\n  - Files: `*/updaters/*`\n  - PRs: https://github.com/root-systems/cobuy/pull/103/files\n- [Redux-observable](redux-observable.js.org) for managing async operations\n  - Files: `ordering/epic.js`, \n  - PRs: https://github.com/root-systems/cobuy/pull/103/files\n- [Redux-form](http://redux-form.com/6.8.0/) to connect React forms to state\n  - Files: `agents/components/SignIn.js`\n  - PRs: https://github.com/root-systems/cobuy/pull/59/files\n- [Reselect](https://github.com/reactjs/reselect) for our getters\n  - Files: `*/getters/*`\n  - PRs: https://github.com/root-systems/cobuy/pull/104/files\n- [Ramda](http://ramdajs.com/) as our general utility library with a strongly functional flavour\n  - Files: `\u003calmost any\u003e`\n- [Feathers](https://feathersjs.com/) for our backend API layer\n  - PRs: https://github.com/root-systems/cobuy/pull/116\n- [Feathers-reactive](https://github.com/feathersjs/feathers-reactive)\n- [Feathers-action-react](https://github.com/ahdinosaur/feathers-action-react)\n- [Feathers-action](https://github.com/ahdinosaur/feathers-action) to provide CRUD actions out of the box\n  - Files: `*/dux/*`, `*/services/*`, `*/containers/*`, `server.js`, \n  - PRs: https://github.com/root-systems/cobuy/pull/116\n- [Knex](http://knexjs.org/) for interfacing with DB\n  - Files: `db/migrations/*`\n  - PRs: https://github.com/root-systems/cobuy/pull/116/files\n- [Dogstack-agents](https://github.com/dogstack/dogstack-agents) to manage users and credentials\n  - Files: `agents/containers/Register.js`\n  - PRs: https://github.com/root-systems/cobuy/pull/59/files\n  \n### Basic relationships between things (very roughly and probably slightly incorrectly)\n\n- Dumb components\n  - components \u0026\u0026 style files\n  - components \u0026\u0026 their local state\n- Higher-order components (HOC) or containers\n  - (container \u0026\u0026 getters \u0026\u0026 props \u0026\u0026 actions) \u0026\u0026 dumb component/s\n- Dataflow within the client\n  - from state to components\n    - state -\u003e getters -\u003e HOC components (containers) -\u003e dumb components\n  - from components to state\n    - dumb components -\u003e HOC components (containers) -\u003e actions -\u003e updaters \u0026\u0026 epics -\u003e state\n  - from components to state with redux-form\n    - dumb components -\u003e redux-form -\u003e redux-form state\n- Dataflow between client and server\n  - actions -\u003e services \u0026\u0026 hooks -\u003e db\n  - services \u0026\u0026 hooks \u0026\u0026 db tables\n  \n### Also see the [Captain's Log](https://github.com/root-systems/cobuy/issues/123) for more epistolary notes\n\n## Stack\n\n[`dogstack`](https://dogstack.js.org)! :dog: :dog: :dog:\n\n## Folder Structure\n\nWe're following the [dogstack folder structure convention](https://dogstack.js.org/conventions/file-structure.html).\n\n- root\n  - actions.js (combines all actions)\n  - client.js\n  - epic.js (combines all epics)\n  - layout.js \n  - package.json\n  - root.js\n  - routes.js\n  - server.js\n  - store.js (combines top-level epic and updater)\n  - style.js\n  - updater.js (combines all updaters)\n  - `topic` (e.g. `agents`)\n    - containers\n    - components\n    - helpers\n    - getters\n    - services\n    - dux\n    - styles\n    - stories\n    - util\n\n### Available Scripts\n\n### `npm start`\n\nStarts production server\n\n```shell\nnpm start\n```\n\n### `npm run dev`\n\nStarts development server\n\n```shell\nnpm run dev\n```\n\n### `npm run storybook`\n\nStarts [storybook](https://storybook.js.org) server\n\n```shell\nnpm run storybook\n```\n\n### `npm test`\n\nRuns [`ava`](https://github.com/avajs/ava) tests\n\nCan optionally take a [glob](https://www.npmjs.com/package/glob)\n\n```shell\nnpm test -- './todos/**/*.test.js'\n```\n\nDefault glob is `./**/*.test.js` ignoring `node_modules`\n\n### `npm run lint`\n\nChecks for [standard style](http://standardjs.com)\n\nCan optionally take a [glob](https://www.npmjs.com/package/glob)\n\n```shell\nnpm run lint -- './todos/**/*.js'\n```\n\ndefault glob is `./**/*.js` ignoring `node_modules`\n\n### `npm run db`\n\nRuns [`knex`](http://knexjs.org/#Migrations-CLI) command, with any arguments.\n\n```shell\nnpm run db migrate:latest\n```\n\n```shell\nnpm run db seed:run\n```\n\n\n## Developer Notes\n\nAnything that a developer working on Cobuy should know about.\n\nTODO organize all the miscy mushy magic\n\n### Postgres DEV setup\n\nUse a [`~/.pgpass`](https://www.postgresql.org/docs/current/static/libpq-pgpass.html) file to automate your passwords!\n\n```shell\necho \"localhost:5432:*:postgres:password\" \u003e ~/.pgpass\nchmod 600 ~/.pgpass\n```\n\nCreate your database with:\n\n```shell\ncreatedb cobuy_development -h localhost -U postgres\n```\n\nDrop your database with:\n\n\n```shell\ndropdb cobuy_development -h localhost -U postgres\n```\n\nConnect to your database with:\n\n```shell\npsql -h localhost -U postgres -d cobuy_development\n```\n\n### How to get private development config\n\nOur development config is stored in a private repository:\n\n```shell\ncd ../\ngit clone git@github.com:Enspiral-Pods-Swarm/cobuy-config\ncp cobuy-config/*.js cobuy/config\n```\n\n### After deploy: migrate on heroku!\n\n```shell\nheroku run npm run db migrate:latest --app=cobuy\n```\n\n### JSON schema\n\nAll models must have an assoicated JSON schema. See [#118](https://github.com/root-systems/cobuy/issues/118) for more info.\n\nWe're using [json-schema-faker](https://github.com/json-schema-faker/json-schema-faker/#faking-values) to fake data for tests and storybook.\n\n### How to [storybook](https://storybook.js.org)\n\nSo you want to tell a story about dumb React components, ey?\n\nStart storybook with [`npm run storybook`](#npm-run-storybook)\n\nThe configuration for storybook lives in `.storybook/`.\n\nThe stories are in `${topic}/stories/index.js`. The dumb components are in `${topic}/components/${name}.js`\n\nIf you add a [\"story\"](https://storybook.js.org), please add your topic story to `.storybook/config.js`\n\nCheck out [`app/stories/index.js`](./app/stories/index.js) for example stories, which you can copy into a new topic.\n\nNOTE: At the moment, hot-reload does not work when changing messages in `app/locales/*.json`.\n\n### Numbers\n\nAll numbers should be represented as strings and manipulated with [`bigmath`](https://github.com/ahdinosaur/bigmath).\n\n### Spelling in the code\n\nDevelopers should be using British spelling in the codebase\n\n### Assets\n\nAll assets (binary files) should be checked in using [Git LFS](https://git-lfs.github.com/):\n\n```shell\ngit lfs add \u003cfile\u003e\n```\n\nThey must also be manually added to our production [OpenStack Object storage](http://docs.catalystcloud.io/object-storage.html) `cobuy-assets` container.\n\nThis can be found at: https://dashboard.cloud.catalyst.net.nz/project/containers/container/cobuy-assets\n\nEnsure the name of the file is the same locally and remotely.\n\n\n## License\n\nAGPL-3.0\n\nEmoji artwork is provided by [EmojiOne](https://www.emojione.com) and is licensed under [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froot-systems%2Fcobuy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froot-systems%2Fcobuy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froot-systems%2Fcobuy/lists"}