🔰🦸 Template to start developing a REST API with Node.js (Express), TypeScript, Ts.ED, ESLint, Prettier, Husky, Prisma, etc.
ℹ️ 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.
Install dependencies:
npm install
# or
make install
Start database container:
make start/db
Start cache container:
make start/cache
Generate Prisma Client:
npm run prisma:generate
Start project in development mode:
npm run dev
Start project in production mode:
npm run start
Open the following URL to interact with the API using Swagger UI:
http://localhost:5000/api/docs
# Sample username and password: janedoe / 123456
The main actions on this project are managed using a Makefile as an entrypoint.
Usage: make TARGET [ARGUMENTS]
Targets:
build/docker Build Docker image of the application
clean/docker Clean all container resources
help Show this help
install Install the project
logs Show logs for all or c=<name> containers
requirements Check if the requirements are satisfied
start Start application in development mode
start/docker Start application in a Docker container
start/docker/cache Start cache container
start/docker/db Start database container
stop/docker Stop application running in a Docker container
stop/docker/cache Stop cache container
stop/docker/db Stop database container
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:packagejson
: Check if project package.json is correctcheck:markdown
: Check if markdown files are correctcheck: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 dependenciesJust 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.