βΉοΈ About β’ π Features β’ π€ Contributing β’ π£οΈ Roadmap β’ π― Credits β’ π© License
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.
-
Start project in development mode:
npm run dev
-
Start project in production mode:
npm run start
- Built using Typescript
- Built using Express Framework: Fast, unopinionated, minimalist web framework for node.
- Built using Prisma: Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite & MongoDB
- Built using 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 and Morgan
- Unit, Integration and E2E tests using Jest and Supertest
- Linting with ESLint
- Formatting with Prettier
- Spell check
- Git hooks with Husky and lint-staged
- Containerised using Docker and Docker Compose
- Path aliases support
- Commit messages must meet conventional commits format
- GitHub Actions
- Makefile as project entrypoint
- A lot of emojis πΈ
The main actions on this project are managed using a Makefile as an entrypoint.
deps
: Validate if the project dependencies are installedbuild/dev
: Build the project image for the development environmentbuild/prod
: Build the project image for the production environmentstart/dev
: Start the project in development mode using Dockerstart/prod
: Start the project in production mode using Dockerstart/db
: Start database containertest/dev
: Run the project tests using Dockerstop/dev
: Stop dev application containerstop/prod
: Stop prod application containerstop/db
: Stop database containerclean/dev
: Removes dev application container and associated resourcesclean/prod
: Removes prod application container and associated resources
package.json scripts:
dev
: Start project in development modebuild
: Build project and generate final buildstart
: Start project in production modecheck:types
: Check if project types are correctcheck:format
: Check if project is formatted correctlycheck:lint
: Check if project is linted correctlycheck:spelling
: Check if project is spelled correctlyfix:format
: Fix project format issuesfix:lint
: Fix project lint issuesfix:staged
: Check and fix staged filestest
: Run all teststest:unit
: Run unit teststest:int
: Run integration teststest:e2e
: Run e2e teststest:watch
: Run tests in watch modetest:coverage
: Run tests with coveragecoverage:view
: Show coverage informationcommit
: Help to commit changes using conventional commitsversion
: Generate new project versionreset-hard
: Reset git repository to a clean stateprepare-release
: Prepare the project for a release and generates a new releaseupdate-deps
: Update the project dependencies
Just fork and open a pull request. All contributions are welcome π€
Please, check TODO for the current roadmap.
To implement 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.