API Directory - Documentation
This directory contains static files for the Claude Code Templates project deployed on Vercel.
📁 Structure Overview
docs/api/
├── README.md # This file
└── agents.json # Static JSON file for agent queries
🔍 Why This Structure?
The project uses TWO separate API directories:
1. /api/ (Root) - Serverless Functions ✅
/api/
├── track-download-supabase.js # Serverless function
└── package.json # Dependencies
- Purpose: Vercel serverless functions (Edge Functions)
- Auto-detected by Vercel: Functions in
/api/are automatically deployed - Runtime: Node.js with ES Modules
- URL:
https://www.aitmpl.com/api/track-download-supabase
2. /docs/api/ - Static Files ✅
/docs/api/
├── README.md # This documentation
└── agents.json # Static data file
- Purpose: Static JSON files served with the frontend
- Served from:
outputDirectory: "docs"invercel.json - URL:
https://www.aitmpl.com/api/agents.json
⚠️ Important: Why Two Directories?
Vercel has a specific requirement:
- Serverless functions MUST be in
/api/at the project root - Static files can be in
/docs/api/when usingoutputDirectory: "docs"
You cannot put serverless functions in /docs/api/ - Vercel will serve them as static HTML files instead of executing them.
📄 Files in This Directory
agents.json (Static File)
- Type: Static JSON data
- Purpose: Contains the list of available agents for the frontend
- Accessed by: Frontend application via fetch
- URL:
https://www.aitmpl.com/api/agents.json - Size: ~25KB
- Updates: Generated by
/scripts/generate_components_json.pyscript
Usage:
fetch('https://www.aitmpl.com/api/agents.json')
.then(res => res.json())
.then(data => console.log(data));
🔗 Related Files
Serverless Functions (in /api/)
See /api/README.md for documentation on:
track-download-supabase.js- Download tracking endpoint- Environment variables required
- Request/response formats
- Database schema
📝 Best Practices
- Static Files: Keep in
/docs/api/ - Serverless Functions: Keep in
/api/(root) - Never Mix: Don't put serverless functions in
/docs/api/ - Version Control: Commit both directories separately
Last Updated: October 22, 2025 Maintained by: Claude Code Templates Team