|
21 | 21 | - npm >= `v6.x`
|
22 | 22 | - node >= `v10.x`
|
23 | 23 | - eslint `v7.x`
|
| 24 | +- husky >= `v5.x` |
24 | 25 | - Familiar with TypeScript 💪
|
25 | 26 |
|
26 | 27 | ## Feature
|
|
35 | 36 | - Using [Babel Resolver](https://github.com/tleunen/babel-plugin-module-resolver) for simplify the require/import paths
|
36 | 37 | - Documentation with [Swagger](https://github.com/swagger-api/swagger-ui)
|
37 | 38 | - Generate Log File with [Winston](https://github.com/winstonjs/winston)
|
| 39 | +- [Convensional Commit](https://www.conventionalcommits.org/en/v1.0.0/) with [Husky](https://github.com/typicode/husky) `v5` & [Commitlint](https://github.com/conventional-changelog/commitlint) |
| 40 | + |
| 41 | +## How to use |
| 42 | + |
| 43 | +clone this repo with `https` / `ssh` / `github cli` |
| 44 | + |
| 45 | +```sh |
| 46 | +git clone https://github.com/masb0ymas/boilerplate-express-typescript-sequelize.git |
| 47 | +``` |
| 48 | + |
| 49 | +After cloning this repo, make sure you have `duplicated` the `.env.example` file to `.env`, don't let the .env.example file be deleted or renamed. |
38 | 50 |
|
39 | 51 | ## Install
|
40 | 52 |
|
41 | 53 | ```sh
|
| 54 | +npm install |
| 55 | + |
| 56 | +or |
| 57 | + |
42 | 58 | yarn
|
43 | 59 | ```
|
44 | 60 |
|
| 61 | +## Enabled Husky |
| 62 | + |
| 63 | +```sh |
| 64 | +npx husky install |
| 65 | + |
| 66 | +or |
| 67 | + |
| 68 | +yarn husky install |
| 69 | +``` |
| 70 | + |
45 | 71 | ## Usage Development
|
46 | 72 |
|
47 | 73 | ```sh
|
48 |
| -yarn run start |
| 74 | +npm run dev |
| 75 | + |
| 76 | +or |
| 77 | + |
| 78 | +yarn dev |
49 | 79 | ```
|
50 | 80 |
|
51 | 81 | ## Type Checking
|
52 | 82 |
|
53 | 83 | ```sh
|
54 |
| -yarn run type-check || yarn run type-check:watch |
| 84 | +npm run type-check |
| 85 | + |
| 86 | +or |
| 87 | + |
| 88 | +yarn type-check |
| 89 | +``` |
| 90 | + |
| 91 | +## Type Checking Watching |
| 92 | + |
| 93 | +```sh |
| 94 | +npm run type-check:watch |
| 95 | + |
| 96 | +or |
| 97 | + |
| 98 | +yarn type-check:watch |
55 | 99 | ```
|
56 | 100 |
|
57 | 101 | ## Build
|
58 | 102 |
|
| 103 | +Recommended using build with babel, build with ts is still unstable |
| 104 | + |
59 | 105 | ```sh
|
60 |
| -yarn run build |
| 106 | +npm run build:babel |
| 107 | + |
| 108 | +or |
| 109 | + |
| 110 | +yarn build:babel |
61 | 111 | ```
|
62 | 112 |
|
63 | 113 | ## Using Sequelize
|
64 | 114 |
|
65 |
| -After cloning this repo, make sure you have duplicated the .env.example file to .env, don't let the .env.example file be deleted or renamed. |
| 115 | +Using sequelize with development mode, you can set the database configuration in `.env`, like this : |
| 116 | + |
| 117 | +```sh |
| 118 | +DB_CONNECTION=mysql |
| 119 | +DB_HOST=127.0.0.1 |
| 120 | +DB_PORT=3306 |
| 121 | +DB_DATABASE=example_database |
| 122 | +DB_USERNAME=example_user |
| 123 | +DB_PASSWORD=example_password |
| 124 | +DB_OPERATOR_ALIAS= |
| 125 | +DB_TIMEZONE=+07:00 |
| 126 | +``` |
| 127 | + |
| 128 | +if you set production mode change the database config `PROD_DB_DATABASE` |
66 | 129 |
|
67 | 130 | then after that you can adjust the database config in `DB_DATABASE`, `DB_USERNAME`, `DB_PASSWORD`.
|
68 | 131 | now you can run this command :
|
69 | 132 |
|
70 | 133 | ```sh
|
| 134 | +npm run db:reset |
| 135 | + |
| 136 | +or |
| 137 | + |
71 | 138 | yarn db:reset
|
72 | 139 | ```
|
73 | 140 |
|
74 | 141 | ## Usage Production
|
75 | 142 |
|
76 | 143 | ```sh
|
77 |
| -yarn run serve:production |
| 144 | +npm run serve:production |
| 145 | + |
| 146 | +or |
| 147 | + |
| 148 | +yarn serve:production |
78 | 149 | ```
|
79 | 150 |
|
80 | 151 | ## Run tests
|
81 | 152 |
|
82 | 153 | ```sh
|
83 |
| -yarn run test |
| 154 | +npm run test |
| 155 | + |
| 156 | +or |
| 157 | + |
| 158 | +yarn test |
84 | 159 | ```
|
85 | 160 |
|
86 | 161 | ## Run with Docker
|
@@ -173,6 +248,18 @@ Detached mode: Run containers in the background,
|
173 | 248 | docker-compose up -d
|
174 | 249 | ```
|
175 | 250 |
|
| 251 | +## Release your version app |
| 252 | + |
| 253 | +if you want to release the app version, you can use the following command : |
| 254 | + |
| 255 | +```sh |
| 256 | +npm run release |
| 257 | +
|
| 258 | +or |
| 259 | +
|
| 260 | +yarn release |
| 261 | +``` |
| 262 | + |
176 | 263 | ## SMTP Basic
|
177 | 264 |
|
178 | 265 | I use [topol.io](https://topol.io/) to create email templates, and it's free and can export to html format
|
@@ -228,7 +315,6 @@ OAUTH_REFRESH_TOKEN=your_refresh_token
|
228 | 315 |
|
229 | 316 | [<img height="40" src="https://trakteer.id/images/mix/navbar-logo-lite.png">](https://trakteer.id/masb0ymas)
|
230 | 317 |
|
231 |
| - |
232 | 318 | ## Show your support
|
233 | 319 |
|
234 | 320 | Give a ⭐️ if this project helped you!
|
|
0 commit comments