Control plane

FreeVelox Control

The control plane for FreeVelox. It signs a user in through Feishu or through your SSO provider, hands the session back to the Console, and holds the accounts, organisations, entitlements and billing that the Console and the Site read from. The Console does not depend on it, and it holds no test data of its own.

The endpoints

Four routes, all of them a redirect in or out. Two start a sign-in, two receive the provider's answer.

GET/auth/feishu

Start a Feishu sign-in

Redirects to the Feishu authorisation page with the application id and the configured redirect URI. The user leaves the console here and comes back on the callback route.

GET/auth/sso

Start an SSO sign-in

Redirects to the SSO provider with the client id, requesting the openid, profile and email scopes. The user returns on the SSO callback route.

GET/auth/feishu/callback

Feishu callback

Handles the provider's answer: exchanges the authorisation code, establishes the session, and sends the user on to the Console.

GET/auth/sso/callback

SSO callback

The same exchange for the SSO provider. Both callbacks read the code from the query string and refuse a request that arrives without one.

How a sign-in flows

The service never holds a password. It sends the user to the provider, and the provider comes back with a code.

  1. 1

    The client asks for a sign-in

    The Console opens the Feishu or SSO authorisation route in the user's browser.

  2. 2

    The service hands off to the provider

    The user is redirected to the provider with the client id, the redirect URI and the scopes the service needs.

  3. 3

    The provider answers

    The provider calls the matching callback route with an authorisation code.

  4. 4

    The session is established

    The code is exchanged, the session is created, and the user lands back in the Console.

Configuration

Six environment variables, read from the environment the service runs in. Put them in .env.local. .env.local

VariableDefaultMeaning
FEISHU_APP_ID—The Feishu application id. The Feishu authorisation route refuses to start without it.
FEISHU_REDIRECT_URIhttp://localhost:3004/auth/feishu/callbackWhere Feishu sends the user back.
SSO_CLIENT_ID—The client id issued by the SSO provider. The SSO authorisation route refuses to start without it.
SSO_URL—The SSO provider.
SSO_REDIRECT_URIhttp://localhost:3004/auth/sso/callbackWhere the SSO provider sends the user back.
WEB_URLhttp://localhost:3002Where the user is sent after a successful sign-in.

Run it locally

The service runs on a single port in both development and production.

pnpm --filter @velox/control dev      # http://localhost:3004
pnpm --filter @velox/control build
pnpm --filter @velox/control start    # serves the build on http://localhost:3004