Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

🔖 Checkpoint: Edit /workspaces/claude-code-flow/user-service/src/app.ts

rUv0629e18693ae
diff --git a/.claude/checkpoints/1754488983.json b/.claude/checkpoints/1754488983.json
new file mode 100644
index 0000000000..4b811ca8ea
--- /dev/null
+++ b/.claude/checkpoints/1754488983.json
@@ -0,0 +1 @@
+{"branch": "checkpoint/pre-edit-20250806-140303", "file": "/workspaces/claude-code-flow/user-service/src/routes/user.routes.ts", "timestamp": "2025-08-06T14:03:03Z", "type": "pre-edit", "original_branch": "alpha-88"}
diff --git a/.claude/checkpoints/1754488985.json b/.claude/checkpoints/1754488985.json
new file mode 100644
index 0000000000..8fc8777fe8
--- /dev/null
+++ b/.claude/checkpoints/1754488985.json
@@ -0,0 +1 @@
+{"tag": "checkpoint-20250806-140304", "file": "/workspaces/claude-code-flow/user-service/src/routes/user.routes.ts", "timestamp": "2025-08-06T14:03:05Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 138 ++++++++++++++--------- .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1754488958.json | 1 + .claude/checkpoints/1754488959.json | 1 + benchmark/.claude-flow/metrics/performance.json | 2 +- benchmark/.claude-flow/metrics/task-metrics.json | 6 +- claude-flow-wiki | 0 user-service/src/routes/user.routes.ts | 74 ++++++++++++ 9 files changed, 171 insertions(+), 59 deletions(-) "}
diff --git a/user-service/src/app.ts b/user-service/src/app.ts
new file mode 100644
index 0000000000..c5097a9e60
--- /dev/null
+++ b/user-service/src/app.ts
@@ -0,0 +1,80 @@
+import express, { Application } from 'express';
+import cors from 'cors';
+import helmet from 'helmet';
+import compression from 'compression';
+import morgan from 'morgan';
+import rateLimit from 'express-rate-limit';
+import { config } from './config/config';
+import { logger, stream } from './utils/logger';
+import userRoutes from './routes/user.routes';
+import { errorHandler, notFoundHandler } from './middleware/error.middleware';
+
+export function createApp(): Application {
+ const app = express();
+
+ // Security middleware
+ app.use(helmet());
+ app.use(cors({
+ origin: config.cors.origin,
+ credentials: true,
+ }));
+
+ // Rate limiting
+ const limiter = rateLimit({
+ windowMs: config.rateLimit.windowMs,
+ max: config.rateLimit.maxRequests,
+ message: 'Too many requests from this IP, please try again later.',
+ });
+ app.use('/api/', limiter);
+
+ // Body parsing middleware
+ app.use(express.json({ limit: '10mb' }));
+ app.use(express.urlencoded({ extended: true, limit: '10mb' }));
+
+ // Compression
+ app.use(compression());
+
+ // Logging
+ if (!config.isTest) {
+ app.use(morgan('combined', { stream }));
+ }
+
+ // Health check endpoint
+ app.get('/health', (req, res) => {
+ res.json({
+ status: 'healthy',
+ timestamp: new Date().toISOString(),
+ uptime: process.uptime(),
+ environment: config.env,
+ });
+ });
+
+ // API routes
+ app.use('/api', userRoutes);
+
+ // Documentation route
+ app.get('/api/docs', (req, res) => {
+ res.json({
+ name: 'User Service API',
+ version: '1.0.0',
+ endpoints: {
+ 'POST /api/register': 'Register a new user',
+ 'POST /api/login': 'Login user',
+ 'GET /api/profile': 'Get current user profile',
+ 'POST /api/change-password': 'Change user password',
+ 'POST /api/verify-email': 'Verify user email',
+ 'GET /api/users': 'List all users (admin)',
+ 'GET /api/users/stats': 'Get user statistics (admin)',
+ 'GET /api/users/:id': 'Get user by ID',
+ 'PUT /api/users/:id': 'Update user',
+ 'DELETE /api/users/:id': 'Delete user (admin)',
+ },
+ });
+ });
+
+ // Error handling
+ app.use(notFoundHandler);
+ app.use(errorHandler);
+
+ return app;
+}
\ No newline at end of file