> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tuturuuu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Drive

> Standalone Drive app with centralized workspace storage APIs.

## Overview

`apps/drive` is the canonical Tuturuuu Drive application. Production Drive
traffic should use `https://drive.tuturuuu.com/{wsId}` instead of rendering the
Drive explorer inside `apps/web`.

* `apps/drive` owns the workspace shell, Drive explorer UI, local
  `/verify-token` handoff, and local app-session logout.
* `apps/web /{wsId}/drive` remains a compatibility route. It checks
  `manage_drive`, preserves the query string, and redirects to the Drive app.
* Drive uses local port `7817` and Portless host `drive.tuturuuu.localhost`.

## API Ownership

Protected storage APIs remain centralized in `apps/web`:

* `apps/drive` forwards `/api/*` traffic to `apps/web`.
* Client Drive data flows must use `@tuturuuu/internal-api` helpers with
  TanStack Query.
* Do not create direct Supabase browser reads or storage mutations in
  `apps/drive`.
* `apps/web` storage routes authenticate normal web sessions and Drive
  app-session cookies through the shared storage route auth helper, then enforce
  `manage_drive` or the route-specific permission fallback.

When adding new Drive behavior, add the protected route in `apps/web`, expose it
from `packages/internal-api`, and consume it from `apps/drive`.

## CI/CD

Preview and production deployments use dedicated Vercel workflows:

* `.github/workflows/vercel-preview-drive.yaml`
* `.github/workflows/vercel-production-drive.yaml`

Both workflows are registered in `tuturuuu.ts` and use the shared
`ci-check.yml` switchboard with affected-path gating. They require
environment-scoped Vercel credentials:

* preview environment: `vercel-preview-drive`
* production environment: `vercel-production-drive`
* project secret: `VERCEL_DRIVE_PROJECT_ID`
* shared secrets: `VERCEL_TOKEN` and `VERCEL_ORG_ID`

The app-specific project secret should live in those GitHub Environments, not in
workflow-level `env`.

## Validation

Use these focused checks when changing Drive deployment wiring:

```bash theme={null}
node --test scripts/ci/check-workflow-config.test.js scripts/ci/release-workflows.test.js
```

Because Drive CI changes touch root TypeScript workflow config, finish with
`bun check` when the shared worktree state allows it.
