A local development setup or boilerplate for Nest.js framework with MongoDB and mongo-express using Docker Compose.
- Install Node.js - for IDE type checking.
- Install Yarn - for IDE type checking.
- Install Docker Compose and make sure it is running in the system background.
- Clone the app:
git clone [email protected]:dominicarrojado/nestjs-mongodb-boilerplate.git
- Install npm packages - for IDE type checking.
cd nestjs-mongodb-boilerplate
yarn install --frozen-lockfile
- Add file environment variables. For development it should have name
stage.dev.env
, where:
- PORT - application port. (Example: 3000)
- DB_URL - mongoDb url starting with
mongodb+srv://
(in case of Mongo Cloud) ormongodb://
(in case of Mongo). (Example: mongodb+srv://login:password@hostname/dbName?retryWrites=true&w=majority&appName=Cluster0) - BOT_TOKEN - bot token given to you by BotFather. For more info please follow the tutorial
- BOT_NAME - bot name from the tutorial. The name after
@
symbol. (Example: for@test_bot
we need to usetest_bot
) - WEB_APP_NAME - bot web app name from the tutorial.
- THRESHOLD_FOR_POINTS - put
1
here. - MNEMONIC - mnemonic from TON
- AUTH_DATE_SEC_TIMEOUT - put
1800
- POINTS_REWARD - put
5
- SERVER_ORIGIN - tonalty backend. For example: https://tonalty.localhost.direct:3000/
- Build and run the Docker image.
yarn docker-compose:dev
- Access the app at http://localhost:3000.
- Make file changes and it will automatically rebuild the app.
yarn docker-compose:test
yarn docker-compose:test:cov
- Build and run the Docker image.
yarn docker-compose:test:watch
- Make file changes and it will automatically rerun tests related to changed files.
yarn docker-compose:prod
Learn how to build this setup or boilerplate here.