{"id":15760280,"url":"https://github.com/padupe/template_node-ts-prisma-postgresql","last_synced_at":"2026-04-10T01:06:09.906Z","repository":{"id":38273120,"uuid":"475655015","full_name":"padupe/template_node-ts-prisma-postgresql","owner":"padupe","description":"Template para desenvolvimento de API em Node.js, utilizando Typescript, Prisma ORM, PostgreSQL, Docker, Swagger e Jest.","archived":false,"fork":false,"pushed_at":"2022-06-08T03:34:53.000Z","size":28484,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T13:36:19.488Z","etag":null,"topics":["docker","jest","nodejs","postgresql","prisma","swagger","template","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/padupe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-29T23:46:39.000Z","updated_at":"2024-09-11T18:49:47.000Z","dependencies_parsed_at":"2022-08-18T06:10:43.034Z","dependency_job_id":null,"html_url":"https://github.com/padupe/template_node-ts-prisma-postgresql","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padupe%2Ftemplate_node-ts-prisma-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padupe%2Ftemplate_node-ts-prisma-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padupe%2Ftemplate_node-ts-prisma-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padupe%2Ftemplate_node-ts-prisma-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/padupe","download_url":"https://codeload.github.com/padupe/template_node-ts-prisma-postgresql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246443543,"owners_count":20778251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","jest","nodejs","postgresql","prisma","swagger","template","typescript"],"created_at":"2024-10-04T10:42:00.035Z","updated_at":"2025-12-30T23:14:59.283Z","avatar_url":"https://github.com/padupe.png","language":"TypeScript","readme":"![img](https://github.com/padupe/template_node-ts-prisma-postgresql/blob/master/assets/template.svg)\n# Template: API [Node.js](https://nodejs.org/en/ 'Node.js')\n*[Typescript](https://www.typescriptlang.org/ 'Typescript') - [Prisma](https://www.prisma.io/ 'Prisma') - [PostgreSQL](https://www.postgresql.org/ 'PostgreSQL') - [Docker](https://www.docker.com/ 'Docker') - [Swagger](https://swagger.io/ 'Swagger') - [Jest](https://jestjs.io/ 'Jest')*\n\u003e Check the Documentation in pt-br by clicking 🇧🇷 [here](https://github.com/padupe/template_node-ts-prisma-postgresql/blob/master/docs/README-pt-br.md 'here').\n\n\u003cdiv align=\"center\"\u003e\n\n![img](https://img.shields.io/badge/%40prisma%2Fclient-v3.11.1-blue)\n![img](https://img.shields.io/badge/bcrypt-v5.0.1-blue)\n![img](https://img.shields.io/badge/dotenv-v16.0.0-blue)\n![img](https://img.shields.io/badge/express-v4.17.3-blue)\n![img](https://img.shields.io/badge/express--async--errors-v3.1.1-blue)\n![img](https://img.shields.io/badge/jsonwebtoken-v8.5.1-blue)\n![img](https://img.shields.io/badge/reflect--metadata-v0.1.13-blue)\n![img](https://img.shields.io/badge/swagger--ui--express-v4.3.0-blue)\n![img](https://img.shields.io/badge/ts--node-v10.7.0-blue)\n![img](https://img.shields.io/badge/tsyringe-v4.6.0-blue)\n![img](https://img.shields.io/badge/winston-v3.7.2-blue)\n\n\u003c/div\u003e\n\n\n## Contact the Developer\n\u003cdiv align=\"center\"\u003e\n      \u003ca href=\"https://www.linkedin.com/in/paulo-eduardo-peixoto-2155a866/\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white\" target=\"_blank\"\u003e\u003c/a\u003e\n      \u003ca href=\"mailto:peixoto.pauloeduardo@gmail.com\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/Gmail-D14836?style=for-the-badge\u0026logo=gmail\u0026logoColor=white\" target=\"_blank\"\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/padupe\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/GitHub-100000?style=for-the-badge\u0026logo=github\u0026logoColor=white\" target=\"_blank\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n## Index\n- [Contact the Developer](#contact-the-developer)\n- [ERM (Entity Relationship Model)](#erm-entity-relationship-model)\n- [Customer Response Flow](#customer-response-flow)\n- [Project Dependencies](#project-dependencies)\n- [Tools Used](#tools-used)\n- [Using the Application](#using-the-application)\n  - [Api Documentation](#api-documentation)\n  - [JSON for testing via Insomnia](#json-for-testing-via-insomnia)\n  - [Useful Comands](#useful-commands)\n    - [Docker](#docker)\n    - [Application](#application)\n    - [Database](#database)\n    - [Automated Tests](#automated-tests)\n\n\n## ERM (Entity Relationship Model)\n\u003cdiv align=\"center\"\u003e\n      \u003cimg align=\"center\" alt=\"Template-ERM\" src=\"https://github.com/padupe/template_node-ts-prisma-postgresql/blob/master/assets/mer.png\"\u003e     \n\u003c/div\u003e\n\n\n## Customer Response Flow\n\u003cdiv align=\"center\"\u003e\n      \u003cimg align=\"center\" alt=\"Template-Flow\" src=\"https://github.com/padupe/template_node-ts-prisma-postgresql/blob/master/assets/fluxo.drawio.png\"\u003e     \n\u003c/div\u003e\n\n\n## Project Dependencies\n- [bcrypt](https://www.npmjs.com/package/bcrypt 'bcrypt'): A library to help you hash passwords;\u003cbr\u003e\n- [dotenv](https://www.npmjs.com/package/dotenv 'dotenv'): Dotenv is a zero-dependency module that loads environment variables from a `.env` file into `process.env`;\u003cbr\u003e\n- [express](https://expressjs.com/ 'express'): Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications;\u003cbr\u003e\n- [express-async-errors](https://www.npmjs.com/package/express-async-errors 'express-async-errors'): A simple ES6 async/await support hack for ExpressJS;\u003cbr\u003e\n- [jsonwebtoken](https://www.npmjs.com/package/jsonwebtoken 'jsonwebtoken'): An implementation of JSON Web Tokens;\u003cbr\u003e\n- [reflect-metadata](https://www.npmjs.com/package/reflect-metadata 'reflect-metadata'): A library that serves multiple use cases (dependency composition/injection, runtime type assertions, reflection/mirroring, testing) wants the ability to add additional metadata to a class in a consistent way;\u003cbr\u003e\n- [swagger-ui-express]( 'swagger-ui-express'): This module allows you to serve auto-generated swagger-ui generated API docs from express, based on a `swagger.json` file. The result is living documentation for your API hosted from your API server via a route;\u003cbr\u003e\n- [tsyringe](https://www.npmjs.com/package/tsyringe 'tsyringe'): A lightweight dependency injection container for TypeScript/JavaScript for constructor injection;\u003cbr\u003e\n- [winston](https://www.npmjs.com/package/winston 'winston'): A log logger.\u003cbr\u003e\n\n\n## Tools Used\n- **API Documentation:** Swagger;\u003cbr\u003e\n- **Compiler**: [SWC](https://swc.rs/ 'SWC');\u003cbr\u003e\n- **Container:** Docker;\u003cbr\u003e\n- **Crypto:** Bcrypt;\u003cbr\u003e\n- **Database:** PostgreSQL;\u003cbr\u003e\n- **Logger:** Winston;\u003cbr\u003e\n- **ORM:** Prisma;\u003cbr\u003e\n- **Tests:** Jest and [Supertest](https://www.npmjs.com/package/supertest 'Supertest');\u003cbr\u003e\n- **Token:** JWT.\u003cbr\u003e\n\n\n## Using the Application\n\n**Requirements**:\n- Node.js \u003e= 14.x;\n- Docker;\n- [Yarn](https://yarnpkg.com/ 'Yarn') \u003e= 1.22.x;\n- [Insomnia](https://insomnia.rest/ 'Insomnia') (Optional).\n\n**Step by step**\n1. Clone this repository:\n      \u003e SSH\n      ```\n      git clone git@github.com:padupe/template_node-ts-prisma-postgresql.git\n      ```\n\n      \u003e HTTPS\n      ```\n      git clone https://github.com/padupe/template_node-ts-prisma-postgresql.git\n      ```\n\n2. Create the `.env` file in the Project root\n\n3. Copy the code from `example.env` to `.env`\n\n4. Expand the **`docker`** directory\n\n5. Create the `.env` file\n\n6. Copy the code from the `example.env` to the `.env` created in the **`docker`** directory\n\n7. Install dependencies\n```\nyarn install\n```\n\n8. Upload the Database container\n```\ndocker-compose -f docker/docker-compose.yaml --env-file docker/.env up -d\n```\n\n9. Run the command to instantiate Prisma\n```\nyarn prisma generate\n```\n\n10. Run the command to run the migrations\n```\nyarn migrate:run\n```\n\n11. Populate the Database\n```\nyarn seed\n```\n\n12. Run the Application\n```\nyarn dev\n```\n\n### API Documentation\n[Swagger](http://localhost:3000/docs/)\u003cbr\u003e\n*IMPORTANT:* It is necessary to run the command `yarn dev`\u003cbr\u003e\n\u003cdiv align=\"center\"\u003e\n      \u003cimg align=\"center\" alt=\"Swagger\" src=\"https://github.com/padupe/template_node-ts-prisma-postgresql/blob/master/assets/swagger.png\"\u003e     \n\u003c/div\u003e\n\n### JSON for testing via Insomnia\nImport this [file](https://github.com/padupe/template_node-ts-prisma-postgresql/blob/master/insomnia/Insomnia.json \"file\") into Insomnia.\n\n### Useful Commands\n\n#### Docker\n```\ndocker-compose -f docker/docker-compose.yaml --env-file docker/.env up -d\n```\n\n#### Application\n\nStart Application\n```\nyarn dev\n```\n\nReset of Migrations and Populated Database\n```\nyarn migrate:reset\n```\n\nExpress Start of the Application\n```\nyarn start\n```\n\u003e All necessary commands are dynamically run\n\n#### Database\n\nVisual interface for managing the Database\n```\nyarn prisma studio\n```\n\n#### Automated Tests\n\nTo run all tests\n```\nyarn test\n```\n\nTo check test coverage\n```\nyarn test --coverage\n```\n\u003cdiv align=\"center\"\u003e\n      \u003cimg align=\"center\" alt=\"Coverage\" src=\"https://github.com/padupe/template_node-ts-prisma-postgresql/blob/master/assets/coverage.png\"\u003e     \n\u003c/div\u003e\n\u003cbr\u003e\n\nTo run a specific test\n```\nyarn test {path_to_test+file_name_whit_extension}\n```\n*Example:* `yarn test src/auth/jsonwebtoken.spec.ts`\u003cbr\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpadupe%2Ftemplate_node-ts-prisma-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpadupe%2Ftemplate_node-ts-prisma-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpadupe%2Ftemplate_node-ts-prisma-postgresql/lists"}