Team Workspace
This track builds the identity layer of a team workspace: who is on the team, where their data
lives, and which routes they may call. You go from an empty folder to a running, session-protected
app under Aspire, using NetScript's pluggable auth backend, normalized session and typed
.withAuthn() / .withAuthz() route seam instead of a hand-written sign-in flow and route
middleware.
What you will build
A NetScript workspace, my-workspace/, that:
- signs a user in through an OAuth/OIDC provider and mints a session cookie;
- stores team records in their own isolated database (Postgres by default;
mysql,mssqlorsqlitevia--db); - provisions a new member off the request path with a background job;
- rejects unauthenticated requests to its guarded routes with a
401.
All of it runs locally under one Aspire dashboard. It is one continuous app: my-workspace/ grows
with every chapter.
The arc: auth → session → authz
Each idea arrives in its own chapter:
- 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
AuthSessionand sets a session cookie. Every later request resolves the current session from that cookie. - Authz. A service gates its own routes with
.withAuthn()(resolve aPrincipal) and.withAuthz()(decide from it). This is route-level authorization, not org or role RBAC.
Who this is for
You should know the basics from the core tutorial ladder: scaffolding a workspace,
the contract → service flow, and bringing up Aspire. This track assumes you can scaffold and boot,
then adds authentication. If netscript init and aspire start are new to you, walk the
Quickstart first.
The six chapters
Start the track
Start at chapter 1 and keep the same my-workspace/ through to chapter 6. After the track, the
guides in Build › Identity & Access pick up where these chapters stop.