Setup

Scaffold the project, point it at MongoDB, and install thunder-core with its RBAC and index seed.

Four steps to a working backend. The third one - running thunder-core's setup - is the one people skip, and it is the one that makes the rest of this example work.

Clone & Initialize

git clone https://github.com/Huruf-Tech/thunder.git rental-desk
cd rental-desk
deno task init

deno task init is only for a freshly cloned project - it resets git history. If you forked an existing project, run deno task setup instead. See CLI Tasks.

Configure the Database

echo "DATABASE_URL=mongodb://localhost:27017/rental-desk" > .env

thunder-core also requires a SECRET_KEY. Generate one and append it:

echo "SECRET_KEY=$(openssl rand -hex 32)" >> .env

Add thunder-core - and run its setup

This is the step that matters for this example. The --setup flag creates the database indexes and seeds the default roles and policies - without it you have no roles to assign, and the dashboard will have nothing to show.

deno task add:plugin -n Huruf-Tech/thunder-core --setup=development

You now have sign-in, tenants, members and RBAC. See thunder-core setup for what the lifecycle scripts do.

Run the Dev Server

deno task dev

The API is live at http://localhost:8000. Fix any missing environment variables it reports - thunder-core names the ones it needs. See its environment variables.

What You Have Now

Already workingNot yet
Sign-in and sessionsAny resource of your own
Tenants, members, invitesPermissions for those resources
RBAC roles and policiesA dashboard

Next, the three schemas - and the .meta() keys that will shape every form in the dashboard before you ever open it. On to Models.


On this page