Setup and health
Health check
Answers without touching the database, for load balancers and uptime
monitors. HEAD works too.
GET /health
{ "status": "ok" }
SDK: await nb.health().
Setup status
Whether the first superuser still has to be created.
GET /setup
{ "required": true }
SDK: await nb.setupStatus().
Create the first superuser
While no superuser exists, the server log prints a one-time setup token,
valid for one hour, at most once a minute. Send it with the superuser's
credentials. Once a superuser exists, this endpoint returns 404.
- SDK
- curl
await nb.setup({
token: "<token from the server log>",
email: "you@example.com",
password: "a long password",
});
curl -X POST https://app.example/api/nextbase/setup \
-H 'content-type: application/json' \
-d '{"token":"<token from the server log>","email":"you@example.com","password":"a long password"}'
POST /setup
Body
| Param | Type | Description |
|---|---|---|
token | string | Required. The setup token from the server log. |
email | string | Required. |
password | string | Required. |
Responses
- 200
- 400
- 403
- 404
The new superuser record. Sign in with
nb.collection("_superusers").signInWithPassword(email, password).
{ "status": 400, "message": "Failed to create the superuser.", "data": { "password": { "code": "validation_length_out_of_range", "message": "..." } } }
{ "status": 403, "message": "The setup token is invalid or has expired. Check the server logs for a new one.", "data": {} }
{ "status": 404, "message": "Not found.", "data": {} }
A superuser already exists.