{"id":18614884,"url":"https://github.com/andrewjbateman/node-sequelize-postgresql","last_synced_at":"2025-10-09T17:13:13.044Z","repository":{"id":96860792,"uuid":"486710839","full_name":"AndrewJBateman/node-sequelize-postgresql","owner":"AndrewJBateman","description":":clipboard: Node.js + Express used with Sequelize Object-Relational Mapping (ORM) to perform promise-based Create, Read, Update \u0026 Delete (CRUD) operations on linked data tables in a PostgreSQL database. SQL database data based on Sequelize Project and Workpackage models.","archived":false,"fork":false,"pushed_at":"2022-12-14T20:16:53.000Z","size":336,"stargazers_count":11,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-03T03:03:07.271Z","etag":null,"topics":["crud-operations","express","node","nodejs","postgresql","relational-database","sequelize"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/AndrewJBateman.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":"2022-04-28T18:43:45.000Z","updated_at":"2024-10-04T12:46:31.000Z","dependencies_parsed_at":"2023-05-13T13:45:54.095Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/node-sequelize-postgresql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AndrewJBateman/node-sequelize-postgresql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnode-sequelize-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnode-sequelize-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnode-sequelize-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnode-sequelize-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/node-sequelize-postgresql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnode-sequelize-postgresql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001887,"owners_count":26083197,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"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-operations","express","node","nodejs","postgresql","relational-database","sequelize"],"created_at":"2024-11-07T03:27:18.906Z","updated_at":"2025-10-09T17:13:13.014Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :zap: Node Sequelize PostgreSQL\n\n* Node.js + Express used with Sequelize Object-Relational Mapping (ORM) to perform promise-based Create, Read, Update \u0026 Delete (CRUD) operations on linked data tables in a PostgreSQL database\n* **Note:** to open web links in a new window use: _ctrl+click on link_\n\n![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/node-sequelize-postgresql?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/node-sequelize-postgresql?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/node-sequelize-postgresql?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/node-sequelize-postgresql?style=plastic)\n\n## :page_facing_up: Table of contents\n\n* [:zap: Node Sequelize PostgreSQL](#zap-node-sequelize-postgresql)\n  * [:page_facing_up: Table of contents](#page_facing_up-table-of-contents)\n  * [:books: General info](#books-general-info)\n  * [:camera: Screenshots](#camera-screenshots)\n  * [:signal_strength: Technologies](#signal_strength-technologies)\n  * [:floppy_disk: Setup](#floppy_disk-setup)\n  * [:wrench: Testing](#wrench-testing)\n  * [:computer: Code Examples](#computer-code-examples)\n  * [:cool: Features](#cool-features)\n  * [:clipboard: Status \u0026 To-Do List](#clipboard-status--to-do-list)\n  * [:clap: Inspiration](#clap-inspiration)\n  * [:file_folder: License](#file_folder-license)\n  * [:envelope: Contact](#envelope-contact)\n\n## :books: General info\n\n* SQL database data based on Sequelize Project and Workpackage models\n* Node.js project structure best practises observed with separate routes \u0026 controller code\n* The use of Projects and Workpackages is based on my Engineering experience in Norway where all Maintenance and Modification projects are documented in engineering workpackages that all have a unique workpackage id number and are tied to a project using the project id number\n\n* Project Structure:\n\n```bash\n├── package.json\n└── src\n  ├── app.js\n  ├── controllers\n  │  ├── projects.controller.js\n  │  └── workpackages.controller.js\n  ├── db\n  │  └── database.js\n  ├── index.js\n  ├── models\n  │  ├── Project.js\n  │  └── Workpackage.js\n  └── routes\n    ├── projects.routes.js\n    └── workpackages.routes.js\n```\n\n* Database Overview:\n\n![Overview](./imgs/database_overview.png)\n\n## :camera: Screenshots\n\n![Image](./imgs/thunder.png)\n\n## :signal_strength: Technologies\n\n* [Node.js v16](https://nodejs.org/) Javascript runtime using the [Chrome V8 engine](https://v8.dev/)\n* [Express v4](https://www.npmjs.com/package/express) web framework for node\n* [Sequelize v6](https://sequelize.org/) TypeScript and Node.js Object-relational mapping (ORM) for Postgres, MySQL, MariaDB, SQLite and SQL Server\n* [Thunder Client](https://www.thunderclient.com/) lightweight REST Client used to test CRUD operations\n* [DBeaver relational database tool](https://dbeaver.com/) used to connect to a PostgreSQL database\n* [PostgreSQL v14](https://www.postgresql.org/) object-relational database\n* [DB Diagram](https://dbdiagram.io/) used to create the Database Overview\n* [Structure-codes CLI](https://github.com/structure-codes/cli) used to create the Project Structure\n* [morgan v1](https://www.npmjs.com/package/morgan) HTTP request logger middleware for node.js\n\n## :floppy_disk: Setup\n\n* Assuming you have PostgreSQL database installed, install DBeaver and connect to your PostgreSQL database using DBeaver\n* `npm i` to install dependencies\n* Create `.env` and add database credentials - see `.example.env`\n* `npm run dev` runs app in the development mode with auto-restart.\n* Open [http://localhost:3000/projects](http://localhost:3000/projects) to see projects list in browser\n* Open [http://localhost:3000/workpackages](http://localhost:3000/workpackages) to see workpackages list in browser\n* CRUD operations can be performed using the Thunder Client VS Code extension\n* PostgreSQL console can be used to work with database: `\\c projects` to connect to projects database, `\\dt` to list tables, `SELECT * FROM projects;` to see projects table\n\n## :wrench: Testing\n\n* All CRUD functions tested using Thunder Client\n\n## :computer: Code Examples\n\n* `models/Workpackage.js` Workpackage model using Sequelize.define\n\n```javascript\nexport const Workpackage = sequelize.define(\n  \"workpackages\",\n  {\n    id: {\n      type: DataTypes.INTEGER,\n      primaryKey: true,\n      autoIncrement: true,\n    },\n    title: {\n      type: DataTypes.STRING,\n    },\n    description: {\n      type: DataTypes.STRING,\n    },\n    completed: {\n      type: DataTypes.BOOLEAN,\n      defaultValue: false,\n    },\n    checked: {\n      type: DataTypes.BOOLEAN,\n      defaultValue: false,\n    },\n  },\n  {\n    timestamps: false,\n  }\n);\n```\n\n## :cool: Features\n\n* Sequelize is easy to learn and the database synchronisation function is useful\n\n## :clipboard: Status \u0026 To-Do List\n\n* Status: Working\n* To-Do: Optional: add frontend cards or table to display data - could use EJS\n\n## :clap: Inspiration\n\n* [Sequelize documentation: Model Basics](https://sequelize.org/docs/v6/core-concepts/model-basics/)\n* [Sequelize documentation: Model Querying finders](https://sequelize.org/docs/v6/core-concepts/model-querying-finders/)\n\n## :file_folder: License\n\n* This project is licensed under the terms of the MIT license.\n\n## :envelope: Contact\n\n* Repo created by [ABateman](https://github.com/AndrewJBateman), email: gomezbateman@yahoo.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fnode-sequelize-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fnode-sequelize-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fnode-sequelize-postgresql/lists"}