{"id":27886026,"url":"https://github.com/azita-abdollahi/crud-api-sequelize","last_synced_at":"2026-04-19T14:04:55.557Z","repository":{"id":153354784,"uuid":"625177693","full_name":"azita-abdollahi/crud-api-sequelize","owner":"azita-abdollahi","description":"Build a CRUD API with Node.js and Sequelize","archived":false,"fork":false,"pushed_at":"2024-09-24T06:17:14.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-05T07:54:59.266Z","etag":null,"topics":["crud-api","docker-compose","nodejs","pgsdmin","postgresql","sequelize","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azita-abdollahi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2023-04-08T09:53:35.000Z","updated_at":"2024-09-24T06:17:17.000Z","dependencies_parsed_at":"2023-04-29T23:00:39.821Z","dependency_job_id":null,"html_url":"https://github.com/azita-abdollahi/crud-api-sequelize","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/azita-abdollahi/crud-api-sequelize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azita-abdollahi%2Fcrud-api-sequelize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azita-abdollahi%2Fcrud-api-sequelize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azita-abdollahi%2Fcrud-api-sequelize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azita-abdollahi%2Fcrud-api-sequelize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azita-abdollahi","download_url":"https://codeload.github.com/azita-abdollahi/crud-api-sequelize/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azita-abdollahi%2Fcrud-api-sequelize/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32009243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["crud-api","docker-compose","nodejs","pgsdmin","postgresql","sequelize","typescript"],"created_at":"2025-05-05T07:51:22.922Z","updated_at":"2026-04-19T14:04:55.551Z","avatar_url":"https://github.com/azita-abdollahi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Build a CRUD API with Node.js and Sequelize\n\nWhat is [`Sequelize`](https://sequelize.org/)? Sequelize is a modern, promise-based, Node.js ORM (**Object Relational Mapper**) that makes it easy to work with SQL databases like PostgreSQL, MariaDB, MySQL, Microsoft SQL Server, and SQLite.\n\n#### Setup the Node.js Project\n\n```shell\nmkdir crud-app-sequelize\ncd crud-app-sequelize \u0026\u0026 code .\n```\n\nproject with the following command.\n\n```shell\nnpm init\n```\n\nYou will be prompted to provide some answers. If you don’t want to answer questions then use the `-y`flag.\n\nRun the command below to install TypeScript as a global dependency. This will allow us compile the TypeScript code into pure JavaScript using the TypeScript compiler.\n\n```shell\nnpm init -y  \nnpm install -g typescript\n```\n\nNow run these commands to install all the third-party dependencies:\n\n```shell\nnpm i sequelize pg pg-hstore cors dotenv express zod config \nnpm i -D @types/cors @types/config @types/express @types/node @types/morgan ts-node typescript nodemon\n```\n\n- `sequelize` – Sequelize is a promise-based Node.js ORM for SQL databases.\n- `pg` – A non-blocking PostgreSQL driver for Node.js. Sequelize requires this package to create connection pools to the Postgres server and manage the data stored in the database.\n- `pg-hstore` – For serializing and deserializing JSON data to PostgreSQL **hstore** data type.\n- `cors` – Provides a middleware that can be used to enable CORS in a Node.js server.\n- `dotenv` – Load environment variables from a `.env` file.\n- `express` – A Node.js web framework.\n- `zod` – A TypeScript-first schema validation library.\n- `morgan` – Provides a middleware for logging HTTP requests in Node.js.\n- `ts-node` – Compiles a TypeScript app and hot-reloads the server when required files change.\n\nRun the following command to initialize a TypeScript project. A tsconfig.json file will be created in your root directory.\n\n```shell\ntsc --init\n```\n\n#### TypeScript tsconfig.json file configurations\n\nAdd the following configuration options to your **tsconfig.json** file to allow us use decorators and more in our code.\n\n```typescript\n{\n  \"compilerOptions\": {\n    \"target\": \"es2016\",\n    \"removeComments\": true,  \n    \"module\": \"commonjs\",\n    \"esModuleInterop\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"strict\": true,\n    \"skipLibCheck\": true\n  }\n}\n```\n\nNow add the dev script to the package.json file\n\n```json\n\"scripts\": {\n    \"dev\": \"nodemon ./src/index.ts\"\n  }\n```\n\n### These are the API endpoints we need for this Rest API\n\n| RESOURCE | HTTP METHOD | ROUTE              | DESCRIPTION      |\n| -------- | ----------- | ------------------ | ---------------- |\n| notes    | GET         | /api/healthChecker | check healthy    |\n| notes    | GET         | /api/note/         | return all notes |\n| notes    | POST        | /api/note/         | create new note  |\n| notes    | GET         | /api/note/:noteId  | find note        |\n| notes    | PATCH       | /api/note/:noteId  | update note      |\n| notes    | DELETE      | /api/note/:noteId  | delete note      |\n\n### docker-compose.yml\n\n to see docker-compose file click [`here`](https://github.com/azita-abdollahi/crud-api-sequelize/blob/master/docker-compose.yml).\n\n#### Run the App\n\n start the docker containers\n\n```\n#up docker containers and build\ndocker compose up -d --build  \n#see the docker containers  \ndocker compose ps  \n#stop the docker containers  \ndocker compose down  \n#following logs of docker containers  \ndocker compose logs -f\n```\n\n**Note:** By default backend service listens on `TCP/3000` port and pg-admin is available on `TCP/8080`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazita-abdollahi%2Fcrud-api-sequelize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazita-abdollahi%2Fcrud-api-sequelize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazita-abdollahi%2Fcrud-api-sequelize/lists"}