file: ./content/docs/agent-bridge/index.mdx meta: { "title": "Getting Started", "description": "Get to know the project, philosophy and how to use it.", "icon": "Telescope" } ## Introduction AgentBridge protocol is a format designed to make APIs more accessible and understandable for AI agents. It enhances standard API specifications with: } title="AI-First Design"> Optimized for LLM consumption with clear, semantic descriptions } title="Flow-Oriented"> Focuses on complete workflows rather than isolated endpoints } title="Semantic Understanding"> Goes beyond syntax to capture the purpose of API operations ## Integrating into your projects AgentBridge comes with a CLI tool and a TypeScript client library, making integration plain and simple: file: ./content/docs/enterprise-commerce/index.mdx meta: { "title": "Enterprise Commerce", "description": "Build a scalable, secure, and performant e-commerce platform with Next.js" } In progress... file: ./content/docs/next-enterprise/index.mdx meta: { "title": "Getting Started", "description": "Get to know the project, philosophy and how to use it.", "icon": "Telescope" } import { Step, Steps } from 'fumadocs-ui/components/steps'; # Introduction `next-enterprise` is an carefully crafted Next.js boilerplate for enterprise, high-performance, maintainable applications and fast iterating teams. Packed with features like **TailwindCSS v4**, **Extremely strict TypeScript**, **ESLint 9**, **Prettier**, **testing tools** and more to accelerate your development and help to bootstrap your project faster. ## Philosophy While numerous **Next.js** boilerplates exist in the market today, the majority are designed to address individual developer requirements rather than the strategic needs of development teams, particularly those operating in enterprise environments. Many solutions incorporate excessive features and tooling that add complexity without proportional value. In `next-enterprise`, based on our enterprise clients, we recognize that operational efficiency originates from strategic simplicity. Our solution delivers a streamlined, enterprise-ready foundation with carefully selected, high-impact features and tools that maximize developer productivity and accelerate time-to-market for your business-critical applications. ## Documentation purpose This documentation serves as a comprehensive technical reference for the project features and a practical guide for enterprise application development. It incorporates knowledge gained from our work with large organizations. You will find detailed guidelines, best practices, and recommendations, along with explanations of our decision-making process that emphasizes business value. ## Installation ### Clone the project ```bash git clone https://github.com/blazity/next-enterprise.git ``` *...or using GitHub CLI* ```bash gh repo clone blazity/next-enterprise ``` ### Enable corepack ```bash corepack enable && corepack enable npm ``` This needs to be done only once - you do not need to run it again for other projects. The `corepack enable npm` command may seem unreasonable as we are using `pnpm`. It is well explained in the [Matt's TotalTypeScript article](https://www.totaltypescript.com/how-to-use-corepack#why-do-we-need-corepack-enable-npm) ### Install dependencies ```bash pnpm install --frozen-lockfile ``` ### Run the project ```bash pnpm dev ``` You can now begin development on your project. We recommend reviewing the rest of the documentation to understand the project structure and the business benefits our configuration provides. file: ./content/docs/agent-bridge/packages/cli.mdx meta: { "title": "CLI", "description": "Convert or migrate OpenAPI definitions to AgentBridge protocol", "icon": "SquareTerminal" } ## Usage Run the CLI to convert an OpenAPI/Swagger file to AgentBridge: ```bash tab="npm" npx @agent-bridge/cli ``` ```bash tab="pnpm" pnpm dlx @agent-bridge/cli ``` ```bash tab="bun" bunx @agent-bridge/cli ``` CLI will prompt you for the `ANTHROPIC_API_KEY` environment variable if it's not already set, nonetheless, it's required to run. You can find your API key in the [Anthropic console](https://console.anthropic.com/). ### Options | Option | Alias | Description | | ------------ | ------------------------ | ----------------------------------------------------------- | | `-V` | `--version` | Output the version number | | `-o` | `--output ` | Output file path (default: `agentbridge.json`) | | `--no-cache` | - | Disable LLM response caching | | `-d` | `--debug` | Enable debug mode with detailed output | | `-v` | `--verbose` | Enable verbose logging with detailed processing information | | `-c` | `--concurrency ` | Number of endpoints to process in parallel (default: `3`) | | `-h` | `--help` | Display help for command | ### Performance tuning #### Concurrency The `-c` or `--concurrency` flag controls how many endpoints are processed simultaneously. Higher values can speed up processing for large APIs but may increase the likelihood of hitting rate limits. Default is `5`. #### Rate limit handling The CLI automatically handles Anthropic API rate limits: * Uses the retry-after header from Anthropic for precise backoff timing * Implements exponential backoff with jitter when headers aren't available * Scales retry attempts based on concurrency settings * Provides detailed logs about rate limit status when in verbose mode 1. Reducing the concurrency value 2. Using the cache (enabled by default) to reduce API calls in subsequent runs 3. Upgrading your Anthropic API tier for higher rate limits ## Features * Parse OpenAPI/Swagger specifications * Enhance API descriptions with AI * Detect multi-step workflows * Map data flows between endpoints * Debug mode with detailed processing information * Token usage tracking and cost estimation * Intelligent rate limit handling with automatic retries * Parallel processing of endpoints with configurable concurrency file: ./content/docs/agent-bridge/packages/client.mdx meta: { "title": "TypeScript Library", "description": "Seamlessly integrate AgentBridge-defined APIs with AI agents through AI SDK", "icon": "Fa6BrandsJS" } ## Installation ```bash tab="npm" npm install @agent-bridge/client ``` ```bash tab="pnpm" pnpm install @agent-bridge/client ``` ```bash tab="yarn" yarn add @agent-bridge/client ``` ```bash tab="bun" bun install @agent-bridge/client ``` ## Usage This library is currently tailored to work with the [AI SDK](https://github.com/vercel/ai), providing a simple interface for interacting with AgentBridge-defined APIs. Support beyond AI SDK is on the roadmap. While technically it can be used in other contexts, DX may be worse. ### Loading a Schema You can load an AgentBridge schema from either a local file or a remote URL: ```ts import { readSchemaFromFile, fetchSchemaFromUrl } from "@agent-bridge/client"; // From a local file const localSchema = await readSchemaFromFile("./path/to/schema.json"); // From a remote URL const remoteSchema = await fetchSchemaFromUrl( "https://api.example.com/schema.json" ); ``` ### Creating a Client ```ts import { AgentBridgeClient, LogLevel } from "@agent-bridge/client"; const client = AgentBridgeClient(schema, { apiKey: "your-api-key" }, LogLevel.INFO); ``` ### Usage with Vercel AI SDK ```ts import { openai } from "@ai-sdk/openai"; import { generateText } from "ai"; // ... code to initialize the client const { messages } = await req.json(); const { text } = await generateText({ model: openai("gpt-4o"), messages, tools: client.getTools(), }); ``` ### Logging The client includes a configurable logging system: ```ts // Set log level during initialization const client = new AgentBridgeClient(schema, credentials, LogLevel.DEBUG); // Or change it later client.setLogLevel(LogLevel.TRACE); ``` Available log levels: `NONE`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE` ## Methods ### executeAction A method that executes a single API action. Returns a promise that resolves to the action result. ```ts const result = await client.executeAction("get_weather", { city: "London" }); ``` ### executeFlow A method that executes a multi-step flow. Returns a promise that resolves to the flow result. ```ts const result = await client.executeFlow("aviation_weather_briefing", { date: "2023-03-01", atsu: "LHR", time: "1200", }); ``` ### getTools A method that returns a list of tools in `ToolSet` type from `ai-sdk` library. ```ts const tools = client.getTools(); ``` ### listFlows A method that returns a list of flows that can be executed. ```ts const flows = client.listFlows(); ``` ### listActions A method that returns a list of actions that can be executed. ```ts const actions = client.listActions(); ``` ### setLogLevel A method that sets the log level, controlling the verbosity of the client's logging output. ```ts client.setLogLevel(LogLevel.DEBUG); ``` ## Helpers ### readSchemaFromFile A helper function that reads a AgentBridge schema from a local file. ```ts import { readSchemaFromFile } from "@agent-bridge/client"; const schema = await readSchemaFromFile("./path/to/schema.json"); ``` ### fetchSchemaFromUrl A helper function that fetches a AgentBridge schema from a remote URL. ```ts import { fetchSchemaFromUrl } from "@agent-bridge/client"; const schema = await fetchSchemaFromUrl("https://api.example.com/schema.json"); ``` file: ./content/docs/agent-bridge/v1_0/design.mdx meta: { "title": "Design principles", "description": "Understanding the design principles behind AgentBridge" } ## AI-First AgentBridge is designed with a goal of making AI agents more capable of understanding and completing tasks autonomously. It takes a unique and tailored approach - unlike traditional API specifications that focus on isolated endpoints, AgentBridge organizes APIs into actions, flows (multi-step workflows), and entities, enriched with clear, semantic descriptions. This specific structure, provides an optimized way for LLMs to consume and perform up to expectations of the user accurately. ## Flow-Oriented Workflows are fundamental blocks in many systems, so providing a structured approach to handling complex, multi-step tasks is crucial for AI agents. AgentBridge defines a standard format for describing workflows, making it simple for AI agents to understand and execute them. ## Semantic Understanding AgentBridge excels at capturing the purpose of API operations, which helps AI agents in understanding the context and intent behind the requests. It promotes meaningful descriptions in API documentation, giving meaning to actions and entities, and conveying the relationships between steps in workflows. file: ./content/docs/next-enterprise/deployments/amazon-web-services.mdx meta: { "title": "Amazon Web Services", "description": "Learn about deployments of the next-enterprise boilerplate applications directly to the AWS Cloud", "icon": "Fa6BrandsAws" } import {Accordions, Accordion} from "fumadocs-ui/components/accordion" import {Step, Steps} from "fumadocs-ui/components/steps" import {Video} from "../../../../app/_components/video.tsx" ## AWS provider features overview * Automated provisioning of AWS infrastructure * Scalable & secure setup using: * VPC * Elastic Container Service (ECS) * Elastic Container Registry (ECR) * Application Load Balancer * S3 + CloudFront for static assets * AWS WAF (Web Application Firewall) * Redis Cluster for caching * CI/CD (GitHub Actions) ready * Deploying the `next-enterprise` application * Deploying the Storybook * Destroying the stack ## Getting started ### Pre-installation checks Make sure you have the `enterprise-cli` installed. [Read more here](/next-enterprise/deployments/enterprise-cli) ### Pre-run environment checks Ensure your current working directory is an actual `next-enterprise` boilerplate, alternatively, read more about `next-enterprise` installation process [here](/next-enterprise#installation) ### GitHub Auth Confirm that you're correctly authenticated with [GitHub CLI](https://cli.github.com/). You can quickly check this by running: ```bash gh auth status ``` If you're not authenticated, you'll be prompted to do so by running: ```bash gh auth login ``` and following the instructions. ### Prepare the AWS Iac & CI/CD ```bash enterprise prepare aws ``` ### Continue interaction with the CLI Follow the instructions displayed in the terminal!. The result of successful `prepare` command should be freshly set up `next-enterprise`-based repository with all the CI/CD configuration and IaC (Terraform) ### Actual deployment Newly created GitHub repository -> Actions -> select one of the workflows *(e.g. Deploy Stack)* -> Run Workflow ## Going forward - production environment The `enterprise-cli` installs a pre-configured **development environment**. To create a **production environment**, follow these steps: 1. **Duplicate the Terraform Configuration** * Copy the contents of the `terraform/dev` folder. * Rename the new folder to `terraform/prod`. 2. **Update Configuration References** * Replace all occurrences of `dev` with `prod`. * Replace all occurrences of `development` with `production`. 3. **Create the Production Environment in GitHub** * Go to your repository:\ **Settings > Environments > New Environment** * Name it `production`. 4. **Add Production Secrets** Under **Settings > Secrets and variables > Actions**, and select the `production` environment, add the following secrets for the **production AWS tenant**: * `AWS_ACCESS_KEY_ID` * `AWS_SECRET_ACCESS_KEY` 5. **Add Production Environment Variables** Add the following environment variables to the `production` environment: ```bash REDIS_URL=redis://next-enterprise-iac-prod-redis-cluster.example.amazonaws.com:6379 S3_STORYBOOK_BUCKET_NAME=next-enterprise-iac-storybook-prod ``` 6. **Duplicate CI/CD Pipelines** * Copy the GitHub Actions workflows related to infrastructure and Storybook deployment. * Update: * Workflow names and environment references to production * Any file paths or settings that reference `dev` or `development` This ensures the production environment is isolated and configured consistently with your development setup. ## Visualization of the infrastructure file: ./content/docs/next-enterprise/deployments/enterprise-cli.mdx meta: { "title": "Enterprise CLI", "description": "Learn more about the Enterprise CLI, an state-of-the art Next.js deployments assistant for various cloud providers", "icon": "SquareTerminal" } import { Card, Cards } from "fumadocs-ui/components/card"; import { Step, Steps } from "fumadocs-ui/components/steps"; import { Accordions, Accordion } from "fumadocs-ui/components/accordion"; import { Fa6BrandsAws } from "../../../../app/_components/icons/fa6-brands-aws.tsx"; import { Video } from "../../../../app/_components/video.tsx"; ## Introduction Enterprise CLI is a fully open source command-line tool created in Golang with goal to simplify setting up and deploying infrastructure across cloud providers by automating the processes that would require cumbersome manual work.