Skip to content

Commit f9d2ce8

Browse files
authored
0.1.0 - stripe (#10)
* add agentsmith_tiers and limit functions, add project create modal, create organization modal, join organization modal, add stripe tables migration, add stripe webhook supabase edge function * fix some typescript compilation issues * fix other tests, add new tests for agentsmith_tiers table and policies * add ability for org admins to remove org members * add stripe webhook supabase edge fn, add plan upgrade modal, stripe checkout/portal handlers * slight adjustments to rendering logic for upgrade modal, allow SDK to continue execution even if logging fails due to plan limits or otherwise * add self-hosting documentation, adjust home page pricing to link to self-hosting documentation
1 parent 82de3df commit f9d2ce8

File tree

73 files changed

+4846
-449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+4846
-449
lines changed
File renamed without changes.

.github/workflows/supabase_migrations_prod.yml renamed to .github/workflows/supabase_deploy_prod.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Push Supabase Migrations to Production
1+
name: Push Supabase Migrations/Functions to Production
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
push_supabase_migrations_production:
10+
supabase_deploy_prod:
1111
environment: Production
1212
runs-on: ubuntu-latest
1313

@@ -25,3 +25,4 @@ jobs:
2525

2626
- run: supabase link --project-ref $SUPABASE_PROJECT_ID
2727
- run: supabase db push
28+
- run: supabase functions deploy --project-ref $PROJECT_ID

.github/workflows/supabase_migrations_staging.yml renamed to .github/workflows/supabase_deploy_staging.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Push Supabase Migrations to Staging
1+
name: Push Supabase Migrations/Functions to Staging
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
push_supabase_migrations_staging:
10+
supabase_deploy_staging:
1111
environment: Staging
1212
runs-on: ubuntu-latest
1313

@@ -25,3 +25,4 @@ jobs:
2525

2626
- run: supabase link --project-ref $SUPABASE_PROJECT_ID
2727
- run: supabase db push
28+
- run: supabase functions deploy --project-ref $PROJECT_ID

.source/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @ts-nocheck -- skip type checking
2+
import * as docs_6 from "../content/docs/self-hosting.mdx?collection=docs&hash=1751511820793"
23
import * as docs_5 from "../content/docs/sdk.mdx?collection=docs&hash=1751511820793"
34
import * as docs_4 from "../content/docs/prompt-authoring.mdx?collection=docs&hash=1751511820793"
45
import * as docs_3 from "../content/docs/index.mdx?collection=docs&hash=1751511820793"
@@ -7,4 +8,4 @@ import * as docs_1 from "../content/docs/getting-started.mdx?collection=docs&has
78
import * as docs_0 from "../content/docs/core-concepts.mdx?collection=docs&hash=1751511820793"
89
import { _runtime } from "fumadocs-mdx"
910
import * as _source from "../source.config"
10-
export const docs = _runtime.docs<typeof _source.docs>([{ info: {"path":"core-concepts.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/core-concepts.mdx"}, data: docs_0 }, { info: {"path":"getting-started.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/getting-started.mdx"}, data: docs_1 }, { info: {"path":"git-sync.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/git-sync.mdx"}, data: docs_2 }, { info: {"path":"index.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/index.mdx"}, data: docs_3 }, { info: {"path":"prompt-authoring.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/prompt-authoring.mdx"}, data: docs_4 }, { info: {"path":"sdk.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/sdk.mdx"}, data: docs_5 }], [])
11+
export const docs = _runtime.docs<typeof _source.docs>([{ info: {"path":"core-concepts.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/core-concepts.mdx"}, data: docs_0 }, { info: {"path":"getting-started.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/getting-started.mdx"}, data: docs_1 }, { info: {"path":"git-sync.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/git-sync.mdx"}, data: docs_2 }, { info: {"path":"index.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/index.mdx"}, data: docs_3 }, { info: {"path":"prompt-authoring.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/prompt-authoring.mdx"}, data: docs_4 }, { info: {"path":"sdk.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/sdk.mdx"}, data: docs_5 }, { info: {"path":"self-hosting.mdx","absolutePath":"/Users/lanzo/projects/agentsmith/content/docs/self-hosting.mdx"}, data: docs_6 }], [])

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"deno.enable": true,
3+
"deno.enablePaths": ["./supabase/functions"],
4+
"deno.importMap": "./supabase/functions/import_map.json"
5+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ Configure the following repository permissions:
223223
- **Contents**: Read & Write
224224
- **Metadata**: Read-only
225225
- **Pull requests**: Read & Write
226+
- **Issues**: Read & Write
226227
- **Account Permissions**: Read-only (for email address)
227228

228229
### 3. Subscribe to Events

content/docs/core-concepts.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ description: Learn how Agentsmith works
55

66
## Architecture
77

8-
Agentsmith is a platform that consists of four main components:
8+
Agentsmith is a platform that consists of five main components:
99

1010
1. **Agentsmith Studio** - A Next.js application that provides a visual interface for creating and managing prompts
11-
2. **Git Sync Engine** - A system that syncs prompts from the studio to a GitHub repository as files
12-
3. **Agentsmith SDK** - A TypeScript SDK for fetching and executing prompts from the file system (and/or studio)
13-
4. **OpenRouter** - All AI calls are made through OpenRouter to achieve maximum flexibility and cost-efficiency
11+
2. **Supabase** - A PostgreSQL database service that stores the prompts and other data
12+
3. **Git Sync Engine** - A system that syncs prompts from the studio to a GitHub repository as files
13+
4. **Agentsmith SDK** - A TypeScript SDK for fetching and executing prompts from the file system (and/or studio)
14+
5. **OpenRouter** - All AI calls are made through OpenRouter to achieve maximum flexibility and cost-efficiency
1415

1516
## OpenRouter
1617

content/docs/self-hosting.mdx

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
---
2+
title: Self-Hosting
3+
description: Deploy Agentsmith on your own infrastructure
4+
---
5+
6+
import { Alert, AlertTitle, AlertDescription } from '@/components/ui/alert';
7+
import { TriangleAlert, Info } from 'lucide-react';
8+
9+
## Overview
10+
11+
Agentsmith can be self-hosted on your own infrastructure, giving you complete control over your AI agent development platform. This guide will walk you through the process of deploying Agentsmith using Next.js and Supabase.
12+
13+
<Alert variant="warning">
14+
<TriangleAlert />
15+
<AlertTitle>Alpha Status</AlertTitle>
16+
<AlertDescription>
17+
Agentsmith is currently in alpha. Self-hosting documentation and support will be more
18+
comprehensive as we move out of the alpha phase. Railway template support is planned for easier
19+
deployment. If you encounter any issues, please reach out to support@agentsmith.app for
20+
assistance.
21+
</AlertDescription>
22+
</Alert>
23+
24+
## Prerequisites
25+
26+
Before you begin, ensure you have:
27+
28+
- A Supabase account and project
29+
- A GitHub account (for GitHub App setup)
30+
- A deployment platform (Vercel, Railway, Render, or similar)
31+
- Node.js 22+ and npm (for local development)
32+
- Docker (for local development)
33+
34+
## Deployment Steps
35+
36+
### 1. Fork the Repository
37+
38+
First, fork the Agentsmith repository to your GitHub account:
39+
40+
1. Go to [https://github.com/chad-syntax/agentsmith](https://github.com/chad-syntax/agentsmith)
41+
2. Click the "Fork" button in the top-right corner
42+
3. Clone your forked repository:
43+
```bash
44+
git clone https://github.com/your-username/agentsmith.git
45+
cd agentsmith
46+
```
47+
48+
### 2. Set Up Supabase
49+
50+
#### Create a Supabase Project
51+
52+
1. Go to [supabase.com](https://supabase.com) and create a new project
53+
2. Wait for the project to be fully initialized
54+
55+
#### Get API Keys
56+
57+
1. Navigate to Settings > API in your Supabase dashboard
58+
2. Copy the Project URL and anon/public key (you'll need these for environment variables)
59+
3. Copy the JWT secret (used for the `github_webhook` service role)
60+
61+
#### Apply Database Schema
62+
63+
The project includes migration files in `/supabase/migrations/`. Apply them using the Supabase CLI:
64+
65+
```bash
66+
# Install Supabase CLI
67+
npm install -g supabase
68+
69+
# Login to Supabase
70+
supabase login
71+
72+
# Link your project
73+
supabase link --project-ref your-project-ref
74+
75+
# Push migrations
76+
supabase db push
77+
```
78+
79+
#### Configure Authentication
80+
81+
1. In Supabase Dashboard > Authentication > Settings
82+
2. Add your site URL to "Site URL" field
83+
3. Add redirect URLs for OAuth (see GitHub App Setup section)
84+
85+
### 3. Set Up GitHub App
86+
87+
Agentsmith requires a GitHub App for repository synchronization and OAuth authentication.
88+
89+
#### Create a GitHub App
90+
91+
1. Go to GitHub > Settings > Developer settings > GitHub Apps
92+
2. Click "New GitHub App"
93+
3. Fill in the following:
94+
- **GitHub App name**: Choose a unique name
95+
- **Homepage URL**: `https://your-domain.com`
96+
- **Setup URL**: `https://your-domain.com/github/setup`
97+
- **Webhook URL**: `https://your-domain.com/api/github/webhook`
98+
- **Webhook secret**: Generate a secure random string
99+
100+
#### Set Permissions
101+
102+
Configure the following repository permissions:
103+
104+
- **Contents**: Read & Write
105+
- **Metadata**: Read-only
106+
- **Pull requests**: Read & Write
107+
- **Issues**: Read & Write
108+
- **Account Permissions**: Read-only (for email address)
109+
110+
#### Subscribe to Events
111+
112+
- Push
113+
- Pull request
114+
115+
#### Generate Private Key
116+
117+
1. Scroll down to "Private keys" section
118+
2. Click "Generate a private key"
119+
3. Download the `.pem` file
120+
4. Convert to base64: `base64 -i path/to/your-key.pem`
121+
5. Save this base64 string for your environment variables
122+
123+
#### Configure OAuth Credentials
124+
125+
1. In your GitHub App's settings page, navigate to the OAuth settings
126+
2. Generate a new client secret
127+
3. Copy the "Client ID" and the newly generated "Client Secret"
128+
4. Add these to your Supabase project's GitHub auth provider settings
129+
5. Ensure the "Authorization callback URL" points to your Supabase callback URL: `https://your-supabase-project-ref.supabase.co/auth/v1/callback`
130+
131+
### 4. Configure Environment Variables
132+
133+
Set up the following environment variables in your deployment platform:
134+
135+
```bash
136+
# Supabase Configuration
137+
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
138+
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
139+
SUPABASE_JWT_SECRET=your_supabase_jwt_secret
140+
141+
# GitHub App Configuration
142+
GITHUB_APP_ID=your_github_app_id
143+
GITHUB_APP_PRIVATE_KEY=your_github_app_private_key_base64
144+
GITHUB_APP_WEBHOOK_SECRET=your_github_app_webhook_secret
145+
GITHUB_APP_NAME=your_github_app_name
146+
147+
# GitHub OAuth (for Supabase Auth)
148+
SUPABASE_AUTH_GITHUB_CLIENT_ID=your_github_oauth_client_id
149+
SUPABASE_AUTH_GITHUB_SECRET=your_github_oauth_client_secret
150+
151+
# Site Configuration
152+
NEXT_PUBLIC_SITE_URL=https://your-domain.com
153+
154+
# Optional: Analytics
155+
NEXT_PUBLIC_POSTHOG_KEY=your_posthog_key
156+
NEXT_PUBLIC_POSTHOG_HOST=your_posthog_host
157+
158+
# Optional: Cloudflare Turnstile (for anonymous email submission)
159+
NEXT_PUBLIC_CLOUDFLARE_TURNSTILE_SITE_KEY=your_cloudflare_turnstile_site_key
160+
CLOUDFLARE_TURNSTILE_SECRET_KEY=your_cloudflare_turnstile_secret_key
161+
```
162+
163+
#### Required Environment Variables
164+
165+
| Variable | Description | Where to Get |
166+
| -------------------------------- | --------------------------------------- | ---------------------------------------------------- |
167+
| `NEXT_PUBLIC_SUPABASE_URL` | Your Supabase project URL | Supabase Dashboard > Settings > API |
168+
| `NEXT_PUBLIC_SUPABASE_ANON_KEY` | Supabase anonymous/public key | Supabase Dashboard > Settings > API |
169+
| `SUPABASE_JWT_SECRET` | Supabase JWT secret for signing tokens | Supabase Dashboard > Settings > API > JWT Secret |
170+
| `GITHUB_APP_ID` | GitHub App ID | GitHub > Settings > Developer settings > GitHub Apps |
171+
| `GITHUB_APP_PRIVATE_KEY` | GitHub App private key (base64 encoded) | Generated when creating GitHub App |
172+
| `GITHUB_APP_WEBHOOK_SECRET` | GitHub App webhook secret | Set when creating GitHub App |
173+
| `GITHUB_APP_NAME` | GitHub App name/slug | GitHub App settings |
174+
| `SUPABASE_AUTH_GITHUB_CLIENT_ID` | GitHub OAuth App Client ID | GitHub App settings |
175+
| `SUPABASE_AUTH_GITHUB_SECRET` | GitHub OAuth App Client Secret | GitHub App settings |
176+
| `NEXT_PUBLIC_SITE_URL` | Your site URL | Your deployment URL |
177+
178+
#### Optional Environment Variables
179+
180+
| Variable | Description | Where to Get |
181+
| ------------------------------------------- | ------------------------------- | -------------------------------- |
182+
| `NEXT_PUBLIC_POSTHOG_KEY` | PostHog key for analytics | PostHog Project Settings |
183+
| `NEXT_PUBLIC_POSTHOG_HOST` | PostHog host for analytics | PostHog Project Settings |
184+
| `NEXT_PUBLIC_CLOUDFLARE_TURNSTILE_SITE_KEY` | Cloudflare Turnstile Site Key | Cloudflare Dashboard > Turnstile |
185+
| `CLOUDFLARE_TURNSTILE_SECRET_KEY` | Cloudflare Turnstile Secret Key | Cloudflare Dashboard > Turnstile |
186+
187+
### 5. Deploy the Application
188+
189+
Connect your forked repository to your preferred deployment platform and configure the environment variables listed above. The application is a standard Next.js app and can be deployed to any platform that supports Node.js applications.
190+
191+
**Popular deployment options:**
192+
193+
- [Vercel](https://vercel.com) - Optimized for Next.js applications
194+
- [Railway](https://railway.app) - Simple deployment with database integration
195+
- [Render](https://render.com) - Full-stack platform with free tier
196+
197+
### 6. Verify Deployment
198+
199+
After deployment, verify that:
200+
201+
1. Your application is accessible at your domain
202+
2. Authentication is working properly
203+
3. GitHub App integration is functional
204+
4. Database migrations have been applied successfully
205+
206+
<Alert variant="default">
207+
<Info />
208+
<AlertTitle>Need Support?</AlertTitle>
209+
<AlertDescription>
210+
If you encounter issues with self-hosting, please reach out to our support team at{' '}
211+
<a href="mailto:support@agentsmith.app" className="underline">
212+
support@agentsmith.app
213+
</a>
214+
. We're here to help!
215+
</AlertDescription>
216+
</Alert>

0 commit comments

Comments
 (0)