Skip to main content
Alpha

Team Workspace

This track builds an authenticated team-workspace backend from an empty folder to a running, session-protected app under Aspire. You will scaffold a workspace (Postgres by default, swappable to mysql, mssql, or sqlite via --db), sign users in through a pluggable auth backend, give the workspace its own isolated database, provision new members with a background job, and gate your service routes with the real .withAuthz() seam. It is one continuous app — your my-workspace/ grows with every chapter.

  1. 1 · Scaffold
  2. 2 · Auth
  3. 3 · Workspace data
  4. 4 · Provision job
  5. 5 · Route authz
  6. 6 · Deploy

What you will build

By the end of this track you will have a NetScript workspace that signs a real user in through an OAuth/OIDC provider, mints a session cookie, stores workspace records in their own isolated Postgres (the default; or mysql / mssql / sqlite via --db), provisions a new member off the request path with a background job, and rejects unauthenticated requests to its guarded routes with a 401 — all running locally under one Aspire dashboard. The central idea: authentication in NetScript is a pluggable backend, a session, and a route-authz seam — not a bespoke rewrite you carry yourself.

The arc: auth → session → authz

Three ideas carry the whole track, and each chapter adds exactly one:

  • Auth — a backend turns a sign-in into an identity. You pick one of three backends (kv-oauth, workos, better-auth) with an environment variable; the contract is identical across all three.
  • Session — a successful sign-in mints a normalized AuthSession and sets a session cookie. Every later request resolves the current session from that cookie.
  • Authz — a service gates its own routes with .withAuthn() (resolve a Principal) and .withAuthz() (decide from it). This is route-level authorization, scoped to route-level — not org/role RBAC.

Who this is for

You should be comfortable with the basics from the core tutorial ladder — scaffolding a workspace, the contract → service flow, and bringing up Aspire. This track does not re-teach those; it assumes you can scaffold and boot, then layers authentication on top. If netscript init and aspire start are new to you, walk the Quickstart first.

The six chapters

What you built

A clear map of the track: an authenticated team-workspace backend built on a pluggable auth backend, a session, and a route-authz seam — single-tenant by design, with org scoping as an explicit app-level extension. Start at chapter 1 and keep the same my-workspace/ through to deploy.