📄 | .babelrc |
📄 | .gitignore |
📄 | .nvmrc |
📄 | .python-version |
📄 | README.md |
📄 | api.js |
📁 | app |
📁 | build |
📁 | config |
📄 | knexfile.js |
📁 | migrations |
📄 | package.json |
📄 | render.js |
📄 | static.js |
README.md
business-stack
work in progress
real-world, production-quality stack for Craftworks
stack
- task runner: npm scripts
- client bundler: browserify
- es6/jsx transform: babelify
- css transform: cssify and css-modules-require-hook
- bulk require: bulkify
- configuration: simple-rc
- utility functions: ramda
- directory structure:
/config/
/config/defaults.js
/config/{ NODE_ENV }.js
/app/
- symlink
/app
to/node_modules/app
/app/package.json
/app/client.js
/app/server.js
/app/reducer.js
/app/routes.js
/app/thing/model.js
/app/thing/service.js
/app/thing/client.js
/app/thing/routes.js
/app/thing/actions.js
/app/thing/reducer.js
/app/thing/getters.js
/app/thing/components/thing-list.js
/app/thing/components/thing-list.css
/app/thing/spec/components/thing-list.js
/app/thing/index.feature
/app/thing/steps.js
/app/list-view/index.js
- only do relative requires if within module
- otherwise, always require top-down (
require('app/things/model')
).
- symlink
- data model: tcomb
- database: knex
- data validator: tcomb-validator
- api service: feathers-knex
- api authentication: feathers-authentication
- api transport: primus
- api client: feathers-client
- client async actions: redux-thunk
- client action creators: redux-tcomb
- client action types: create-action-types
- client action store: redux
- client reducers: redux-tcomb
- client getters: reselect
- client router: redux-router
- client views: react
- client forms: tcomb-form
- test specs: ava
- test features: cuke-tap
- generators: plop
micro-services
TODO split into micro-services based on mad-science-stack
TODO write docs about what is a micro-service
app modules
in contrast to frameworks like Rails which split our app
into directories for each "type" of file (models, views, controllers), our app
is split into directories for each module, where each module contains the various types of files within that module.
each module directory may contain any of:
index.js
: exports all the below exports from the modulemodels/*.js
: exportstcomb
modelsconstants.js
: exports constants (such as redux action types)actions.js
: exports redux actionsreducer.js
: exports redux reducerroutes.js
: exportsfunction (store) { return <ReactRouter.Route /> }
getters.js
: exportsreselect
getters for use in containers'connect
containers/*.js
: exports smart componentconnect
ed withreact-redux
components/*.js
: exports dumb componentcomponents/*.css
: exports css modules for respective componentservice.js
: exportsfeathers
service (recommended to usefeathers-knex
andfeathers-tcomb
)client.js
: exportsfeathers-client
setup postgres database
install docker
- to install db, run
npm run pg:pull
- to create db, run
npm run pg:run
- to start db, run
npm run pg:start
- to stop db, run
npm run pg:stop
- to remove db, run
npm run pg:rm
- to show db logs, run
npm run pg:logs
run latest migrations with
npm run knex -- migrate:latest
or run [any other knex
command] with npm run knex -- [command] [args]
known issues
- adding a new file won't always be noticed by
node-dev
orwatchify
due to usage ofbulk-require
). potential fix is to usechokidar-cli
and some transform to watch for new files and re-run the script command
Built with git-ssb-web