├── client ├── utils │ ├── noop.js │ ├── classes.js │ ├── __tests__ │ │ ├── noop.spec.js │ │ ├── classes.spec.js │ │ └── fetch.spec.js │ ├── __mocks__ │ │ └── fetch-response.mock.js │ └── fetch.js ├── index.scss ├── components │ ├── app │ │ ├── index.js │ │ ├── __snapshots__ │ │ │ └── App.spec.js.snap │ │ ├── app.scss │ │ ├── App.jsx │ │ └── App.spec.js │ ├── nav │ │ ├── index.js │ │ ├── Nav.spec.js │ │ ├── Nav.jsx │ │ ├── __snapshots__ │ │ │ └── Nav.spec.js.snap │ │ └── nav.scss │ ├── about │ │ ├── index.js │ │ ├── about.scss │ │ ├── __snapshots__ │ │ │ └── About.spec.js.snap │ │ ├── About.jsx │ │ └── About.spec.js │ ├── counter │ │ ├── index.js │ │ ├── __snapshots__ │ │ │ └── Counter.spec.js.snap │ │ ├── counter.scss │ │ ├── Counter.jsx │ │ └── Counter.spec.js │ ├── clickable │ │ ├── index.js │ │ ├── clickable.scss │ │ ├── __snapshots__ │ │ │ └── Clickable.spec.js.snap │ │ ├── Clickable.jsx │ │ └── Clickable.spec.js │ ├── not-found │ │ ├── index.js │ │ ├── not-found.scss │ │ ├── NotFound.spec.js │ │ ├── __snapshots__ │ │ │ └── NotFound.spec.js.snap │ │ └── NotFound.jsx │ └── __mocks__ │ │ ├── styles.js │ │ └── context-hoc.js ├── favicon.ico ├── postcss.config.js ├── __setup__ │ ├── shim.js │ └── enzyme.js ├── styles │ ├── _palette.scss │ └── _mixins.scss ├── README.md ├── index.jsx ├── .babelrc ├── routes │ ├── links.js │ └── Root.js ├── .eslintrc ├── webpack.config.js ├── config │ ├── webpack.config.test.js │ ├── webpack.config.dev.js │ ├── webpack.config.prod.js │ └── webpack.config.common.js └── package.json ├── .browserslistrc ├── server ├── app.test.js ├── tests │ ├── config.js │ └── sample.test.js ├── routes │ ├── index.js │ └── sample.route.js ├── datastore │ ├── constants │ │ └── postgres-errors.js │ ├── stores │ │ ├── lookup.store.js │ │ ├── sample.store.js │ │ └── base.store.js │ ├── server │ │ └── docker-compose.yml │ ├── create │ │ ├── knexfile.js │ │ └── seeds │ │ │ └── create.js │ ├── seeds │ │ └── populate_sample_table.js │ ├── connection │ │ └── knexfile.js │ └── migrations │ │ ├── 20170518181737_create_sample_table.js │ │ └── 20170613154653_create_lookup_table.js ├── exceptions │ ├── not-found.exception.js │ ├── generic.exception.js │ ├── bad-request.exception.js │ ├── validation.exception.js │ └── index.js ├── index.js ├── utils │ ├── logger.js │ └── app.configure.js ├── services │ └── sample.service.js ├── config │ └── index.js ├── README.md ├── app.prod.js ├── package.json ├── app.dev.js └── yarn.lock ├── plop-templates └── component │ ├── {{ dashCase name }}.scss │ ├── {{ pascalCase name }}.spec.js │ └── {{ pascalCase name }}.jsx ├── .travis.yml ├── .prettierrc ├── docs ├── pull_request_template.md ├── issue_template.md ├── vscode.md └── setup.md ├── .editorconfig ├── plopfile.js ├── .gitignore ├── LICENSE ├── CONTRIBUTING.md ├── package.json ├── README.md └── .eslintrc /client/utils/noop.js: -------------------------------------------------------------------------------- 1 | export default () => {}; 2 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | # Supported browsers 2 | last 1 versions 3 | -------------------------------------------------------------------------------- /client/index.scss: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } 4 | -------------------------------------------------------------------------------- /server/app.test.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./app.prod'); 2 | -------------------------------------------------------------------------------- /client/components/app/index.js: -------------------------------------------------------------------------------- 1 | import App from './App'; 2 | 3 | export default App; 4 | -------------------------------------------------------------------------------- /client/components/nav/index.js: -------------------------------------------------------------------------------- 1 | import Nav from './Nav'; 2 | 3 | export default Nav; 4 | -------------------------------------------------------------------------------- /client/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UruIT/react-seed/HEAD/client/favicon.ico -------------------------------------------------------------------------------- /client/components/about/index.js: -------------------------------------------------------------------------------- 1 | import About from './About'; 2 | 3 | export default About; 4 | -------------------------------------------------------------------------------- /client/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [require('autoprefixer')] 3 | }; 4 | -------------------------------------------------------------------------------- /server/tests/config.js: -------------------------------------------------------------------------------- 1 | const test = require('tape'); 2 | 3 | test.onFinish(() => process.exit(0)); 4 | -------------------------------------------------------------------------------- /client/components/counter/index.js: -------------------------------------------------------------------------------- 1 | import Counter from './Counter'; 2 | 3 | export default Counter; 4 | -------------------------------------------------------------------------------- /client/components/clickable/index.js: -------------------------------------------------------------------------------- 1 | import Clickable from './Clickable'; 2 | 3 | export default Clickable; 4 | -------------------------------------------------------------------------------- /client/components/not-found/index.js: -------------------------------------------------------------------------------- 1 | import NotFound from './NotFound'; 2 | 3 | export default NotFound; 4 | -------------------------------------------------------------------------------- /client/__setup__/shim.js: -------------------------------------------------------------------------------- 1 | const raf = (global.requestAnimationFrame = cb => setTimeout(cb, 0)); 2 | 3 | export default raf; 4 | -------------------------------------------------------------------------------- /plop-templates/component/{{ dashCase name }}.scss: -------------------------------------------------------------------------------- 1 | @import '~styles/_palette'; 2 | 3 | .container { 4 | background: red; 5 | } 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | cache: yarn 3 | node_js: 4 | - 8 5 | install: yarn 6 | script: yarn coveralls || yarn test:client 7 | -------------------------------------------------------------------------------- /server/routes/index.js: -------------------------------------------------------------------------------- 1 | module.exports = function(app) { 2 | app.use('/api/sample', require('./sample.route')); 3 | // Add routes here 4 | }; 5 | -------------------------------------------------------------------------------- /client/styles/_palette.scss: -------------------------------------------------------------------------------- 1 | $black: #000; 2 | $black-2: #222; 3 | $black-05: rgba(0,0,0,0.5); 4 | $gold: #fbfb09; 5 | $slate: #415361; 6 | $white: #fff; 7 | -------------------------------------------------------------------------------- /client/components/__mocks__/styles.js: -------------------------------------------------------------------------------- 1 | const identityObject = new Proxy({}, { 2 | get: (target, prop) => prop 3 | }); 4 | 5 | export default identityObject; 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": true, 3 | "tabWidth": 4, 4 | "printWidth": 120, 5 | "jsxBracketSameLine": false, 6 | "semi": true, 7 | "singleQuote": true 8 | } 9 | -------------------------------------------------------------------------------- /client/utils/classes.js: -------------------------------------------------------------------------------- 1 | function classes(...classnames) { 2 | return classnames.filter(classname => !!classname).join(' '); 3 | } 4 | 5 | export default classes; 6 | -------------------------------------------------------------------------------- /client/components/about/about.scss: -------------------------------------------------------------------------------- 1 | @import '~styles/_palette'; 2 | 3 | .about { 4 | text-align: center; 5 | 6 | h1, h2 { 7 | color: $black-2; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /client/README.md: -------------------------------------------------------------------------------- 1 | # React Seed Client 2 | 3 | 4 | ## Dependencies 5 | 6 | Add new packages to the `client` project: 7 | 8 | ```bash 9 | yarn add 10 | ``` 11 | -------------------------------------------------------------------------------- /client/__setup__/enzyme.js: -------------------------------------------------------------------------------- 1 | import './shim'; 2 | import Enzyme from 'enzyme'; 3 | import Adapter from 'enzyme-adapter-react-16'; 4 | 5 | Enzyme.configure({ adapter: new Adapter() }); 6 | -------------------------------------------------------------------------------- /client/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from 'react-dom'; 3 | import './index.scss'; 4 | 5 | import Root from './routes/Root'; 6 | 7 | render(, document.getElementById('app')); 8 | -------------------------------------------------------------------------------- /client/utils/__tests__/noop.spec.js: -------------------------------------------------------------------------------- 1 | import noop from '../noop'; 2 | 3 | describe('noop', () => { 4 | it('return nothing', () => { 5 | const result = noop(); 6 | expect(result).toBeFalsy(); 7 | }) 8 | }); 9 | -------------------------------------------------------------------------------- /client/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "react", 5 | "survivejs-kanban" 6 | ], 7 | "env": { 8 | "start": { 9 | "presets": [ 10 | "react-hmre" 11 | ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /docs/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Changes proposed on this pull request: 2 | 3 | - 4 | - 5 | 6 | ### Fixes # . 7 | 8 | #### Reviewers 9 | 10 | * @carloluis 11 | * @matiasdelgado 12 | * @rrivem 13 | * @marina-acosta 14 | -------------------------------------------------------------------------------- /server/datastore/constants/postgres-errors.js: -------------------------------------------------------------------------------- 1 | // For more details, see https://www.postgresql.org/docs/9.4/static/errcodes-appendix.html 2 | 3 | module.exports = { 4 | NOT_NULL_VIOLATION: '23502', 5 | FOREIGN_KEY_VIOLATION: '23503' 6 | }; 7 | -------------------------------------------------------------------------------- /server/datastore/stores/lookup.store.js: -------------------------------------------------------------------------------- 1 | const BaseStore = require('./base.store'); 2 | 3 | class LookupStore extends BaseStore { 4 | constructor() { 5 | super('lookup'); 6 | } 7 | } 8 | 9 | module.exports = new LookupStore(); 10 | -------------------------------------------------------------------------------- /server/datastore/stores/sample.store.js: -------------------------------------------------------------------------------- 1 | const BaseStore = require('./base.store'); 2 | 3 | class SampleStore extends BaseStore { 4 | constructor() { 5 | super('sample'); 6 | } 7 | } 8 | 9 | module.exports = new SampleStore(); 10 | -------------------------------------------------------------------------------- /client/components/not-found/not-found.scss: -------------------------------------------------------------------------------- 1 | @import '~styles/_palette'; 2 | @import '~styles/_mixins'; 3 | 4 | .container { 5 | text-align: center; 6 | 7 | h1, h2 { 8 | color: $black-2; 9 | } 10 | 11 | .link { 12 | text-decoration: none; 13 | @include blurry(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /client/routes/links.js: -------------------------------------------------------------------------------- 1 | const index = '/'; 2 | 3 | const about = '/about'; 4 | 5 | const chucknorris = 'https://api.chucknorris.io/jokes/random'; 6 | 7 | const api = { 8 | sample: '/api/sample' 9 | }; 10 | 11 | export default { 12 | index, 13 | about, 14 | chucknorris, 15 | api 16 | }; 17 | -------------------------------------------------------------------------------- /client/utils/__mocks__/fetch-response.mock.js: -------------------------------------------------------------------------------- 1 | function mockResponse(status, statusText, response = '{}') { 2 | return new Response(response, { 3 | status, 4 | statusText, 5 | headers: { 6 | 'Content-Type': 'application/json' 7 | } 8 | }); 9 | } 10 | 11 | export default mockResponse; 12 | -------------------------------------------------------------------------------- /server/datastore/server/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | postgres: 5 | image: postgres 6 | environment: 7 | - POSTGRES_PASSWORD=sa.pg.01 8 | volumes: 9 | - data:/var/lib/postgresql/data 10 | ports: 11 | - "5432:5432" 12 | 13 | volumes: 14 | data: 15 | -------------------------------------------------------------------------------- /server/exceptions/not-found.exception.js: -------------------------------------------------------------------------------- 1 | 2 | class NotFoundException extends Error { 3 | constructor() { 4 | super(); 5 | 6 | Error.captureStackTrace(this, NotFoundException); 7 | this.name = this.constructor.name; 8 | this.status = 404; 9 | } 10 | } 11 | 12 | module.exports = NotFoundException; 13 | -------------------------------------------------------------------------------- /server/exceptions/generic.exception.js: -------------------------------------------------------------------------------- 1 | 2 | class GenericException extends Error { 3 | constructor() { 4 | super('Unexpected error'); 5 | 6 | Error.captureStackTrace(this, GenericException); 7 | this.name = this.constructor.name; 8 | this.status = 500; 9 | } 10 | } 11 | 12 | module.exports = GenericException; 13 | -------------------------------------------------------------------------------- /client/components/about/__snapshots__/About.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[` snapshot 1`] = ` 4 |
7 |

