Skip to content

Quickstart

Get your Authrim instance up and running in minutes.

Prerequisites

Before you begin, ensure you have:

1. Clone the Repository

Terminal window
git clone https://github.com/sgrastar/authrim.git
cd authrim

2. Install Dependencies

Terminal window
pnpm install

3. Login to Cloudflare

Terminal window
wrangler login

4. Run the Setup Wizard

Use the @authrim/setup CLI tool to automatically configure your environment:

Terminal window
npx @authrim/setup --cli

Or launch the interactive Web UI:

Terminal window
npx @authrim/setup

The setup wizard will:

  • Generate cryptographic keys (RSA for JWT signing)
  • Create .dev.vars with environment variables
  • Generate wrangler.toml for local development
  • Set up KV namespaces with default settings
  • Create the D1 database
  • Deploy Durable Objects

Setup Options

OptionDescription
--cliUse CLI mode (no Web UI)
--env=<env>Specify environment (dev / prod)
--lang=jaUse Japanese language

5. Start Development Server

Terminal window
pnpm run dev

This starts all workers in development mode. Access endpoints at http://localhost:8787.

6. Verify Your Setup

Test the discovery endpoint:

Terminal window
curl http://localhost:8787/.well-known/openid-configuration | jq

You should see the OpenID Connect discovery document with endpoints like:

{
"issuer": "http://localhost:8787",
"authorization_endpoint": "http://localhost:8787/authorize",
"token_endpoint": "http://localhost:8787/token",
"userinfo_endpoint": "http://localhost:8787/userinfo",
"jwks_uri": "http://localhost:8787/.well-known/jwks.json"
}

Test the JWKS endpoint:

Terminal window
curl http://localhost:8787/.well-known/jwks.json | jq

Quick Test: Authorization Flow

Navigate to this URL in your browser to test the authorization flow:

http://localhost:8787/authorize?response_type=code&client_id=test-client&redirect_uri=http://localhost:3000/callback&scope=openid&state=random-state

Setup Flow Summary

git clone + pnpm install
wrangler login
npx @authrim/setup --cli ← Configures everything automatically
pnpm run dev

Legacy Setup (Manual)

For detailed customization or troubleshooting, you can use individual scripts:

Terminal window
# Generate keys
./scripts/setup-keys.sh
# Configure local environment
./scripts/setup-local-vars.sh
./scripts/setup-local-wrangler.sh
# Set up cloud resources
./scripts/setup-kv.sh --env=dev
./scripts/setup-d1.sh
./scripts/setup-durable-objects.sh
# Optional: Configure email (for OTP authentication)
./scripts/setup-resend.sh --env=local

Next Steps