tpmjs/apps/railway-executor
Ajax Davis 48c41e8733 feat: add use cases marketing product with AI-generated content
Transform qualifying scenarios into marketing-ready use cases with:
- AI-generated titles, descriptions, ROI estimates, business value
- Persona/industry/category taxonomy for targeting
- Browseable feed with filtering and ranking
- SEO-optimized case study pages
- Daily cron job for generation and ranking

Database:
- Add Persona, Industry, Category lookup tables
- Add UseCase model with marketing content fields
- Add junction tables for personas/industries/categories
- Add SocialProof model for cached metrics

API:
- GET /api/use-cases - Global directory with filtering
- GET /api/use-cases/[id] - Individual use case details
- GET /api/public/users/[username]/collections/[slug]/use-cases
- POST /api/cron/use-cases - Nightly generation job

Frontend:
- /use-cases - Global feed with persona dropdown
- /use-cases/[slug] - SEO case study page
- /[username]/collections/[slug]/use-cases - Collection feed
- UseCasesFeed component - Sortable table component
- UseCaseCaseStudy component - Full case study layout
2026-01-20 16:17:35 +10:00
..
.gitignore feat: add dynamic tool loading system with Railway executor 2025-12-04 08:25:53 +10:00
Dockerfile fix(executor): use ephemeral cache dir instead of volume 2026-01-15 09:30:02 +10:00
package-lock.json feat: add dynamic tool loading system with Railway executor 2025-12-04 08:25:53 +10:00
package.json chore: update dependencies with compatibility fixes 2026-01-09 22:49:41 +10:00
README.md refactor: replace exportName with name throughout codebase 2026-01-14 14:18:36 +10:00
server.js feat: add use cases marketing product with AI-generated content 2026-01-20 16:17:35 +10:00
server.ts feat: add use cases marketing product with AI-generated content 2026-01-20 16:17:35 +10:00
start.sh fix(executor): use ephemeral cache dir instead of volume 2026-01-15 09:30:02 +10:00

Railway Dynamic Tool Executor

Dynamic tool executor service that runs with --experimental-network-imports to support loading npm packages from esm.sh at runtime.

Features

  • 🔥 Dynamic imports from esm.sh
  • 💾 Module caching for fast repeated loads
  • 🛡️ Validation of AI SDK tool structure
  • 🚀 Remote execution of tools with parameters

Endpoints

GET /health

Health check and cache statistics

POST /load-and-describe

Load a tool from esm.sh and return its schema

Request:

{
  "packageName": "firecrawl-aisdk",
  "name": "webSearchTool",
  "version": "0.7.2",
  "importUrl": "https://esm.sh/firecrawl-aisdk@0.7.2"
}

Response:

{
  "success": true,
  "tool": {
    "name": "webSearchTool",
    "description": "Search the web using Firecrawl",
    "inputSchema": { ... }
  }
}

POST /execute-tool

Execute a tool with parameters

Request:

{
  "packageName": "firecrawl-aisdk",
  "name": "webSearchTool",
  "version": "0.7.2",
  "params": {
    "query": "latest AI news"
  }
}

Response:

{
  "success": true,
  "output": { ... },
  "executionTimeMs": 1234
}

POST /cache/clear

Clear the module cache

GET /cache/stats

Get cache statistics

Local Development

# Install dependencies
npm install

# Start server
npm start

# Server runs on http://localhost:3001

Railway Deployment

This service is designed to run on Railway.

Deploy Steps

  1. Initialize Railway in this directory:
cd apps/railway-executor
railway init
  1. Link to your Railway project:
railway link
  1. Deploy:
railway up
  1. Railway will automatically:
    • Detect Node.js
    • Run npm install
    • Execute npm start (which includes --experimental-network-imports)

Environment Variables

No environment variables required for basic operation. Optional:

  • PORT - Server port (Railway sets this automatically)
  • NODE_ENV - Set to production in Railway

Testing

Test health endpoint:

curl http://localhost:3001/health

Test tool loading:

curl -X POST http://localhost:3001/load-and-describe \
  -H "Content-Type: application/json" \
  -d '{
    "packageName": "@tpmjs/hello",
    "name": "helloWorldTool",
    "version": "0.1.0"
  }'

Test tool execution:

curl -X POST http://localhost:3001/execute-tool \
  -H "Content-Type: application/json" \
  -d '{
    "packageName": "@tpmjs/hello",
    "name": "helloWorldTool",
    "version": "0.1.0",
    "params": {}
  }'

Integration with Playground

The playground app calls this service to load and execute tools dynamically.

Set in playground environment:

RAILWAY_SERVICE_URL=https://your-service.up.railway.app

Or use existing:

SANDBOX_EXECUTOR_URL=https://your-service.up.railway.app