Skip to content

Commit 0768dc7

Browse files
PaulJPhilpclaude
andcommitted
feat: Add Vercel deployment configuration for Pattern Server
Configured Pattern Server for serverless deployment on Vercel: ## Vercel Configuration - vercel.json: Route mapping and build configuration - api/index.ts: Serverless function adapter for Pattern Server - api/tsconfig.json: TypeScript configuration for Vercel builds - .vercelignore: Exclude test files and dev artifacts ## Deployment Features - GET /health - Health check endpoint - GET /api/v1/rules - List all patterns - GET /api/v1/rules/:id - Get pattern by ID - Zero-config deployment via GitHub integration - Effect-based serverless functions with FetchHttpClient ## Documentation - DEPLOYMENT.md: Complete deployment guide - CLI and GitHub integration instructions - Testing and monitoring guidelines Ready to deploy: vercel --prod 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6f1a413 commit 0768dc7

7 files changed

Lines changed: 724 additions & 17 deletions

File tree

.vercelignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Test files
2+
**/*.test.ts
3+
**/*.test.js
4+
*.test.ts
5+
*.test.js
6+
scripts/integration.test.ts
7+
scripts/ep-rules-add.test.ts
8+
server/server.test.ts
9+
10+
# Documentation
11+
docs/
12+
*.md
13+
!README.md
14+
15+
# Build artifacts
16+
.turbo
17+
dist/
18+
build/
19+
.next/
20+
out/
21+
22+
# Development
23+
.vscode/
24+
.cursor/
25+
node_modules/
26+
27+
# Backups
28+
content-backup-*/
29+
30+
# Environment files
31+
.env.local
32+
.env.*.local
33+
34+
# Logs
35+
*.log
36+
logs/
37+
38+
# OS files
39+
.DS_Store
40+
Thumbs.db

DEPLOYMENT.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Deployment Guide
2+
3+
## Vercel Deployment
4+
5+
The Pattern Server is configured to deploy to Vercel as serverless functions.
6+
7+
### Prerequisites
8+
9+
1. Install Vercel CLI: `npm i -g vercel`
10+
2. Have a Vercel account at https://vercel.com
11+
12+
### Deployment Steps
13+
14+
#### Option 1: Deploy via Vercel CLI
15+
16+
```bash
17+
# Login to Vercel
18+
vercel login
19+
20+
# Deploy to production
21+
vercel --prod
22+
```
23+
24+
#### Option 2: Deploy via GitHub Integration
25+
26+
1. Go to https://vercel.com/new
27+
2. Import your GitHub repository
28+
3. Vercel will automatically detect the configuration
29+
4. Click "Deploy"
30+
31+
### Configuration
32+
33+
The deployment is configured via `vercel.json`:
34+
35+
- **Build**: Uses `@vercel/node` to build TypeScript serverless functions
36+
- **Routes**: Maps all API routes to the serverless function handler
37+
- **Source**: All logic is in `api/index.ts`
38+
39+
### API Endpoints
40+
41+
Once deployed, your API will be available at:
42+
43+
```
44+
https://your-project.vercel.app/health
45+
https://your-project.vercel.app/api/v1/rules
46+
https://your-project.vercel.app/api/v1/rules/:id
47+
```
48+
49+
### Environment Variables
50+
51+
No environment variables are currently required. All configuration is handled automatically.
52+
53+
### Testing Deployment
54+
55+
After deployment, test the endpoints:
56+
57+
```bash
58+
# Health check
59+
curl https://your-project.vercel.app/health
60+
61+
# List all rules
62+
curl https://your-project.vercel.app/api/v1/rules
63+
64+
# Get specific rule
65+
curl https://your-project.vercel.app/api/v1/rules/use-effect-gen-for-business-logic
66+
```
67+
68+
### Updating the Deployment
69+
70+
Simply push changes to your main branch. If you have GitHub integration enabled, Vercel will automatically redeploy.
71+
72+
For manual deployments:
73+
74+
```bash
75+
# Deploy latest changes
76+
vercel --prod
77+
```
78+
79+
### Rollback
80+
81+
If you need to rollback to a previous deployment:
82+
83+
1. Go to your project dashboard on Vercel
84+
2. Navigate to "Deployments"
85+
3. Find the previous working deployment
86+
4. Click "Promote to Production"
87+
88+
### Monitoring
89+
90+
View logs and analytics in the Vercel dashboard:
91+
- https://vercel.com/dashboard
92+
- Select your project
93+
- Go to "Deployments" or "Analytics"
94+
95+
## Local Development
96+
97+
To run the server locally:
98+
99+
```bash
100+
# Start the development server
101+
bun run server:dev
102+
103+
# Or run the standalone server
104+
bun run server/index.ts
105+
```
106+
107+
The server will be available at http://localhost:3001
108+
109+
## Testing
110+
111+
Run the full test suite:
112+
113+
```bash
114+
# All API tests
115+
bun run test:api
116+
117+
# Individual test suites
118+
bun run test:server # Server tests
119+
bun run test:cli # CLI tests
120+
bun run test:e2e # Integration tests
121+
```

0 commit comments

Comments
 (0)