First Project - nself-org/cli GitHub Wiki
This guide builds a simple Todo API end-to-end using ɳSelf. No frontend, pure backend API with GraphQL and JWT auth.
mkdir todo-api && cd todo-api
nself init --name todo-api --domain localhostAccept all defaults. This generates a .env file with secure random secrets.
nself build
nself startWait for all services to show healthy. Then confirm URLs:
nself urlsnself db hasura consoleThis opens https://localhost/hasura/console in your browser. The admin secret is in your .env as HASURA_GRAPHQL_ADMIN_SECRET.
In the Hasura Console:
- Click Data → Create Table
- Table name:
todos - Add columns:
-
id, UUID, primary key, default:gen_random_uuid() -
title, Text, not null -
done, Boolean, not null, default:false -
created_at, Timestamptz, default:now()
- Click Add Table
Hasura will prompt you to track the new table. Click Track to expose it in the GraphQL API.
In the GraphiQL explorer, insert a todo:
mutation {
insert_todos_one(object: { title: "Learn nSelf" }) {
id
title
done
created_at
}
}Then query all todos:
query {
todos {
id
title
done
created_at
}
}The Auth service is running at https://localhost/auth/. Register a user:
curl -X POST https://localhost/auth/signup/email-password \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"password123"}'The response includes a JWT token. Use it in subsequent GraphQL requests:
curl -X POST https://localhost/v1/graphql \
-H "Authorization: Bearer <jwt_token>" \
-H "Content-Type: application/json" \
-d '{"query":"{ todos { id title } }"}'Set up row-level security in Hasura permissions to restrict rows by user ID.
nself stopNext: Architecture · Plugin-Overview