diff --git a/.dockerignore b/.dockerignore index 010f613f..a139f79c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -58,7 +58,6 @@ LICENSE .swcrc .git .husky -.prettierrc makefile justfile test diff --git a/README.md b/README.md index be59ad1e..17b800fd 100644 --- a/README.md +++ b/README.md @@ -117,20 +117,18 @@ Now you can start the application witt `npx cross-env NODE_ENV=dev yarn start`. - 🔐 **Helmet** - secure HTTP headers - 😴 **Insomnia** - Insomnia config for endpoints - 📏 **ESLint** — Pluggable JavaScript linter -- 💖 **Prettier** - Opinionated Code Formatter ## Available Scripts -- `yarn start` - Start application -- `yarn start:dev` - Start application in watch mode -- `yarn start:prod` - Start built application -- `yarn start:hmr` - Start application with hot module replacement -- `yarn format` - Formats all the files inside src using prettier with config provided in `.prettierrc` -- `yarn lint` - Uses eslint to lint all the files inside src with config provided in `.eslintrc.cjs` -- `yarn orm migration:create` - Uses Mikroorm to create a migration file -- `yarn orm migration:up` - This command is used to run availablexisting migration files. -- `yarn orm migration:down` - This command is used to rollback migration. -- `yarn orm seeder:run` - This command is used to run existing seeders in `src/common/database`. +- `npm run start` - Start application +- `npm run start:dev` - Start application in watch mode +- `npm run start:prod` - Start built application +- `npm run start:hmr` - Start application with hot module replacement +- `npm run lint` - Uses eslint to lint all the files inside src with config provided in `eslint.config.js` +- `npm run orm migration:create` - Uses Mikroorm to create a migration file +- `npm run orm migration:up` - This command is used to run availablexisting migration files. +- `npm run orm migration:down` - This command is used to rollback migration. +- `npm run orm seeder:run` - This command is used to run existing seeders in `src/common/database`. All the scripts require `NODE_ENV` flag @@ -146,26 +144,24 @@ installing [just](https://github.com/casey/just#packages) and then running `just - Also remove the unwanted config variables from the env file - Make sure you create a env file under `env` directory with name like `.env.something`.The portion after .env is the `NODE_ENV` value which will be required while running the app -- Also make sure you have ssl files inside `src/resources/ssl` if you tend to use ssl. Replace the sample files with - your ssl files but keep the name same. Additionally ## Migration and seeding Migrations are used to update the database schema. The migration files are stored in `migrations` directory. ```sh - npx cross-env NODE_ENV=dev yarn orm migration:up # applies migration for dev env + npx cross-env NODE_ENV=dev npm run orm migration:up # applies migration for dev env ``` Seeding is used to insert data into the database. The seeding files are stored in `common/database/seeders` directory. ```sh - npx cross-env USER_PASSWORD=Test@1234 NODE_ENV=dev yarn orm seeder:run # seeds data for dev env with all user password set as Test@1234 + npx cross-env USER_PASSWORD=Test@1234 NODE_ENV=dev npm run orm seeder:run # seeds data for dev env with all user password set as Test@1234 ``` ## Start application -- `npx cross-env NODE_ENV=[env name] yarn start` +- `npx cross-env NODE_ENV=[env name] npm run start` - View automatically generated swagger api docs by browsing to `http://localhost:[port]/docs` - View automatically generated swagger stats dashboard by browsing to `http://localhost:[port]/stats`. The username and password is the values set in the env file under `SWAGGER_USERNAME` and `SWAGGER_PASS` respectively @@ -209,16 +205,13 @@ authentication of the token. # Deployment -You need to have `docker` and `docker-compose` (not the compose plugin) installed. Also since we are using `makefiles` -for deployment, you need to have `make` installed. +You need to have `docker` and `docker-compose` installed. The image environment variable values can be found at the compose file ```sh ENV=dev sh ./scripts/deploy.sh # deploys dev environment (.env.dev used) ENV=prod sh ./scripts/deploy.sh # deploys prod environment (.env.prod used) ``` -The password for `redis` and `rabbitmq` is `Test@1234` can be changed in the make file under `deploy` script - More docs found at `docs` folder

Do you use this template?
Don't be shy to give it a star! ★

diff --git a/docs/linting.md b/docs/linting.md index 15672605..cd31eb2e 100644 --- a/docs/linting.md +++ b/docs/linting.md @@ -8,13 +8,12 @@ - [Configuration](#configuration) - [FAQ](#faq) -This project uses Typescript Eslint, and Prettier to catch errors and avoid bike-shedding by enforcing a common code +This project uses Typescript Eslint to catch errors and avoid bike-shedding by enforcing a common code style. ## Languages -- **TypeScript** is linted by Typescript Eslint and formatted by Prettier -- **JSON** is formatted by Prettier +- **TypeScript** is linted and formatted by Typescript Eslint. ## Scripts @@ -24,12 +23,12 @@ There are a few different contexts in which the linters run. ```bash # Lint all files without auto-fixing -yarn lint +npm run lint ``` ```bash # Lint all files, fixing many violations automatically -yarn lint:fix +npm run lint:fix ``` See `package.json` to update. @@ -47,8 +46,10 @@ In supported editors, all files will be linted and show under the linter errors This boilerplate ships with opinionated defaults, but you can edit each tools configuration in the following config files: -- [ESLint](https://eslint.org/docs/user-guide/configuring) - - `.eslintrc.cjs` +- [ESLint](https://eslint.org/docs/latest/use/configure/configuration-files-new) + - `eslint.config.js` + +Note: This uses eslint flat config, which is the recommended way to configure eslint. ## FAQ @@ -60,5 +61,5 @@ files: possible, because dynamic configurations are simply more powerful, able to respond to environment variables and much more. -The linting rules can be found at [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) which +The linting rules can be found at [@rubiin/eslint-config](https://github.com/rubiin/eslint-config) which has more than 100 powerful ESLint rules that help prevent bugs and enforce conventions.