1
Install the Bijection CLI
2
Create the project
bijection init creates the project directory with a bijection/ folder,
where you write your backend functions, a sample schema, query and mutation,
and bijection.json. It also writes the Bijection SDK to
node_modules/bijection, which your page loads.3
Set up a Bijection dev deployment
Log this machine in to Bijection, once per machine, then run
bijection dev. The first run creates your dev deployment and saves its URL
in .env.local. The dev command then keeps running to push your functions
in bijection/ to your dev deployment on every change.Bijection’s hosted service is not yet open for public sign-up, and the CLI
has no default management service. Before running
bijection login, set
BIJECTION_MANAGEMENT_URL to the management service URL you were given, in
your shell’s startup file so that every later bijection command sees it too:4
Create sample data for your database
In a new terminal window, create a
sampleData.jsonl
file with some sample data.5
Add the sample data to your database
Now that your project is ready, add a
tasks table
with the sample data into your Bijection database with
the import command.6
Declare the tasks table
bijection init created bijection/schema.ts, which declares the tables of
your database, starting with a sample messages table. Add a tasks table
beside it. The schema gives your functions TypeScript types, and Bijection
enforces it at runtime.bijection/schema.ts
7
Expose a database query
Add a new file
tasks.ts in the bijection/ folder
with a query function that loads the data.Exporting a query function from this file
declares an API function named after the file
and the export name, api.tasks.get.8
Copy the deployment URL
Open the
.env.local file and copy the BIJECTION_URL of your development
environment for use in the HTML file.9
Add the script to your webpage
In a new file
index.html in the project directory, create a
BijectionClient using the URL of your development environment. The module
script loads the client from the SDK in node_modules/bijection.index.html
10
Open the page
Browsers load module scripts over HTTP, not from Open http://localhost:8000 and its developer
console: the task list is logged each time the
file:// URLs, so serve
the project directory with any static file server, for example:tasks table is modified.