Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,13 @@ curl localhost:3000/api/admin/health # health check
- **Notifications**: No alerting/notification hooks for provisioning failures
or cost threshold breaches.
<!-- END:admin-app-instructions -->

<!-- OPENWIKI:START -->

## OpenWiki

This repository uses OpenWiki for recurring code documentation. Start with `openwiki/quickstart.md`, then follow its links to architecture, workflows, domain concepts, operations, integrations, testing guidance, and source maps.

The scheduled OpenWiki GitHub Actions workflow refreshes the repository wiki. Do not hand-edit generated OpenWiki pages unless explicitly asked; prefer updating source code/docs and letting OpenWiki regenerate.

<!-- OPENWIKI:END -->
10 changes: 10 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
@AGENTS.md

<!-- OPENWIKI:START -->

## OpenWiki

This repository uses OpenWiki for recurring code documentation. Start with `openwiki/quickstart.md`, then follow its links to architecture, workflows, domain concepts, operations, integrations, testing guidance, and source maps.

The scheduled OpenWiki GitHub Actions workflow refreshes the repository wiki. Do not hand-edit generated OpenWiki pages unless explicitly asked; prefer updating source code/docs and letting OpenWiki regenerate.

<!-- OPENWIKI:END -->
8 changes: 8 additions & 0 deletions openwiki/.last-update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"updatedAt": "2026-08-02T00:17:16.948Z",
"command": "update",
"gitHead": "9a9b5975cf43e502eab6759135b1298a8587eb09",
"model": "google/gemini-2.5-flash",
"status": "complete",
"language": "en"
}
8 changes: 8 additions & 0 deletions openwiki/INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Wiki instructions — engineering mode

Audience: engineers and coding agents working in this repository.

Document the architecture, module boundaries, data flow, and non-obvious
design decisions. Prefer explaining *why* something is built the way it is
over restating what the code already makes obvious. Call out cross-repo or
cross-package dependencies explicitly. Keep pages scoped to one concept each.
60 changes: 60 additions & 0 deletions openwiki/backstage-portal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
type: Application Documentation
title: Backstage Developer Portal
description: Documentation for the Backstage developer portal application.
tags: [application, backstage, developer-portal, frontend, typescript, yarn]
---
# Backstage Developer Portal

This directory (`backstage-portal/`) contains the Backstage developer portal application. Backstage is an open-source platform for building developer portals, providing a unified experience for managing services, tools, and documentation.

## Purpose

The Backstage portal serves as a central hub for developers within CrewCircle, offering a catalog of services, documentation, and various developer tools to streamline workflows and improve productivity.

## Getting Started

To start the Backstage application locally:

```bash
yarn install
yarn start
```

This will typically launch the Backstage frontend and backend services.

## Structure Overview

```
backstage-portal/
├── app-config.yaml ← Main application configuration
├── app-config.production.yaml ← Production specific application configuration
├── backstage.json ← Backstage project metadata
├── catalog-info.yaml ← Example catalog entity definitions
├── examples/ ← Example entity and template definitions
├── packages/ ← Internal Backstage packages (e.g., app, backend)
│ ├── app/ ← Frontend application for Backstage UI
│ └── backend/ ← Backend services for Backstage
├── plugins/ ← Custom or external Backstage plugins
└── yarn.lock ← Yarn dependency lock file
```

## Key Features

* **Software Catalog**: Discover and manage all software components, services, and APIs.
* **Scaffolding**: Create new projects and components from templates.
* **Documentation**: Centralized documentation for services and APIs.
* **Integrations**: Extensible with various plugins for integrating with other developer tools.

## Configuration

The primary configuration files are `app-config.yaml` and `app-config.production.yaml`. These files define various aspects of the Backstage application, including:

* Backend service settings.
* Catalog entity providers.
* Authentication providers.
* Plugin configurations.

## Development

For local development, after cloning the repository, ensure all dependencies are installed with `yarn install` and then start the application with `yarn start`. The Backstage documentation provides comprehensive guides for extending and customizing the portal.
15 changes: 15 additions & 0 deletions openwiki/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
okf_version: "0.1"
---

# Files

- [Backstage Developer Portal](backstage-portal.md) - Documentation for the Backstage developer portal application.
- [CrewCircle Monorepo Quickstart](quickstart.md) - A quickstart guide to the CrewCircle monorepo, outlining its key components and how to get started.
- [Sisyphus Content and Plans](sisyphus.md) - Documentation for the .sisyphus directory, containing strategic plans and content for various initiatives.
- [Next.js Website Application](website.md) - Documentation for the main Next.js web application, serving as the marketing site and user-facing interfaces.

