https://github.com/amin-abbasi/typescript-boilerplate
A Typescript boilerplate using Express, MongoDB, MySQL, Redis, Docker, OpenAPI and more ...
https://github.com/amin-abbasi/typescript-boilerplate
boilerplate boilerplate-template docker docker-compose express expressjs mongodb mysql nodejs openapi redis swagger typeorm typescript
Last synced: 4 months ago
JSON representation
A Typescript boilerplate using Express, MongoDB, MySQL, Redis, Docker, OpenAPI and more ...
- Host: GitHub
- URL: https://github.com/amin-abbasi/typescript-boilerplate
- Owner: amin-abbasi
- Created: 2020-06-10T10:08:10.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2026-03-02T22:11:04.000Z (4 months ago)
- Last Synced: 2026-03-03T01:14:35.784Z (4 months ago)
- Topics: boilerplate, boilerplate-template, docker, docker-compose, express, expressjs, mongodb, mysql, nodejs, openapi, redis, swagger, typeorm, typescript
- Language: TypeScript
- Homepage:
- Size: 1.02 MB
- Stars: 42
- Watchers: 1
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Micro-service Boilerplate
This is a micro-service boilerplate written with Typescript and implemented using [Node.js] (Express), [MongoDB] (Mongoose), [Redis], Jest, Socket.io and OpenAPI (Swagger). You can use it to initiate your own server-side application.
## [Name of the application] API
Your can write your complete description about this app here...
### Prerequisites / Setting up for first time
What you need to install before running this app
ex: Make sure you have git, nvm, npm, [Node.js] installed
### Get the project and install npms
- Clone the project `git clone https://github.com/amin-abbasi/typescript-boilerplate.git`
- Go to the project folder and run: `npm i`
### Database Setup
- Install [MongoDB] and [Redis] in your system and set necessary configurations.
- Do not forget to check your environment settings in `.env`
First, compile typescript codes into javascript by:
```bash
pnpm build
```
This will create a `dist` folder and put all compiled `.js` files in there. You can change and set your own configurations by modifying `tsconfig.json` file.
Finally, you can start the project by:
```bash
pnpm start
```
You can also use `nodemon` for development:
```bash
pnpm dev
```
#### Note1:
For security reasons, you should put "sslCert" folder into `.gitignore` file in production mode.
#### Note2:
If you want to directly run `server.ts` file, you can do this change in `package.json`:
```
...
"scripts": {
...
"start": "nodemon --watch '*.ts' --exec 'ts-node' src/server.ts",
...
}
```
and then run: `nodemon`
### Test Application
For test we used Jest for functional testing and unit testing. you can write your own tests in `__test__` folder by creating new `your_entity.test.js` and then just run:
```
npm run test
```
#### Note: After development and test, you should put the following script in `.gitignore` file to prevent pushing tests files in production mode repositories:
```
# test folder
__tests__
```
### Docker and Deployment
You can simply set your own configs in `docker-compose.yml` file and run:
```
sudo docker-compose up -d
```
#### References
[Node.js]: https://nodejs.org/en/download/
[MongoDB]: https://docs.mongodb.com/manual/installation
[Redis]: https://redis.io/download
[nodemon]: https://www.npmjs.com/package/nodemon
[typescript]: https://www.npmjs.com/package/typescript