A Web App like Ruby on Rails with Koa2, Webpack and Postgres
Clone or download
Latest commit d8a920a Jan 29, 2018

README.md

Kails

Build Status

A Web App like Ruby on Rails with Koa2, Webpack and Postgres.

This project is like Ruby on Rails Project:

  • MVC
  • Database (postgres), ORM(sequelize)
  • migration(sequelize-cli)
  • assets compile(webpack)
  • Session with redis
  • Password with bcrypt
  • Testing (mocha)
  • Lint (eslint)
  • middlewares
  • console
  • server side render with react
  • flash message

Requirements

  • node ^8.0.0
  • npm ^5.0.0

Features

  • User system
  • Post article with markdown editor
  • Hacker news middlelayer

Structure

├── app
│   ├── assets
│   │   ├── images
│   │   ├── javascripts
│   │   └── stylesheets
│   ├── controllers
│   ├── helpers
│   ├── models
│   ├── routes
│   ├── services
│   ├── views
│   └── index.js
├── config
│   ├── config.js
│   └── webpack
│       ├── base.js
│       ├── development.js
│       └── production.js
├── db
│   └── migrations
├── index.js
├── package.json
├── public
└── test

Build development environment on localhost

  1. install nodejs
  2. install redis and postgres
  3. create postgres database: for development { database: 'kails_dev', owner: 'kails_dev', password: 'kails_dev' } for test { database: 'kails_test', owner: 'kails_tester', password: 'kails_tester' }
  4. clone and start this project
git clone https://github.com/embbnux/kails.git
npm install
npm run db:migrate
npm run start
  1. Visit http://localhost:3000/
  2. console
$ npm run console
> models.User.create({ name: 'test', email: 'kails@kails.org', password: '12345678', passwordConfirmation: '12345678' }).then(function(user) { console.log(user) })
> models.User.findOne({ where: { email: 'kails@kails.org' } }).then(function(user) { console.log(user) })

Deploy on production

How to Deploy Kails

How to Deploy Kails With Docker

Commands with npm

# migrate database
npm run db:migrate
NODE_ENV=test npm run db:migrate
# run for development. it start app and webpack dev server
npm start
# run the app
npm run app
# run the lint
npm run lint
# run test
npm test
# deploy
npm run build
npm run assets_compile
NODE_ENV=production npm run db:migrate
npm run pm2
# console
npm run console

Author

Blog

License

MIT