Let's build amazing things more quickly and with less code.
We're building features to help developers to create awesome database using Fauna.
yarn add tordo.js
npm install tordo.js
For full documentation, visit tordojs.com.
At first, you need to create your collections
import { BaseCollection, field } from 'tordo.js'
export class User extends BaseCollection {
@field()
name: string
@field()
email: string
}
After that, we need create new file tordo/config.ts
to put our collection and allow use commands to migrate or see the database state, for example.
import { TordoCLI } from 'tordo.js'
import { User } from 'collections/User'
/**
* This is your Source of Truth.
*
* TordoJS require know all your collections.
* To make any update in your database is required add first in this file.
*
*/
const tordoCLI = new TordoCLI()
// add all your collections here
tordoCLI.add(User)
tordoCLI.runCommand(process.argv)
One of the best features are allow you to use command line to manage your database.
for now, is required you use ts-node to run the commands.
// some configurations you need create one tsconfig.tordo.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "commonjs"
}
}
//change your package.json and add this command.
{
scripts: {
"tordo": "TS_NODE_PROJECT='./tordo/tsconfig.tordojs.json' ts-node ./tordo/config.ts"
}
}
Now we can use tordo commands
#this command create, update and delete your collections and indexes
yarn tordo migration
# allow you to see collections and indexes created in your database.
yarn tordo list
# boolean. Default is true
TORDO_FAUNADB_LOCAL=
# string. Need be CLASSIC, EUROPE or USA. Default is CLASSIC when use cloud database.
FAUNADB_REGION=
# string. Key to use your cloud database. Default is secret to allow you use fauna docker
FAUNADB_KEY=
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
- Dev: We are developing the main features.
- Alpha: We are testing TordoJS with internal projects.
- Public Beta: Stable enough for most use-cases
- Public: Production-ready