Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Auth API with workers-rs

A self-hosted auth api for your products.

The best way to deploy on your cloudflare woker is clicking the button.

Deploy to Cloudflare

Configuration (Only when you want to develop or deploy locally)

Install mise on your device

mise bootstrap
cp .env.example .env

Follow the instructions in your .env and configure your .env

Run the following command to get DB_UUID and set DB_UUID in .env

cf d1 create --name auth-worker

Migrate tables in your local d1 database

cf d1 migrations apply $DB_UUID --local

Local development

Run the project

just dev

Local Deploy

just deploy

API

All responses use the same envelope, including 404/405 and malformed bodies:

{ "success": true, "errors": [], "messages": ["..."], "results": {} }
Method Path Description
GET /api/v1/health Liveness probe
POST /api/v1/signup Create an account
POST /api/v1/signin Verify credentials and return the account

POST /signup takes { "name", "email", "password", "confirm_password" } and answers 409 when the email is already registered.

POST /signin takes { "email", "password" } and returns the account (id, name, email, created_at). There is no token: the worker only authenticates the caller.

Passwords must be 8–64 characters; the upper bound only exists so a request cannot feed an unbounded input to Argon2.

CORS

Browser clients are blocked by default. Set CORS_ORIGINS to a comma separated list of origins (https://app.example.com,http://localhost:5173) or to * to allow every origin.

License

See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages