mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-17 04:57:15 -05:00
8.2 KiB
8.2 KiB
Railway Codex Prompt Collection
This document captures nine system prompts for generating production-ready Railway services across multiple runtimes. Each section includes the target Railway URL, runtime, port, repository structure, and implementation details.
1. Serene Success Service (Node + Express + TypeScript)
- Railway URL: https://serene-success-production.up.railway.app
- Runtime: Node 20, Express, TypeScript
- Port: 8080
- Goal: Backend HTTP API with health and version endpoints, structured for Railway deployment.
- Repo layout:
package.json,tsconfig.json,nodemon.json,.env.example,Dockerfile,railway.json,README.md,src/with config, middleware, routes, services, and utils. - Key behaviors:
- Server reads
PORT(default 8080), applies JSON parsing, CORS, request logging, mounts routes, and uses centralized error handling. - Routes:
/returns service status JSON;/healthreports{ status: "healthy" };/versionreturns{ version: "1.0.0", commit: process.env.COMMIT_SHA || null }. - Logging middleware reports method, path, status code, and duration; error handler emits structured JSON
{ error: { message, code, details? } }. .env.exampledefinesPORT,NODE_ENV,COMMIT_SHA.- Dockerfile uses
node:20-alpine, builds TypeScript, exposes 8080;railway.jsonbuilds withnpm run build, starts withnpm run start, health at/health.
- Server reads
2. LangTrace Client Service (Tracing Client SDK)
- Railway URL: https://langtrace-client-production.up.railway.app
- Runtime: Node 20, TypeScript
- Port: 8080
- Goal: HTTP service to record traces/events and provide a reusable SDK client class.
- Repo layout: Node/TS scaffolding with Express server, config, middleware, routes (health, version, trace), SDK (
LangtraceClient), and trace types. - Key behaviors:
- Express server with JSON + CORS; routes for root info, health, version, and
POST /trace. - Trace endpoint accepts
{ serviceName, event, metadata? }, stores in memory, logs to console, returns{ ok: true, id: "<some-id>" }. - SDK class supports
recordTracewith base URL and optional API key, using fetch/axios with typed result and clean error handling. - Config handles
PORT, optionalLANGTRACE_API_KEY, andLOG_LEVEL. - Dockerfile and
railway.jsonmirror the Serene Success pattern with health at/healthand port 8080. - README documents local running and SDK usage in another Node project.
- Express server with JSON + CORS; routes for root info, health, version, and
3. Postgres Service (Node + Express + Prisma)
- Railway URL: https://postgres-production-40e6.up.railway.app
- Runtime: Node 20, TypeScript, Express, Prisma
- Port: 8080
- Database: PostgreSQL via
DATABASE_URLenvironment variable. - Goal: API demonstrating DB connectivity with a simple
Usermodel. - Repo layout: Node/TS project with Prisma schema/migrations, config, DB adapter, middleware, routes (health, version, users), services, and types.
- Key behaviors:
- Prisma schema defines
Usermodel withid,email(unique), optionalname, andcreatedAtdefaulting to now. - Routes:
/healthverifies DB connectivity (e.g.,SELECT 1);/versionreturns static version plus commit;/usersGET lists users;/usersPOST creates user from{ email, name }. - Prisma client exported as singleton;
.env.exampleincludesDATABASE_URL,PORT,NODE_ENV. - Dockerfile runs
npx prisma migrate deploybefore start;railway.jsonbuilds withnpm run build, starts withnpm run start, health at/health, port 8080.
- Prisma schema defines
4. NodeJS API Service (Generic Node API)
- Railway URL: https://nodejs-production-2a66.up.railway.app
- Runtime: Node 20, TypeScript, Express
- Port: 8080
- Goal: Generic expandable API with clean architecture and sample domain data.
- Repo layout: Node/TS structure with config, middleware, routes (health, version, sample), services, and utils.
- Key behaviors:
- Similar to Serene Success;
GET /samplereturns mocked domain data{ items: [...] }. - Dockerfile and
railway.jsonuse port 8080 and health at/health.
- Similar to Serene Success;
5. Fantastic Ambition Orchestrator (Main Backend)
- Railway URL: https://fantastic-ambition-production-d0de.up.railway.app
- Runtime: Node 20, TypeScript, Express
- Port: 8080
- Goal: Central orchestrator API prepared to integrate with other services (FastAPI, Postgres, Redis) via modular clients.
- Repo layout: Node/TS project with config, middleware, routes (health, version, orchestrate), services, clients, and utils.
- Key behaviors:
POST /orchestrateaccepts{ action, payload? }, mocks calling FastAPI/Postgres/Redis clients, and returns composed JSON{ action, called: ["fastapi", "postgres", "redis"], ok: true }.- Clients read base URLs from env (
FASTAPI_BASE_URL,POSTGRES_API_URL,REDIS_API_URL). - Dockerfile/
railway.jsonfollow standard pattern: build + start, port 8080, health at/health.
6. FastAPI Service (Python)
- Railway URL: https://fastapi-production-3753.up.railway.app
- Runtime: Python 3.11, FastAPI, Uvicorn
- Port: 8080
- Goal: FastAPI backend with health and version endpoints and clean structure.
- Repo layout:
pyproject.tomlorrequirements.txt, Dockerfile,railway.json,.env.example, README, andapp/withmain.py, config, and routers for root, health, and version. - Key behaviors:
main.pycreates FastAPI app, includes routers, uses envPORT(default 8080) for Uvicorn binding.- Routes:
/returns{ service: "fastapi-service", status: "ok" };/healthreturns{ status: "healthy" };/versionreturns{ version: "1.0.0", commit: env("COMMIT_SHA", "") }. - Config reads environment via pydantic or
os.environ. - Dockerfile uses
python:3.11-slim, installs dependencies, and runsuvicorn app.main:app --host 0.0.0.0 --port 8080;railway.jsonbuilds with pip install, starts with Uvicorn, health at/health, port 8080.
7. Redis Utility Service
- Railway URL: https://redis-production-ef5a.up.railway.app
- Runtime: Node 20, TypeScript, Express, Redis client
- Port: 8080
- Goal: Expose health and cache endpoints backed by Redis.
- Repo layout: Node/TS project with config, Redis client, middleware, routes (health, cache), and utils.
- Key behaviors:
- Redis client connects via
REDIS_URLand exposes get/set helpers. /healthpings Redis and returns{ status: "healthy", redis: "ok" }on success.POST /cacheaccepts{ key, value, ttlSeconds? }and sets Redis value;GET /cache/:keyreturns{ key, value }or 404 JSON..env.exampleincludesREDIS_URLandPORT; Dockerfile/railway.jsonmirror other Node services with port 8080 and health at/health.
- Redis client connects via
8. Bun Function Service
- Railway URL: https://function-bun-production-8c33.up.railway.app
- Runtime: Bun
- Port: 8080
- Goal: Minimal Bun HTTP server with three endpoints and simple routing.
- Repo layout:
package.jsonorbunfig.toml,.env.example, Dockerfile,railway.json, README, andsrc/withindex.tsandroutes.ts. - Key behaviors:
- Bun server uses
Bun.serveonPORT(default 8080) with routes for/,/health, and/versionreturning status/version JSON. - Simple router in
routes.tsmatches path + method. - Dockerfile uses Bun base image, installs dependencies, and runs
bun src/index.ts;railway.jsonbuilds withbun install, starts withbun src/index.ts, health at/health, port 8080.
- Bun server uses
9. Hello World Service (Minimal Node)
- Railway URL: https://hello-world-production-789d.up.railway.app
- Runtime: Node 20 + Express (JS or TS)
- Port: 8080
- Goal: Minimal production-safe Hello World service with root, health, and version routes plus Railway config.
- Repo layout:
package.json, optionaltsconfig.json,.env.example, Dockerfile,railway.json, README, andsrc/index.(js|ts). - Key behaviors:
- Routes:
/returns Hello World text or JSON;/healthreturns{ status: "healthy" };/versionreturns{ version: "1.0.0" }. - Server reads
PORTfrom env (default 8080) and logs on startup. - Dockerfile/
railway.jsonalign with other Node services (build + start, port 8080, health at/health).
- Routes: