• Stars
    star
    7,249
  • Rank 5,343 (Top 0.2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An SQL-friendly ORM for Node.js

Stand With Ukraine

Tests Join the chat at https://gitter.im/Vincit/objection.js

Objection.js

Objection.js is an ORM for Node.js that aims to stay out of your way and make it as easy as possible to use the full power of SQL and the underlying database engine while still making the common stuff easy and enjoyable.

Even though ORM is the best commonly known acronym to describe objection, a more accurate description is to call it a relational query builder. You get all the benefits of an SQL query builder but also a powerful set of tools for working with relations.

Objection.js is built on an SQL query builder called knex. All databases supported by knex are supported by objection.js. SQLite3, Postgres and MySQL are thoroughly tested.

What objection.js gives you:

What objection.js doesn't give you:

  • A fully object oriented view of your database With objection you don't work with entities. You work with queries. Objection doesn't try to wrap every concept with an object oriented equivalent. The best attempt to do that (IMO) is Hibernate, which is excellent, but it has 800k lines of code and a lot more concepts to learn than SQL itself. The point is, writing a good traditional ORM is borderline impossible. Objection attempts to provide a completely different way of working with SQL.
  • A custom query DSL. SQL is used as a query language. This doesn't mean you have to write SQL strings though. A query builder based on knex is used to build the SQL. However, if the query builder fails you for some reason, raw SQL strings can be easily written using the raw helper function.
  • Automatic database schema creation and migration from model definitions. For simple things it is useful that the database schema is automatically generated from the model definitions, but usually just gets in your way when doing anything non-trivial. Objection.js leaves the schema related things to you. knex has a great migration tool that we recommend for this job. Check out the example project.

The best way to get started is to clone our example project and start playing with it. There's also a typescript version available.

Check out this issue to see who is using objection and what they think about it.

Shortcuts:

More Repositories

1

tarn.js

Simple and robust resource pool for node.js
JavaScript
472
star
2

objection-graphql

GraphQL schema generator for objection.js
JavaScript
307
star
3

venia

Clojure(Script) graphql query generation
Clojure
197
star
4

knex-db-manager

Utility for create, drop, truncate etc. administrative database operations.
JavaScript
142
star
5

objection-find

Build search queries for objection.js models using HTTP query parameters.
JavaScript
102
star
6

db-errors

Unified node.js error API for mysql, postgres and sqlite3
JavaScript
85
star
7

objection-db-errors

A plugin that provides better database error handling for objection.js
JavaScript
71
star
8

wordpress-theme-base

Theme base for WordPress, ES2017+ & PHP7+
PHP
63
star
9

objection-rest

REST API generator for objection.js models
JavaScript
30
star
10

satakieli

Satakieli is a i18n library that provides identical API for ClojureScript and Clojure programmers. Localized messages can be written using ICU MessageFormat syntax.
Clojure
26
star
11

wordpress

Addons for WordPress development, using Seravo/wordpress as base
JavaScript
24
star
12

logspout-gelf

Logspout with GELF adapter
Dockerfile
15
star
13

gocd-slack-task

Go CD plugin allowing to send messages to Slack
Java
13
star
14

travis-oracledb-xe

Script and guide to setup Oracle Database Express Edition on Travis CI (without need to create Oracle account)
Shell
13
star
15

summer-2018

JavaScript
6
star
16

spring-boot-word-to-html-example

Java
6
star
17

alkobot

TypeScript
6
star
18

dodo.js

JavaScript
5
star
19

teatime-2018

Teatime 2018 demo project. See https://vincitteatime.fi/
JavaScript
5
star
20

heroku-buildpack-java-nodejs

Heroku buildpack for Java applications with Node.JS and npm.
Shell
4
star
21

multi-user-test-runner

JUnit test runner for running authorization unit/integration tests with multiple users and roles
Java
4
star
22

slurp

JavaScript
3
star
23

proxios

Magical ES6 Proxy wrapper for axios
3
star
24

ffmpeg

C
2
star
25

opendatatre

Open Data TRE Meetup example
JavaScript
2
star
26

wordpress-demo

Demo project, hosted in 5$ Digital Ocean LEMP one click app
PHP
2
star
27

get-a-room

PWA for making ad hoc room reservations easy in Google Workspace environment.
TypeScript
1
star
28

curd

Hassle-free CRUD operations
Clojure
1
star
29

VISDOM-Roadmapper

Roadmapper tool developed as part of ITEA 3 VISDOM project.
TypeScript
1
star
30

pfsense-fauxer

Simple client lib for communicating with pfSense faux-api qith node.
JavaScript
1
star
31

dodo-core-features

Dodo.js framework's core features (cors, auth, gzip, cookies, logging, etc.)
JavaScript
1
star
32

mml-mapserver

Docker image and instructions to serve MML maastokartta
HTML
1
star
33

multi-user-test-runner-examples

Test project for testing multi-user-test-runner
Java
1
star
34

dodo-objection

Objection.js ORM plugin for Dodo.js framework
JavaScript
1
star
35

fastest-tester

Tester for the Fastest test framework
JavaScript
1
star
36

lunch-assistant

Hackfest 2023 Kuopio team lunch assistant
TypeScript
1
star