eveningkid/denodb
eveningkid/denodb has 1,914 GitHub stars and 126 forks. GitHot measured -1 stars in 24 hours and 0 in 7 days. Last checked 2026-11-04 09:49 UTC. Last push 2023-10-28.
MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno
Measured star growth
- in 24h
- -1
- in 7 days
- 0
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original
DenoDB
⛔️ This project is not actively maintained: expect issues, and delays in reviews
- 🗣 Supports PostgreSQL, MySQL, MariaDB, SQLite and MongoDB
- 🔥 Simple, typed API
- 🦕 Deno-ready
- Read the documentation
import { DataTypes, Database, Model, PostgresConnector } from 'https://deno.land/x/denodb/mod.ts';
const connection = new PostgresConnector({
host: '...',
username: 'user',
password: 'password',
database: 'airlines',
});
const db = new Database(connection);
class Flight extends Model {
static table = 'flights';
static timestamps = true;
static fields = {
id: { primaryKey: true, autoIncrement: true },
departure: DataTypes.STRING,
destination: DataTypes.STRING,
flightDuration: DataTypes.FLOAT,
};
static defaults = {
flightDuration: 2.5,
};
}
db.link([Flight]);
await db.sync({ drop: true });
await Flight.create({
departure: 'Paris',
destination: 'Tokyo',
});
// or
const flight = new Flight();
flight.departure = 'London';
flight.destination = 'San Francisco';
await flight.save();
await Flight.select('destination').all();
// [ { destination: "Tokyo" }, { destination: "San Francisco" } ]
await Flight.where('destination', 'Tokyo').delete();
const sfFlight = await Flight.select('destination').find(2);
// { destination: "San Francisco" }
await Flight.count();
// 1
await Flight.select('id', 'destination').orderBy('id').get();
// [ { id: "2", destination: "San Francisco" } ]
await sfFlight.delete();
await db.close();
First steps
Setting up your database with DenoDB is a four-step process:
Create a database, using
Database(learn more about clients):const connection = new PostgresConnector({ host: '...', username: 'user', password: 'password', database: 'airlines', }); const db = new Database(connection);Create models, extending
Model.tableandfieldsare both required static attributes:class User extends Model { static table = 'users'; static timestamps = true; static fields = { id: { primaryKey: true, autoIncrement: true, }, name: DataTypes.STRING, email: { type: DataTypes.STRING, unique: true, allowNull: false, length: 50, }, }; }Link your models, to add them to your database instance:
db.link([User]);Optional: Create tables in your database, by using
sync(...):await db.sync();Query your models!
await User.create({ name: 'Amelia' }); await User.all(); await User.deleteById('1');
Migrate from previous versions
v1.0.21: Migrate to connectors
License
MIT License — eveningkid
Explore related projects
Asabeneh/30-Days-Of-Python
The 30 Days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than 100 days. Follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
78,085 starsgrafana/grafana
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
77,671 starsredis/redis
For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.
77,173 starsapache/superset
Apache Superset is a Data Visualization and Data Exploration Platform
75,403 stars