8 | React Seed 9 |

10 |

11 | Simple project to start with React! 12 |

13 | 14 |
15 | `; 16 | -------------------------------------------------------------------------------- /server/exceptions/bad-request.exception.js: -------------------------------------------------------------------------------- 1 | class BadRequestException extends Error { 2 | constructor() { 3 | super('Inconsistent data'); 4 | 5 | Error.captureStackTrace(this, BadRequestException); 6 | this.name = this.constructor.name; 7 | this.status = 400; 8 | } 9 | } 10 | 11 | module.exports = BadRequestException; 12 | -------------------------------------------------------------------------------- /server/exceptions/validation.exception.js: -------------------------------------------------------------------------------- 1 | class ValidationException extends Error { 2 | constructor() { 3 | super('Data validation error'); 4 | 5 | Error.captureStackTrace(this, ValidationException); 6 | this.name = this.constructor.name; 7 | this.status = 409; 8 | } 9 | } 10 | 11 | module.exports = ValidationException; 12 | -------------------------------------------------------------------------------- /server/index.js: -------------------------------------------------------------------------------- 1 | const http = require('http'); 2 | 3 | const app = require('./app.prod'); 4 | const appConfig = require('./config'); 5 | const logger = require('./utils/logger'); 6 | 7 | app.set('x-powered-by', false); 8 | 9 | http.createServer(app).listen(appConfig.port); 10 | 11 | logger.info(`http://localhost:${appConfig.port}`); 12 | -------------------------------------------------------------------------------- /client/components/about/About.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Counter from '../counter'; 3 | import styles from './about.scss'; 4 | 5 | const About = () => ( 6 |
7 |

React Seed

8 |

Simple project to start with React!

9 | 10 |
11 | ); 12 | 13 | export default About; 14 | -------------------------------------------------------------------------------- /server/utils/logger.js: -------------------------------------------------------------------------------- 1 | var winston = require('winston'); 2 | 3 | var logger = new winston.Logger({ 4 | transports: [ 5 | new winston.transports.Console({ 6 | level: 'debug', 7 | handleExceptions: true, 8 | json: false, 9 | colorize: true, 10 | timestamp: true, 11 | prettyPrint: true 12 | }) 13 | ] 14 | }); 15 | 16 | module.exports = logger; 17 | -------------------------------------------------------------------------------- /client/components/about/About.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ShallowRenderer from 'react-test-renderer/shallow'; 3 | import About from './About'; 4 | 5 | describe('', () => { 6 | it('snapshot', () => { 7 | const renderer = new ShallowRenderer(); 8 | const tree = renderer.render(); 9 | expect(tree).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /client/components/nav/Nav.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ShallowRenderer from 'react-test-renderer/shallow'; 3 | 4 | import Nav from './Nav'; 5 | 6 | describe('