This work is licensed under a Creative Commons Attribution 4.0 International License.
NodeJS/Express Shelter API server responsible for serving the API consumed by shelter-app.
Generated service includes the following features:
- Express.js
- MongoDB ODM using Mongoose
- Code structure inspired by Node.js Best Practices & Uncle Bob Clean Architecture
Other features:
- Webpack with Typescript using @boringcodes/backpack
- Prettier using @boringcodes/prettier-config
- ESLint using @boringcodes/eslint-config-typescript
- Husky
- Lint Staged
- NVM
- Dockerfile
- Standard Version
.
├── Dockerfile
├── README.md
├── backpack.config.js
├── build
│ ├── index.js
│ └── index.map
├── deploy.sh
├── key.json
├── package.json
├── src
│ ├── app.ts
│ ├── components
│ │ ├── accounts
│ │ │ ├── constants.ts
│ │ │ ├── model.ts
│ │ │ └── repository.ts
│ │ ├── auth
│ │ │ ├── constants.ts
│ │ │ ├── controller.ts
│ │ │ ├── index.ts
│ │ │ └── middleware.ts
│ │ ├── bot
│ │ │ ├── constants.ts
│ │ │ ├── controller.ts
│ │ │ ├── index.ts
│ │ │ ├── middleware.ts
│ │ │ └── utils.ts
│ │ ├── cities
│ │ │ ├── constants.ts
│ │ │ ├── controller.ts
│ │ │ ├── index.ts
│ │ │ ├── middleware.ts
│ │ │ ├── model.ts
│ │ │ └── repository.ts
│ │ ├── common
│ │ │ ├── dashbot
│ │ │ │ ├── dashbot.ts
│ │ │ │ └── index.ts
│ │ │ ├── facebook
│ │ │ │ ├── facebook.ts
│ │ │ │ └── index.ts
│ │ │ ├── firebase
│ │ │ │ ├── firebase.ts
│ │ │ │ └── index.ts
│ │ │ ├── gmail
│ │ │ │ ├── gmail.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── types.ts
│ │ │ ├── google
│ │ │ │ ├── google.ts
│ │ │ │ └── index.ts
│ │ │ ├── google-dialogflow
│ │ │ │ ├── constants.ts
│ │ │ │ ├── google-dialogflow.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── intent-data.ts
│ │ │ │ └── struct-json.ts
│ │ │ ├── google-maps
│ │ │ │ ├── google-maps.ts
│ │ │ │ └── index.ts
│ │ │ ├── instagram
│ │ │ │ ├── index.ts
│ │ │ │ └── instagram.ts
│ │ │ ├── passport
│ │ │ │ ├── index.ts
│ │ │ │ └── strategies
│ │ │ │ ├── facebook.ts
│ │ │ │ ├── google.ts
│ │ │ │ ├── instagram.ts
│ │ │ │ ├── jwt.ts
│ │ │ │ ├── local.ts
│ │ │ │ └── twitter.ts
│ │ │ ├── push-notifications
│ │ │ │ ├── index.ts
│ │ │ │ └── push-notifications.ts
│ │ │ ├── time-parser
│ │ │ │ ├── index.ts
│ │ │ │ └── time-parse.ts
│ │ │ ├── twitter
│ │ │ │ ├── index.ts
│ │ │ │ └── twitter.ts
│ │ │ └── yup-custom
│ │ │ └── index.ts
│ │ ├── crisis-lines
│ │ │ ├── constants.ts
│ │ │ ├── controller.ts
│ │ │ ├── index.ts
│ │ │ ├── middleware.ts
│ │ │ ├── model.ts
│ │ │ ├── repository.ts
│ │ │ └── utils.ts
│ │ ├── feedbacks
│ │ │ ├── constants.ts
│ │ │ ├── controller.ts
│ │ │ ├── index.ts
│ │ │ ├── middleware.ts
│ │ │ ├── model.ts
│ │ │ └── repository.ts
│ │ ├── files
│ │ │ ├── constants.ts
│ │ │ ├── controller.ts
│ │ │ ├── index.ts
│ │ │ ├── middleware.ts
│ │ │ └── utils.ts
│ │ ├── services
│ │ │ ├── constants.ts
│ │ │ ├── controller.ts
│ │ │ ├── index.ts
│ │ │ ├── middleware.ts
│ │ │ ├── model.ts
│ │ │ ├── repository.ts
│ │ │ └── utils.ts
│ │ ├── static-pages
│ │ │ ├── constants.ts
│ │ │ ├── controller.ts
│ │ │ ├── index.ts
│ │ │ ├── middleware.ts
│ │ │ ├── model.ts
│ │ │ └── repository.ts
│ │ ├── templates
│ │ │ ├── constants.ts
│ │ │ ├── controller.ts
│ │ │ ├── index.ts
│ │ │ ├── middleware.ts
│ │ │ ├── model.ts
│ │ │ └── repository.ts
│ │ ├── types.ts
│ │ ├── users
│ │ │ ├── constants.ts
│ │ │ ├── controller.ts
│ │ │ ├── index.ts
│ │ │ ├── middleware.ts
│ │ │ ├── model.ts
│ │ │ └── repository.ts
│ │ └── zips
│ │ ├── constants.ts
│ │ ├── controller.ts
│ │ ├── index.ts
│ │ ├── middleware.ts
│ │ ├── model.ts
│ │ └── repository.ts
│ ├── index.ts
│ ├── init-data.ts
│ └── routes.ts
├── tsconfig.json
├── tslint.json
└── yarn.lock
For starters, we use .env
files to configre lots of environment variables.
Check the .env.sample
for a starter file. It's best you read the comments
in that file if you have questions or want to learn more what each does.
$ yarn
We start of in one terminal with the typrscript watcher with:
$ yarn dev
We're done. We can edit typescript files in src/components
and see changes in the api without restarting the server.
-
yarn start
will start the api server and read the.env
config file. -
yarn dev
will compile and correctly watch files. Use this when writing code in.ts
files.
Compile the api folder typecript files. Same as the old build command
$ yarn build && yarn start
You'll need to create a deploy token to make this work, with at least the read registry and write registry scopes.
Make sure that you have docker installed and have logged into the shelter-api registry with
docker login -u <username> -p <deploy_token> registry.gitlab.com/shelterappdev/shelter-api
To deploy to production, simply run:
./deploy.sh
https://documenter.getpostman.com/view/185196/Tzedfj4K
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.