Monorepo Structure
Relevant source files
The following files were used as context for generating this wiki page:
The SecretForge AI project is organized as a Turborepo-based monorepo, designed to manage multiple interconnected packages including an API, CLI, web dashboard, and Model Context Protocol (MCP) server within a single repository. This structure facilitates shared configurations, streamlined dependency management, and unified build pipelines across the various components of the AI-powered secret management platform.
Sources: WARP.md:55-61, README.md:129-146
Core Packages
The project's logic and interfaces are divided into distinct packages located within the packages/ directory. Each package serves a specific role in the SecretForge ecosystem, from edge-native processing to local command-line tools.
| Package | Description | Key Technologies |
|---|---|---|
packages/api | Cloudflare Workers API for secrets management and AI agents. | Hono, Workers, D1, KV, Vectorize |
packages/cli | Command-line interface for local secret management and AI interaction. | Commander, Inquirer, Ollama |
packages/web | Next.js-based dashboard for web-based secret administration. | Next.js 14, React, Tailwind CSS |
packages/mcp-server | Model Context Protocol integration for AI assistants like Claude. | @modelcontextprotocol/sdk |
packages/shared | Shared utilities, types, and analyzers used across packages. | TypeScript |
packages/github-action | CI/CD integration for secret scanning and auto-provisioning. | @vercel/ncc |
Sources: WARP.md:58-64, README.md:129-146, scripts/launch.sh:220-222, SYSTEM_EVALUATION.md:23-30
Architecture and Data Flow
The monorepo architecture centralizes the Cloudflare API as the core orchestrator, interacting with various data stores and AI agents while providing endpoints for the CLI, Web, and MCP interfaces.
The diagram illustrates the flow from peripheral interfaces through the central API to edge-native storage and AI agent layers.
Sources: README.md:72-101, WARP.md:66-72
Build and Task Orchestration
The project utilizes Turborepo to manage the task pipeline. The configuration, defined in turbo.json, establishes a dependency graph for builds and ensures efficient caching of task outputs.
Task Pipeline
- build: Compiles TypeScript and bundles outputs for all packages.
- dev: Starts local development servers (caching disabled).
- lint: Executes ESLint across the workspace.
- test: Runs the test suite and generates coverage reports.
Sources: WARP.md:74-80, CONTRIBUTING.md:164-175
Automation and Standards
The monorepo implements rigorous automation to maintain code quality and security across all packages. This is managed through GitHub Actions and Git hooks.
GitHub Actions Workflows
- CI Workflow: Handles automated linting, type checking, unit tests, and build verification on every push.
- Security Workflow: Performs dependency audits via
pnpm audit, secret scanning with TruffleHog, and CodeQL analysis. - Format Workflow: Uses Prettier to automatically format and commit code to Pull Requests.
- Deploy Workflow: Deploys the API to Cloudflare Workers and the Web dashboard to Vercel.
Sources: AUTOMATION_SUMMARY.md:13-35, CONTRIBUTING.md:65-82
Git Hooks (Husky)
The repository uses Husky to enforce standards locally before code reaches the remote:
- Pre-commit: Runs
lint-stagedto execute ESLint, Prettier, and TypeScript type checks on staged files. - Commit-msg: Validates that commit messages adhere to the Conventional Commits standard (e.g.,
feat:,fix:,chore:).
Sources: AUTOMATION_SUMMARY.md:60-68, CONTRIBUTING.md:38-55
Infrastructure and Local Development
Development in the monorepo is standardized using pnpm workspaces and Docker Compose for local service emulation.
The setup flow required to initialize the monorepo environment for local development.
Sources: WARP.md:14-43, README.md:118-127
Key Configuration Files
- pnpm-workspace.yaml: Defines the workspace roots and package boundaries.
- package.json (root): Manages global devDependencies and workspace-wide scripts.
- wrangler.toml: Configures Cloudflare-specific resources like D1, KV, and Vectorize for the
packages/api. - .lintstagedrc.json: Configures the specific linting and formatting commands for staged files.
Sources: WARP.md:82-95, AUTOMATION_SUMMARY.md:55-58
Conclusion
The monorepo structure of SecretForge AI provides a scalable foundation for developing edge-native security tools. By leveraging Turborepo for task orchestration and pnpm for workspace management, the project ensures that its CLI, API, and Web components remain synchronized while enforcing high standards for security and code quality through integrated CI/CD and local hooks.