Skip to content

Commit

Permalink
docs(readme): document README.md and improve Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
borjapazr committed Nov 22, 2021
1 parent 4e53375 commit e1dd3ba
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 58 deletions.
3 changes: 3 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"circleci",
"codecov",
"commitlint",
"Containerised",
"dependabot",
"dtos",
"editorconfig",
Expand All @@ -36,13 +37,15 @@
"openapi",
"prettierignore",
"printf",
"roadmap",
"Rodríguez",
"sandboxed",
"sonarjs",
"topbar",
"transpiled",
"typedoc",
"typeorm",
"unopinionated",
"untracked",
"usecase"
],
Expand Down
3 changes: 2 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
interval: 'weekly'
day: 'friday'
commit-message:
prefix: 'npm'
include: 'scope'
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CD

on:
push:
branches:
- main

jobs:
distribute:
name: 🛩️ Deliver project
runs-on: ubuntu-latest

steps:
- name: ⬇️ Checkout project
uses: actions/checkout@v2

- name: 💽 Build OCI image
run: make build/prod
12 changes: 0 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,3 @@ jobs:

- name: ⚒️ Build project
run: npm run build

distribute:
name: 🛩️ Deliver project
needs: build
runs-on: ubuntu-latest

steps:
- name: ⬇️ Checkout project
uses: actions/checkout@v2

- name: 💽 Build OCI image
run: make build/prod
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ include .env

# Root directory
ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

# Shell to use for running scripts
SHELL := $(shell which bash)

# Set default goal
.DEFAULT_GOAL := deps

# Test if the dependencies we need to run this Makefile are installed
DOCKER := $(shell command -v docker)
DOCKER_COMPOSE := $(shell command -v docker-compose)
Expand All @@ -20,12 +24,10 @@ ifndef DOCKER_COMPOSE
@echo "🐳🧩 docker-compose is not available. Please install docker-compose."
@exit 1
endif
ifdef NPM
ifndef NPM
@echo "📦🧩 npm is not available. Please install npm."
endif

.PHONY: default
default: start/dev
@echo "🆗 The necessary dependencies are already installed!"

build/dev start/dev test/dev stop/dev clean/dev: ENVIRONMENT = dev

Expand Down
140 changes: 99 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,112 @@
<div align="center">
<img
width="500"
alt="Node Typescript Skeleton"
alt="Node.js, Typescript and Express template"
src="https://i.imgur.com/bpnghuI.png">
<br>
<br>

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/borjapazr/express-typescript-skeleton/CI?style=flat-square)
![GitHub package.json version](https://img.shields.io/github/package-json/v/borjapazr/express-typescript-skeleton?style=flat-square)
![GitHub](https://img.shields.io/github/license/borjapazr/express-typescript-skeleton?style=flat-square)

<h4>
Production-ready template for backends created with Node.js, Typescript and Express
🔰🦸 Production-ready template for backends created with Node.js, Typescript and Express
</h4>

<a href="#about">About</a> •
<a href="#installation">Installation</a> •
<a href="#features">Features</a> •
<a href="#wiki">Wiki</a> •
<a href="#contributing">Contributing</a> •
<a href="#credits">Credits</a> •
<a href="#support">Support</a> •
<a href="#license">License</a>
<a href="#ℹ️-about">ℹ️ About</a> •
<a href="#-features">📋 Features</a> •
<a href="#-contributing"> 🤝 Contributing</a> •
<a href="#-roadmap"> 🛣️ Roadmap</a> •
<a href="#-credits">🎯 Credits</a> •
<a href="#-license">🚩 License</a>

</div>

---

## About

#TODO

## Installation

#TODO

## Features

#TODO

## Wiki

#TODO

## Contributing

#TODO

## Credits

#TODO

## Support

#TODO

## License

#TODO
## ℹ️ About

The main goal of this project is to provide a base template for the generation of a production-ready REST API made with `Node.js`, `Express` and `Typescript`. The idea is to avoid having to configure all the tools involved in a project every time it is started and thus be able to focus on the definition and implementation of the business logic.

> 📣 This is an opinionated template. The architecture of the code base and the configuration of the different tools used has been based on best practices and personal preferences.
## 📋 Features

- Built using [Typescript](https://github.com/microsoft/TypeScript)
- Built using [Express Framework](https://github.com/expressjs/express): Fast, unopinionated, minimalist web framework for node.
- Built using [TypeORM](https://typeorm.io/): ORM for TypeScript and JavaScript
- Built using [Routing Controllers](https://github.com/typestack/routing-controllers): Allows to create controller classes with methods as actions that handle requests
- JWT authentication and role based authorization using custom middleware
- OpenAPI definition
- Fully configured logger with [Winston](https://github.com/winstonjs/winston) and [Morgan](https://github.com/expressjs/morgan)
- Unit, Integration and E2E tests using [Jest](https://github.com/facebook/jest) and [Supertest](https://github.com/visionmedia/supertest)
- Linting with [ESLint](https://github.com/eslint/eslint)
- Formatting with [Prettier](https://github.com/prettier/prettier)
- [Spell check](https://github.com/streetsidesoftware/cspell)
- Git hooks with [Husky](https://github.com/typicode/husky) and [lint-staged](https://github.com/okonet/lint-staged)
- Containerised using [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/)
- Path aliases support
- Commit messages must meet conventional commits format
- GitHub Actions
- Makefile as project entrypoint
- A lot of emojis 🛸

### 🐐 Makefile rules

The main actions on this project are managed using a [Makefile](Makefile) as an entrypoint.

- `deps`: Validate if the project dependencies are installed
- `build/dev`: Build the project image for the development environment
- `build/prod`: Build the project image for the production environment
- `start/dev`: Start the project in development mode using Docker
- `start/prod`: Start the project in production mode using Docker
- `start/db`: Start database container
- `test/dev`: Run the project tests using Docker
- `stop/dev`: Stop dev application container
- `stop/prod`: Stop prod application container
- `stop/db`: Stop database container
- `clean/dev`: Removes dev application container and associated resources
- `clean/prod`: Removes prod application container and associated resources

### ⚡ Scripts

[package.json](package.json) scripts:

- `dev`: Start project in development mode
- `build`: Build project and generate final build
- `start`: Start project in production mode
- `check:types`: Check if project types are correct
- `check:format`: Check if project is formatted correctly
- `check:lint`: Check if project is linted correctly
- `check:spelling`: Check if project is spelled correctly
- `fix:format`: Fix project format issues
- `fix:lint`: Fix project lint issues
- `fix:staged`: Check and fix staged files
- `test`: Run all tests
- `test:unit`: Run unit tests
- `test:int`: Run integration tests
- `test:e2e`: Run e2e tests
- `test:watch`: Run tests in watch mode
- `test:coverage`: Run tests with coverage
- `coverage:view`: Show coverage information
- `commit`: Help to commit changes using conventional commits
- `version`: Generate new project version

## 🤝 Contributing

Just fork and open a pull request. All contributions are welcome 🤗

## 🛣️ Roadmap

Please, check [TODO](TODO.md) for the current roadmap.

## 🎯 Credits

To realise this project I have based myself on many similar projects. There were countless of them and I gave them all a star ⭐.

🙏 Thank you very much for these wonderful creations.

## 🚩 License

MIT @ [borjapazr](https://me.marsmachine.space). Please see [License](LICENSE) for more information.
13 changes: 13 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 🛣️ Roadmap

### Todo

- [ ] Task 3

### In Progress

- [ ] Task 2

### Done ✓

- [x] Task 1

0 comments on commit e1dd3ba

Please sign in to comment.