{"id":21585114,"url":"https://github.com/felipeoriani/nodejs-database-concurrency","last_synced_at":"2026-04-14T19:31:37.985Z","repository":{"id":250936573,"uuid":"835908688","full_name":"felipeoriani/nodejs-database-concurrency","owner":"felipeoriani","description":"NodeJs Database Concurrency explores strategies to handle multiples users in high concurrency. Here I explore NodeJs, Typescript, PostgreSql with different packages including pg and Prisma ORM.","archived":false,"fork":false,"pushed_at":"2024-07-31T12:19:59.000Z","size":44,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-27T02:31:15.005Z","etag":null,"topics":["database","isolation-levels","javascript","locking","locking-strategies","mysql","nodejs","pessimistic-concurrency","pg","postgres","postgresql","transactions","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/felipeoriani/nodejs-database-concurrency","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/felipeoriani.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-30T19:07:32.000Z","updated_at":"2024-12-27T07:25:09.000Z","dependencies_parsed_at":"2025-01-24T15:30:39.589Z","dependency_job_id":"0663755a-48cd-44b0-954b-fe545ad33523","html_url":"https://github.com/felipeoriani/nodejs-database-concurrency","commit_stats":null,"previous_names":["felipeoriani/nodejs-database-concurrency"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/felipeoriani/nodejs-database-concurrency","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipeoriani%2Fnodejs-database-concurrency","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipeoriani%2Fnodejs-database-concurrency/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipeoriani%2Fnodejs-database-concurrency/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipeoriani%2Fnodejs-database-concurrency/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felipeoriani","download_url":"https://codeload.github.com/felipeoriani/nodejs-database-concurrency/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipeoriani%2Fnodejs-database-concurrency/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31812968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["database","isolation-levels","javascript","locking","locking-strategies","mysql","nodejs","pessimistic-concurrency","pg","postgres","postgresql","transactions","typescript"],"created_at":"2024-11-24T15:09:06.057Z","updated_at":"2026-04-14T19:31:37.966Z","avatar_url":"https://github.com/felipeoriani.png","language":"TypeScript","readme":"# Node.JS Database Concurrency\r\n\r\nIn this repository, I aim to explore various _Database Concurrency Strategies_ in different databases including `Postgres`, `MySQL` and `Microsoft SQL Server` using `Node.JS` and `Typescript`. It covers strategies such as:\r\n\r\n- Optimistic Concurrency Control\r\n- Pessimistic Concurrency Control\r\n- Hybrid Concurrency Control\r\n\r\nThe goal is to demonstrate these strategies in different databases and their respective packages. For instance, for `Postgres`, we'll explore implementations using the [`pg`](https://www.npmjs.com/package/pg) package, as well as _ORMs_ like [`Prisma`](https://www.prisma.io/) and [`Sequelize`](https://sequelize.org/). This repository serves as a reference for myself and anyone interested in learning how to apply these concurrency strategies.\r\n\r\n:warning: _The code in this repository is still in progress._\r\n\r\n## How to setup\r\n\r\nTo correctly use it, you need to have a `PostgreSQL` database running on your machine configured at the `.env` file. Make sure you have match the `.env` database connection info with the `docker-compose.yml` file.\r\n\r\nYou can easly do it using:\r\n\r\n```\r\ndocker compose up -d\r\n```\r\n\r\nYou can run the:\r\n\r\n```\r\nnpm start\r\n```\r\n\r\nJust to check some extra information and also, you can run the following `npm` commands to explore the strategies:\r\n\r\n```\r\nnpm run db:pg:optimistic\r\nnpm run db:pg:pessimistic\r\nnpm run db:pg:hybrid\r\n```\r\n\r\nor using `yarn`:\r\n\r\n```\r\nyarn db:pg:optimistic\r\nyarn db:pg:pessimistic\r\nyarn db:pg:hybrid\r\n```\r\n\r\nMost of them will reset the database, seed and run the strategy. You can check the files to understand each strategy.\r\n\r\nAt the end of the execution, you will see the results and some explanation why you get that result.\r\n\r\nThank you!\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipeoriani%2Fnodejs-database-concurrency","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelipeoriani%2Fnodejs-database-concurrency","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipeoriani%2Fnodejs-database-concurrency/lists"}