{"id":21829730,"url":"https://github.com/0xtlt/denodb-2","last_synced_at":"2025-12-11T21:15:29.224Z","repository":{"id":62421831,"uuid":"310631262","full_name":"0xtlt/denodb-2","owner":"0xtlt","description":"MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno (DenoDB 1 from eveningkid)","archived":false,"fork":false,"pushed_at":"2020-11-08T14:58:24.000Z","size":441,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T06:09:01.840Z","etag":null,"topics":["database","deno","mysql","orm","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xtlt.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}},"created_at":"2020-11-06T15:15:51.000Z","updated_at":"2022-11-03T20:39:46.000Z","dependencies_parsed_at":"2022-11-01T17:45:45.345Z","dependency_job_id":null,"html_url":"https://github.com/0xtlt/denodb-2","commit_stats":null,"previous_names":["techtastet/denodb-2"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fdenodb-2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fdenodb-2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fdenodb-2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xtlt%2Fdenodb-2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xtlt","download_url":"https://codeload.github.com/0xtlt/denodb-2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248830395,"owners_count":21168272,"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":["database","deno","mysql","orm","sqlite","sqlite3"],"created_at":"2024-11-27T18:28:57.621Z","updated_at":"2025-12-11T21:15:29.211Z","avatar_url":"https://github.com/0xtlt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./design/logo.png\" height=\"150\" /\u003e\n\n# DenoDB 2\n\n## ⚠️ BEFORE : CREDITS ⚠️\n\nThis project is first of all a [eveningkid](https://github.com/eveningkid/denodb) project.  \nI made this new repository to develop new features and correct current bugs.  \nThe logo is also made for the initial project.\n\n## Now the _little_ documentation (from the original repository)\n\n- 🗣Supports PostgreSQL, MySQL, MariaDB, SQLite and MongoDB\n- 🔥Simple, typed API\n- 🦕Deno-ready\n- Read the documentation, WIP doc [here](https://github.com/techtastet/denodb-2/blob/main/docs/Doc.md), you can see the old doc [here](https://eveningkid.github.io/denodb-docs)\n\n```typescript\nimport {\n  DataTypes,\n  Database,\n  Model,\n} from \"https://raw.githubusercontent.com/techtastet/denodb-2/main/mod.ts\";\n\nconst db = new Database(\"postgres\", {\n  host: \"...\",\n  username: \"user\",\n  password: \"password\",\n  database: \"airlines\",\n});\n\nclass Flight extends Model {\n  static table = \"flights\";\n  static timestamps = true;\n\n  static fields = {\n    id: { primaryKey: true, autoIncrement: true },\n    departure: DataTypes.STRING,\n    destination: DataTypes.STRING,\n    flightDuration: DataTypes.FLOAT,\n  };\n\n  static defaults = {\n    flightDuration: 2.5,\n  };\n}\n\ndb.link([Flight]);\n\nawait db.sync({ drop: true });\n\nawait Flight.create({\n  departure: \"Paris\",\n  destination: \"Tokyo\",\n});\n\n// or\n\nconst flight = new Flight();\nflight.departure = \"London\";\nflight.destination = \"San Francisco\";\nawait flight.save();\n\nawait Flight.select(\"destination\").all();\n// [ { destination: \"Tokyo\" }, { destination: \"San Francisco\" } ]\n\nawait Flight.where(\"destination\", \"Tokyo\").delete();\n\nconst sfFlight = await Flight.select(\"destination\").find(2);\n// { destination: \"San Francisco\" }\n\nawait Flight.count();\n// 1\n\nawait Flight.select(\"id\", \"destination\").orderBy(\"id\").get();\n// [ { id: \"2\", destination: \"San Francisco\" } ]\n\nawait sfFlight.delete();\n\nawait db.close();\n```\n\n## First steps\n\nSetting up your database with DenoDB is a four-step process:\n\n- **Create a database**, using `Database` (learn more [about clients](#clients)):\n  ```typescript\n  const db = new Database(\"postgres\", {\n    host: \"...\",\n    username: \"user\",\n    password: \"password\",\n    database: \"airlines\",\n  });\n  ```\n- **Create models**, extending `Model`. `table` and `fields` are both required static attributes:\n\n  ```typescript\n  class User extends Model {\n    static table = \"users\";\n\n    static timestamps = true;\n\n    static fields = {\n      id: {\n        primaryKey: true,\n        autoIncrement: true,\n      },\n      name: DataTypes.STRING,\n      email: {\n        type: DataTypes.STRING,\n        unique: true,\n        allowNull: false,\n        length: 50,\n      },\n    };\n  }\n  ```\n\n- **Link your models**, to add them to your database instance:\n  ```typescript\n  db.link([User]);\n  ```\n- Optional: **Create tables in your database**, by using `sync(...)`:\n  ```typescript\n  await db.sync();\n  ```\n- **Query your models!**\n  ```typescript\n  await User.create({ name: \"Amelia\" });\n  await User.all();\n  await User.deleteById(\"1\");\n  ```\n\n## License\n\nMIT License — [techtastet](https://github.com/techtastet)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xtlt%2Fdenodb-2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xtlt%2Fdenodb-2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xtlt%2Fdenodb-2/lists"}