# Directories

- [packages](packages/)
- [scripts](scripts/)
64 changes: 64 additions & 0 deletions openwiki/packages/account-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
type: Package Documentation
title: Account Setup Package
description: Documentation for the account-setup package, responsible for automating vendor account creation.
tags: [package, account-setup, automation, playwright]
---
# Account Setup Package

The `@crewcircle/account-setup` package (`packages/account-setup`) is responsible for automating the one-time creation and configuration of various vendor accounts. It utilizes Playwright for browser automation to interact with vendor portals.

## Purpose

This package streamlines the initial setup process for new projects by programmatically creating accounts on services such as Cloudflare, GitHub, Stripe, and others, as defined in its `creators/` directory.

## Structure

```
packages/account-setup/
├── creators/ ← Modules for specific vendor account creation
│ ├── anthropic.py
│ ├── cloudflare.py
│ ├── crazy_domains.py
│ ├── dataforseo.py
│ ├── digitalocean.py
│ ├── doppler.py
│ ├── github.py
│ ├── google_cloud.py
│ ├── pulumi_account.py
│ ├── resend.py
│ ├── sentry.py
│ ├── stripe.py
│ ├── supabase.py
│ └── tally.py
├── lib/ ← Helper utilities (browser automation, Doppler integration, human interaction)
│ ├── browser.py
│ ├── doppler_store.py
│ └── human_pause.py
├── setup.py ← Main script to run account creation
├── config.py ← Configuration management
└── AGENT.md ← Agent instructions related to this package
```

## Usage

To run the account setup process, navigate to the package directory and execute the `setup.py` script:

```bash
cd packages/account-setup
uv run python setup.py
```

**Prerequisites:**

* Python 3.11+
* `uv` (or `pip`)
* Playwright browsers installed (e.g., `uv run playwright install chromium`)
* Environment variables configured in `.env.local` (e.g., `CC_EMAIL`, `CC_COMPANY`, `CC_GITHUB_USERNAME`). Refer to `packages/account-setup/.env.example` for required variables.

## Key Functionality

* **Automated Account Creation**: Scripts within `creators/` handle the specific logic for creating accounts on different platforms.
* **Browser Automation**: Leverages Playwright to simulate user interactions with web interfaces.
* **Doppler Integration**: The `lib/doppler_store.py` module suggests integration with Doppler for secure secret management.
* **Human Interaction**: `lib/human_pause.py` indicates points where manual intervention or verification might be required during the automated process.
61 changes: 61 additions & 0 deletions openwiki/packages/admin-ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
type: Package Documentation
title: Admin UI Package
description: Documentation for the admin-ui package, containing shared UI components for CrewCircle internal administrative tools.
tags: [package, admin, ui, react, components, shared]
---
# Admin UI Package

The `@crewcircle/admin-ui` package (`packages/admin-ui`) provides a collection of shared UI components specifically designed for CrewCircle's internal administrative tools. This package is private, meaning its intended use is within the monorepo for building consistent and efficient admin interfaces.

## Purpose

The primary goal of this package is to establish a consistent look and feel and to reuse common UI patterns across different administrative applications. By centralizing these components, development effort is reduced, and the user experience for internal tools is improved.

## Structure

```
packages/admin-ui/
├── package.json ← npm package metadata
├── src/ ← Source code for UI components
│ ├── admin-shell.tsx ← Admin shell layout component
│ ├── admin-topbar.tsx ← Admin top bar component
│ ├── cost-chart.tsx ← Component for displaying cost charts
│ ├── data-table.tsx ← Generic data table component
│ ├── index.ts ← Barrel export for components
│ ├── project-card.tsx ← Component for displaying project information
│ ├── stat-card.tsx ← Component for displaying statistics
│ ├── status-badge.tsx ← Component for displaying status badges
│ └── types.ts ← TypeScript type definitions
└── tsconfig.json ← TypeScript configuration
```

## Key Functionality and Components

* **Layout Components**: `admin-shell.tsx` and `admin-topbar.tsx` provide the fundamental layout and navigation for admin applications.
* **Data Visualization**: `cost-chart.tsx` is a specialized component for presenting cost-related data graphically.
* **Data Display**: `data-table.tsx` offers a reusable solution for presenting tabular data, while `project-card.tsx` and `stat-card.tsx` are designed for displaying specific types of information in a card format.
* **Status Indicators**: `status-badge.tsx` provides a visual cue for various statuses.

