About

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
  • Password with bcrypt
  • Testing (mocha)
  • Lint (eslint)
  • middlewares
  • console
  • server side render with react
  • flash message

Requirements

  • node >= 14.0.0
  • yarn

Features

  • User system
  • Post article with markdown editor
  • Hacker news middle layer

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
yarn
yarn db:migrate
yarn assets_build
yarn start
  1. Visit http://localhost:3000/
  2. console
$ yarn console
> models.User.create({ name: 'test', email: '[email protected]', password: '12345678', passwordConfirmation: '12345678' }).then(function(user) { console.log(user) })
> models.User.findOne({ where: { email: '[email protected]' } }).then(function(user) { console.log(user) })

Deploy on production

How to Deploy Kails

How to Deploy Kails With Docker

Commands with yarn

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

Author

Blog

License

MIT