https://github.com/firmanjs/auth-service
https://github.com/firmanjs/auth-service
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/firmanjs/auth-service
- Owner: firmanJS
- License: mit
- Created: 2021-05-20T04:28:56.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-20T04:28:57.000Z (almost 5 years ago)
- Last Synced: 2025-06-30T08:47:41.413Z (10 months ago)
- Language: JavaScript
- Size: 314 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Express Template Boillerplate RestfullApi
[](https://codeclimate.com/github/firmanJS/express-template/maintainability)
[](https://codeclimate.com/github/firmanJS/express-template/test_coverage)
[](https://github.com/firmanJS/express-template/actions/workflows/node.js.yml)
[](https://nodejs.org)
[](https://expressjs.com/)
[](https://github.com/firmanJS)
[](https://github.com/firmanJS/express-template/blob/master/LICENSE)
[](https://github.com/firmanJS/express-template/releases)
[](https://github.com/firmanJS/express-template/releases)
[](https://github.com/firmanJS/express-template/issues/)
[](https://github.com/firmanJS/express-template/pulls/)
[](http://makeapullrequest.com)
## Core Stack
- **Node.js** - [http://nodejs.org/](http://nodejs.org/)
- **Express** - [http://expressjs.com/](http://expressjs.com/)
- **nodemon** - [https://www.npmjs.com/package/nodemon](https://www.npmjs.com/package/nodemon)
- **pm2** - [https://www.npmjs.com/package/pm2](https://www.npmjs.com/package/pm2)
## Feature
1. error handling
1. database structure folder
1. testing with jest
1. coverage use jest
1. with docker example
1. validiation, use express-valdator and joi
1. pagination example
1. custom message api response
1. eslint airbnb base
## Unit testing
- **jestjs** - [https://jestjs.io/](https://jestjs.io/)
## How To run
### copy environment variable
```sh
cp .env-sample .env
```
### run manualy
* via yarn or npm :
```sh
# install package
npm install or yarn install
# running app
npm run dev or yarn dev
# running unit tetsing
npm run test or yarn test
```
* via make :
```sh
# start aplication with docker
make docker-start
# stop docker container
make docker-stop
# remove docker container
make docker-down
```
### fill in the copied environment earlier
```sh
APP_PORT=2000
TZ=Asia/Jakarta
MONGO_SERVICE=# uri mongodb
AUTH_SOURCE= #auth service
SECRET_KEY= #jwt secret key here
#Mongodb config
MONGO_PORT=27017
MONGO_INITDB_ROOT_USERNAME= #username
MONGO_INITDB_ROOT_PASSWORD= #password
MONGO_INITDB_DATABASE= #db name
```
### run with docker-compose
```sh
docker-compose up --build
```
### or run with background process
```sh
docker-compose up --build -d
```
### execution npm with container docker
```sh
# install package
docker-compose exec boillerplate npm install
# running unit testing
docker-compose exec boillerplate npm run test
```
## Documentation API
using swagger check in folder static
## Project Structure
```
.
├── api/ * all api file here
├── config/ * all configuration file here
| └── db.js * configuration database
├── database/ * all models schema file here
| └── models * all models file
| └── migrations * all migrations file
| └── seeders * all seeders file
├── helpers/ * all helper or middleware file here
├── middleware/ * all middleware file here, for check before next to api
├── routes/ * all file route here
| └── index.js * register all route
├── static/ * all configuration swagger
| └── path * custom your path api
| └── schema * custom schema body
├── test/ * all test file here
| └── index.js * test apps
├── utils/ * all utils file here
```
## Code Style Guides
* Guideline:
* Use camelCase for variable name, naming function, load module or other functions
* Use UpperCase for Constant Variable
* Use PascalCase for class name, models, api, route, load module model
* Use snake_case for file name as variable
* Function name use Verb
* Variable name use Noun