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.
Overview
apps/calendar and the Calendar experience inside apps/web are paired
Calendar hosts. They must stay 1:1 for product features, data behavior,
mutations, permissions, and user-facing workflow updates.
- Calendar UI and logic should live in shared packages, primarily
@tuturuuu/ui/calendar-app/*, with app route files acting as thin auth and workspace-context wrappers. apps/calendarowns its standalone workspace shell, local/login, and local/verify-tokencompletion route.apps/web /{wsId}/calendarrenders the same shared Calendar product surface inside the normal platform dashboard shell.- Dashboard navigation in
apps/webshould link to the local/{wsId}/calendarroute, not to the standalone Calendar origin.
Auth Model
Calendar does not create local Supabase Auth sessions. It uses centralapps/web login plus a Calendar app-session cookie:
/logininapps/calendarnormalizes a safenextpath.- If both the Calendar app-session cookie and Web-issued app-session cookie are
already present,
/loginredirects to that localnextpath immediately. - Otherwise
/loginredirects toapps/web /loginwith a return URL pointing back to Calendar/verify-token?nextUrl=.... /verify-tokenposts the handoff token to the Calendar-local verifier, which validates through central Web and sets host-local app-session cookies.
sb-*-auth-token cookies. A valid
Calendar session is represented by Tuturuuu app-session cookies, not by a local
Supabase browser session.
API Ownership
Protected Calendar data APIs remain inapps/web. apps/calendar rewrites
fallback /api/* requests to the central Web app, and routes consumed by
Calendar must opt into app-session auth explicitly when used by the standalone
host.
- Calendar-only routes use
targetApp: 'calendar'. - Task and board helper routes that Calendar legitimately calls for quick task
creation, task sidebar scheduling, and time tracker task creation use
targetApp: ['calendar', 'tasks']. - Do not accept generic satellite app-session tokens for Calendar APIs.
- Keep workspace membership checks and Calendar/task permissions on the central route before admin-backed reads or writes.
OAuth Token Safety
Calendar OAuth credentials live incalendar_auth_tokens. RLS restricts
selects to user_id = auth.uid(), but admin/service-role reads bypass RLS.
Calendar server pages must therefore:
- Check
manage_calendarbefore loading calendar integration state. - Scope token reads to both
ws_idand the authenticateduser_id. - Never pass
access_tokenorrefresh_tokeninto client components. SSR props should use the sharedfetchUserWorkspaceCalendarGoogleTokenForClient()helper from@tuturuuu/utils/calendar-auth-token, which projects only connection metadata (id, account email/name, provider, active state, expiry). - Keep token refresh and Google API calls on central
apps/webAPI routes.
select('*') on calendar_auth_tokens.
When adding new Calendar UI that needs protected data, update the shared
Calendar component or helper first, then wire both host wrappers in the same
change. Prefer a central apps/web API route and a packages/internal-api
helper instead of host-local product API forks or direct client Supabase reads.