Add Coolify REST API server with Scalar docs and UI integration

Express API server on :3100 exposing all Coolify operations:
- CRUD for apps, env vars, servers
- Full upsert pipeline (create/update + env + route + deploy)
- Drift detection, Traefik route management via SSH
- Scalar API docs at /reference, OpenAPI 3.1 spec

UI: New Coolify page with app cards, deploy/delete actions,
env var expansion. Sidebar nav + React Query hooks + fetch client.

Both UI and LLM/CLI use the same HTTP endpoints.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 11:02:17 -06:00
parent 2fe49b6725
commit 93d40455d9
16 changed files with 1426 additions and 5 deletions

33
api/server.js Normal file
View File

@@ -0,0 +1,33 @@
import express from 'express';
import cors from 'cors';
import { apiReference } from '@scalar/express-api-reference';
import { readFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import coolifyRoutes from './routes/coolify.js';
const __dirname = dirname(fileURLToPath(import.meta.url));
const spec = JSON.parse(readFileSync(join(__dirname, 'openapi.json'), 'utf8'));
const app = express();
const PORT = process.env.PORT || 3100;
app.use(cors());
app.use(express.json());
// API routes
app.use('/api/coolify', coolifyRoutes);
// OpenAPI spec
app.get('/openapi.json', (req, res) => res.json(spec));
// Scalar API docs
app.use('/reference', apiReference({ spec: { url: '/openapi.json' } }));
// Health check
app.get('/api/health', (req, res) => res.json({ status: 'ok', timestamp: new Date().toISOString() }));
app.listen(PORT, () => {
console.log(`API server running on http://localhost:${PORT}`);
console.log(`Scalar docs at http://localhost:${PORT}/reference`);
});