@nano-sql/core2.3.2 • Public • Published
Universal database layer for the client, server & mobile devices. It's like Lego for databases.
What is nanoSQL?
nanoSQL core provides a standardized query language, data modeling, indexing and plugin system that can use almost any database technology for data storage and query; providing a consistent experience across environments and database engines. You can mix and match database backends, query languages and plugins to get the ideal environnement for rapid development.
Multiple Database Support
Run several databases in parallel, each database can use it's own adapter. This means you could have one nanoSQL instance running a Redis based database, a MySQL based database and a RocksDB based database at the same time seamlessly!
Identical API Everywhere
Develop your application with an embedded database like RocksDB, then deploy into production with Redis, Amazon Dynamo, MySQL or many others. NanoSQL even runs in the browser on top of IndexedDB, WebSQL or LocalStorage. All data is portable and all features are isomorphic; jumping between different databases and environments is trivial.
Not Only NoSQL
Classical RDBMS queries like aggregate functions, joins and group bys are also supported. You can even write your own query functions and use foreign keys!
Flexible Data Models
The best of both worlds: Use RDBMS style data models to tune performance but still allow arbitrary columns. Change your data model as often as you want and do type casting only when you need it.
Data Models => TypeScript Files
Instantly convert data models into typescript interfaces.
Use indexing to build nested graph queries on your data with the power of RDBMS and flexibility of noSQL.
Other Cool Things
Built in geolocation indexing, autocomplete, observable queries, typescript support, event system, CSV/JSON import & export, runs in every browser back to IE9 and starts at only 29KB!
Comparison with Other Projects
NanoSQL can save data to many different places, depending on the browser or environment it's being ran in.
Included In The Box
- Memory (Browser/NodeJS/Electron)
- Snap DB (NodeJS/Electron)
- Indexed DB (Browser)
- WebSQL (Browser)
- Local Storage (Browser)
npm i @nano-sql/core --save
Using in Typescript/Babel project:
Using in Node:
const nSQL = nSQL;
To use directly in the browser, drop one of the tags below into your
<!-- ES6 Only (Faster & Smaller) --><!-- ES5 (Internet Explorer/Old Browser Support) --><!-- Promise must be polyfilled as well -->
If you are migrating from nanoSQL 1.X to 2.X, please read the migration guide.
The nanoSQL command line interface allows you to compile data models into typescript interface files.
Usage is as follows:
nsql --outDir www --files file1.ts file2.ts... --watch
If you don't pass
--watch the CLI will compile the files into the given directory, then exit. You can also optionally pass
--watchPolling with an interval to enable polling on the watch system.
It's important to note the files must be formatted specifically for the CLI to read them correctly.
Each file should have an export named
tables that is an array of
InanoSQLTableConfig types. The file below is a working example:
;;// using the above object in nSQL;nSQL.createDatabase.then..
Assuming the above file is in the root directory of our project named index.ts, we could compile it to a typescript interface file with this command:
nsql --outDir www --files index.ts
The above command would produce the following file:
// Persistent DatabasenSQL.createDatabase.then.then.then;// Graph QueriesnSQL.query"select", .from.graph.exec.then;// Join QueriesnSQL.query"select", .from.where.join.exec.then
- Query Engine
- Hook/Filter System
- Memory/Local Storage Adapter
- Graph Query Support
- Event System
- Indexed DB/WebSQL/RocksDB Adapters
- Core Tests
- Adapter Tests
- 2.0 documentation
- 2.0 release
- SQLite3, Cordova, Redis, ReactNative, MySQL, Amazon Dynamo DB Adapters
- GraphQL Support
- Net Plugin (Offline Syncing)
- Search Plugin
- History Plugin
- SQLite Query Support
- MongoDB Query Support
- ReQL Query Support
- level DB
- Indexed DB