Noura Generator
Noura Generator was designed to be scalable on containerized environment like Kubernetes, and designed to be enterprise ready. Noura using clean architecture with modular isolation.
Technology Stack Supported
- ExpressJS project, with vanilla javascript, this is suitable for creating service only project.
- ReactJS Fullstack Project, this is for creating web app using Server Side Rendering.
Client Features (Only for Fullstack)
- Transpiler with Babel 6
- Rendering with reactjs
- Component Styling with styled-components
- State management with Redux
- Redux Middleware with redux-observable
- Reactive Programming for redux-observable with rxjs
- Routing with react-router
- Redux Routing with react-router-redux
- Server side Routing with react-router-dom
- Module bundling with HMR using webpack
- React DOM Testing with react-testing-library
- Optional React Testing with enzyme
Server Features
- No transpilers, just vanilla javascript
- ES2017 latest features like Async/Await
- CORS enabled
- Uses yarn
- Express
- Consistent coding styles with editorconfig
- Docker support
- Uses helmet to set some HTTP headers for security
- Load environment variables from .env files with dotenv
- Request validation with joi
- Gzip compression with compression
- Linting with eslint with eslint-config-airbnb-base
- Tests with jest along with coverage
- Git hooks with husky
- Logging with winston, and winston-cloudwatch for production log stream
- API documentation geratorion with apidoc
- Monitoring with pm2
- Startup boot tasks that can be used for data migrations or pre startup task runner.
- ORM using Sequelize (optional) sequelize with docker-compose migrations
- HTTP using axios with retry axios
- Apollo Server GraphQL support apollographql
Requirements
- Node v7.6+ or Docker
- Yarn
Getting Started
Install:
npm install -g yo generator-noura
Generate a new project:
yo noura
Choose your project, either service or fullstack
Client Side Generator
Generate a new component
yo noura:component
Upon creation on a component, a new component folder will be created on src/components
, and entries will be injected on the following files:
src/client/ducks/routers.js
src/client/ducks/epics.js
src/client/ducks/reducers.js
Server Side Generator
Generate a new API:
yo noura:api
Generate a new GraphQL query:
yo noura:gql
Generate a new middleware:
yo noura:middleware
Generate a new service:
yo noura:service
Generate a new utility:
yo noura:util
Generate a new boot task:
yo noura:boot
Set environment variables:
cp .env.example .env
Running Locally
yarn dev
Running in Production
yarn start
Lint
# lint code with ESLint
yarn lint
# try to fix ESLint errors
yarn lint:fix
# lint and watch for changes
yarn lint:watch
Sequelize Migrations (optional)
yarn db:migrate
# to undo the migration
yarn db:migrate:undo
Test
# run all tests with Jest with coverage
yarn test
# run unit tests
yarn test:unit
# run integration tests
yarn test:integration
# run all tests and watch for changes
yarn test:watch
Validate
# run lint and tests
yarn validate
Logs
# show logs in production
pm2 logs
Documentation
# generate and open api documentation
yarn docs
Docker
# run container locally
yarn docker:dev
or
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
# run container in production
yarn docker:prod
or
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
# run tests
yarn docker:test
or
docker-compose -f docker-compose.yml -f docker-compose.test.yml up