## Usage

Components from this package are consumed by other CrewCircle applications that require administrative interfaces, such as the `src/app/admin` pages in the main Next.js website. Developers would import and utilize these React components to build their admin UIs.

```tsx
import { AdminShell, DataTable, StatCard } from "@crewcircle/admin-ui";

function MyAdminPage() {
return (
<AdminShell>
<StatCard title="Total Projects" value="15" />
{/* ... other admin content */}
</AdminShell>
);
}
```

## Technologies

* **React**: For building user interfaces.
* **TypeScript**: Ensures type safety and improves developer experience.
* **Tailwind CSS Utilities**: `class-variance-authority`, `clsx`, and `tailwind-merge` indicate the use of utility-first CSS principles, likely with Tailwind CSS for styling.
81 changes: 81 additions & 0 deletions openwiki/packages/auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
type: Package Documentation
title: Authentication Package
description: Documentation for the auth package, providing Supabase Auth and multi-tenant organization helpers.
tags: [package, auth, supabase, multi-tenancy, rls, typescript, python, fastapi]
---
# Authentication Package

The `@crewcircle/auth` package (`packages/auth`) provides authentication services and multi-tenant organization helpers for CrewCircle applications. It integrates with Supabase Auth and offers both TypeScript (for Next.js) and Python (for FastAPI) helpers, along with a shared SQL migration for the organization model.

## Purpose

This package centralizes authentication logic, user and organization management, and role-based access control (RBAC) across CrewCircle applications. It simplifies the implementation of secure, multi-tenant features.

## Structure

```
packages/auth/
├── package.json ← npm package metadata (TypeScript)
├── tsconfig.json ← TypeScript configuration
├── src/ ← TypeScript source for Next.js helpers
│ ├── types.ts ← TypeScript type definitions (Organization, Role, UserWithOrg, AuthContext)
│ ├── client.ts ← Next.js browser helpers (createAuthClient, signIn, etc.)
│ ├── server.ts ← Next.js server helpers (createServerClient, requireAuth, requireOrg)
│ ├── hooks.ts ← React hooks (useAuth, useOrg, useIsMember)
│ └── index.ts ← Barrel export for TypeScript modules
├── migrations/ ← SQL migrations for Supabase
│ └── 001_auth_helpers.sql ← Supabase SQL: org, members, roles, RLS, JWT helper
└── python/ ← Python source for FastAPI helpers
├── pyproject.toml ← Python project metadata
└── crewcircle_auth/ ← Python package
├── __init__.py ← FastAPI dependencies: require_auth, require_org
├── client.py ← Supabase client factories (anon + service-role)
├── models.py ← Pydantic models: Organization, Role, UserWithOrg
└── dependencies.py ← FastAPI Depends() helpers
```

## Setup

### 1. Run the SQL Migration

Apply `migrations/001_auth_helpers.sql` to your Supabase project. This script creates:

* `public.organizations` table: Stores tenant organizations.
* `public.organization_members` table: Manages user membership within organizations.
* `public.roles` table: Defines RBAC roles (owner, admin, member, viewer).
* `public.set_current_org(uuid)` RPC function: Allows switching the active organization within a user's JWT.
* Row-Level Security (RLS) policies for all relevant tables.

### 2. Environment Variables

Configure the following environment variables, typically via Doppler:

* `NEXT_PUBLIC_SUPABASE_URL`: Your Supabase project URL (for client-side/SSR).
* `NEXT_PUBLIC_SUPABASE_ANON_KEY`: Your Supabase public anonymous key (for client-side/SSR).
* `SUPABASE_SERVICE_ROLE_KEY`: Your Supabase service role key (server-only, bypasses RLS). **Never expose this on the client-side.**

### 3. Installation

* **Next.js (TypeScript)**:
```bash
npm install @crewcircle/auth @supabase/supabase-js @supabase/ssr
```
* **FastAPI (Python)**:
```bash
cd packages/auth/python
pip install -e .
```

## Usage

### TypeScript (Next.js)

The package provides React hooks and server-side helpers for seamless integration with Next.js applications:

* **Client Components**: Use `useAuth()` and `useOrg()` hooks to access user and organization context in browser components.
* **Server Components/Route Handlers**: Use `requireAuth()` and `requireOrg()` for server-side authentication and authorization checks.

### Python (FastAPI)

FastAPI applications can use `require_auth` and `require_org` dependencies to enforce authentication and organization context for API endpoints.
Loading