backend changes

This commit is contained in:
Chandini 2025-10-03 10:13:06 +05:30
parent c7d0448518
commit dd77bef0a9
35 changed files with 173 additions and 138 deletions

2
Jenkinsfile vendored
View File

@ -255,7 +255,7 @@ pipeline {
# Test API Gateway endpoint (if available) # Test API Gateway endpoint (if available)
echo "Testing API Gateway health..." echo "Testing API Gateway health..."
timeout 30 bash -c "until curl -f http://localhost:8000/health 2>/dev/null; do echo \\"Waiting for API Gateway...\\"; sleep 5; done" || echo "API Gateway health check timeout" timeout 30 bash -c "until curl -f https://dashboard.codenuk.com/health 2>/dev/null; do echo \\"Waiting for API Gateway...\\"; sleep 5; done" || echo "API Gateway health check timeout"
echo "Container resource usage:" echo "Container resource usage:"
docker stats --no-stream --format "table {{.Container}}\\t{{.CPUPerc}}\\t{{.MemUsage}}" docker stats --no-stream --format "table {{.Container}}\\t{{.CPUPerc}}\\t{{.MemUsage}}"

View File

@ -6,14 +6,14 @@
// ======================================== // ========================================
// LIVE PRODUCTION URLS (Currently Active) // LIVE PRODUCTION URLS (Currently Active)
// ======================================== // ========================================
// const FRONTEND_URL = 'https://dashboard.codenuk.com'; const FRONTEND_URL = 'https://dashboard.codenuk.com';
// const BACKEND_URL = 'https://backend.codenuk.com'; const BACKEND_URL = 'https://backend.codenuk.com';
// ======================================== // ========================================
// LOCAL DEVELOPMENT URLS // LOCAL DEVELOPMENT URLS
// ======================================== // ========================================
const FRONTEND_URL = 'http://localhost:3001'; // const FRONTEND_URL = 'http://localhost:3001';
const BACKEND_URL = 'http://localhost:8000'; // const BACKEND_URL = 'http://localhost:8000';
// ======================================== // ========================================
// CORS CONFIGURATION (Auto-generated) // CORS CONFIGURATION (Auto-generated)

View File

@ -233,7 +233,7 @@ services:
- NODE_ENV=development - NODE_ENV=development
- PORT=8000 - PORT=8000
- HOST=0.0.0.0 - HOST=0.0.0.0
- CORS_ORIGINS=http://localhost:3001 - CORS_ORIGINS=https://dashboard.codenuk.com
- CORS_METHODS=GET,POST,PUT,DELETE,PATCH,OPTIONS # Add this line - CORS_METHODS=GET,POST,PUT,DELETE,PATCH,OPTIONS # Add this line
- CORS_CREDENTIALS=true # Add this line - CORS_CREDENTIALS=true # Add this line
# Database connections # Database connections
@ -494,7 +494,7 @@ services:
ports: ports:
- "8011:8011" - "8011:8011"
environment: environment:
- FRONTEND_URL=http://localhost:3001 - FRONTEND_URL=https://dashboard.codenuk.com
- PORT=8011 - PORT=8011
- HOST=0.0.0.0 - HOST=0.0.0.0
- NODE_ENV=development - NODE_ENV=development
@ -641,7 +641,7 @@ services:
environment: environment:
- PORT=8012 - PORT=8012
- HOST=0.0.0.0 - HOST=0.0.0.0
- FRONTEND_URL=http://localhost:3001 - FRONTEND_URL=https://dashboard.codenuk.com
- POSTGRES_HOST=postgres - POSTGRES_HOST=postgres
- POSTGRES_PORT=5432 - POSTGRES_PORT=5432
- POSTGRES_DB=dev_pipeline - POSTGRES_DB=dev_pipeline
@ -653,26 +653,26 @@ services:
- NODE_ENV=development - NODE_ENV=development
- GITHUB_CLIENT_ID=Ov23liQgF14aogXVZNCR - GITHUB_CLIENT_ID=Ov23liQgF14aogXVZNCR
- GITHUB_CLIENT_SECRET=8bf82a29154fdccb837bc150539a2226d00b5da5 - GITHUB_CLIENT_SECRET=8bf82a29154fdccb837bc150539a2226d00b5da5
- GITHUB_REDIRECT_URI=http://localhost:8000/api/github/auth/github/callback - GITHUB_REDIRECT_URI=https://backend.codenuk.com/api/github/auth/github/callback
- ATTACHED_REPOS_DIR=/tmp/git-repos - ATTACHED_REPOS_DIR=/tmp/git-repos
- GIT_REPOS_BASE_DIR=/tmp/git-repos - GIT_REPOS_BASE_DIR=/tmp/git-repos
- GIT_DIFF_DIR=/tmp/git-repos/diffs - GIT_DIFF_DIR=/tmp/git-repos/diffs
- SESSION_SECRET=git-integration-secret-key-2024 - SESSION_SECRET=git-integration-secret-key-2024
- JWT_ACCESS_SECRET=access-secret-key-2024-tech4biz-secure_pipeline_2024 - JWT_ACCESS_SECRET=access-secret-key-2024-tech4biz-secure_pipeline_2024
- API_GATEWAY_PUBLIC_URL=http://localhost:8000 - API_GATEWAY_PUBLIC_URL=https://backend.codenuk.com
# Additional VCS OAuth URLs for gateway # Additional VCS OAuth URLs for gateway
- BITBUCKET_CLIENT_ID=ZhdD8bbfugEUS4aL7v - BITBUCKET_CLIENT_ID=ZhdD8bbfugEUS4aL7v
- BITBUCKET_CLIENT_SECRET=K3dY3PFQRJUGYwBtERpHMswrRHbmK8qw - BITBUCKET_CLIENT_SECRET=K3dY3PFQRJUGYwBtERpHMswrRHbmK8qw
- BITBUCKET_REDIRECT_URI=http://localhost:8000/api/vcs/bitbucket/auth/callback - BITBUCKET_REDIRECT_URI=https://backend.codenuk.com/api/vcs/bitbucket/auth/callback
- GITLAB_BASE_URL=https://gitlab.com - GITLAB_BASE_URL=https://gitlab.com
- GITLAB_CLIENT_ID=f05b0ab3ff6d5d26e1350ccf42d6394e085e343251faa07176991355112d4348 - GITLAB_CLIENT_ID=f05b0ab3ff6d5d26e1350ccf42d6394e085e343251faa07176991355112d4348
- GITLAB_CLIENT_SECRET=gloas-a2c11ed9bd84201d7773f264cad6e86a116355d80c24a68000cebfc92ebe2411 - GITLAB_CLIENT_SECRET=gloas-a2c11ed9bd84201d7773f264cad6e86a116355d80c24a68000cebfc92ebe2411
- GITLAB_REDIRECT_URI=http://localhost:8000/api/vcs/gitlab/auth/callback - GITLAB_REDIRECT_URI=https://backend.codenuk.com/api/vcs/gitlab/auth/callback
- GITLAB_WEBHOOK_SECRET=mywebhooksecret2025 - GITLAB_WEBHOOK_SECRET=mywebhooksecret2025
- GITEA_BASE_URL=https://gitea.com - GITEA_BASE_URL=https://gitea.com
- GITEA_CLIENT_ID=d96d7ff6-8f56-4e58-9dbb-6d692de6504c - GITEA_CLIENT_ID=d96d7ff6-8f56-4e58-9dbb-6d692de6504c
- GITEA_CLIENT_SECRET=gto_m7bn22idy35f4n4fxv7bwi7ky7w4q4mpgmwbtzhl4cinc4dpgmia - GITEA_CLIENT_SECRET=gto_m7bn22idy35f4n4fxv7bwi7ky7w4q4mpgmwbtzhl4cinc4dpgmia
- GITEA_REDIRECT_URI=http://localhost:8000/api/vcs/gitea/auth/callback - GITEA_REDIRECT_URI=https://backend.codenuk.com/api/vcs/gitea/auth/callback
- GITEA_WEBHOOK_SECRET=mywebhooksecret2025 - GITEA_WEBHOOK_SECRET=mywebhooksecret2025
- PUBLIC_BASE_URL=https://a1247f5c9f93.ngrok-free.app - PUBLIC_BASE_URL=https://a1247f5c9f93.ngrok-free.app
- GITHUB_WEBHOOK_SECRET=mywebhooksecret2025 - GITHUB_WEBHOOK_SECRET=mywebhooksecret2025
@ -873,4 +873,3 @@ networks:
# ===================================== # =====================================
# Self-Improving Code Generator # Self-Improving Code Generator
# ===================================== # =====================================

View File

@ -74,7 +74,7 @@ log "✅ Core schema applied"
log "🔧 Step 3: Applying service-specific migrations..." log "🔧 Step 3: Applying service-specific migrations..."
# Define migration order (dependencies first) # Define migration order (dependencies first)
migration_services="user-auth template-manager requirement-processor git-integration ai-mockup-service tech-stack-selector" migration_services="user-auth template-manager git-integration requirement-processor ai-mockup-service tech-stack-selector"
# Track failed services # Track failed services
failed_services="" failed_services=""

View File

@ -72,20 +72,20 @@ global.io = io;
// Service targets configuration // Service targets configuration
const serviceTargets = { const serviceTargets = {
USER_AUTH_URL: process.env.USER_AUTH_URL || 'http://localhost:8011', USER_AUTH_URL: process.env.USER_AUTH_URL || 'https://backend.codenuk.com',
TEMPLATE_MANAGER_URL: process.env.TEMPLATE_MANAGER_URL || 'http://localhost:8009', TEMPLATE_MANAGER_URL: process.env.TEMPLATE_MANAGER_URL || 'https://backend.codenuk.com',
TEMPLATE_MANAGER_AI_URL: process.env.TEMPLATE_MANAGER_AI_URL || 'http://localhost:8013', TEMPLATE_MANAGER_AI_URL: process.env.TEMPLATE_MANAGER_AI_URL || 'https://backend.codenuk.com',
GIT_INTEGRATION_URL: process.env.GIT_INTEGRATION_URL || 'http://localhost:8012', GIT_INTEGRATION_URL: process.env.GIT_INTEGRATION_URL || 'https://backend.codenuk.com',
REQUIREMENT_PROCESSOR_URL: process.env.REQUIREMENT_PROCESSOR_URL || 'http://requirement-processor:8001', REQUIREMENT_PROCESSOR_URL: process.env.REQUIREMENT_PROCESSOR_URL || 'https://backend.codenuk.com',
TECH_STACK_SELECTOR_URL: process.env.TECH_STACK_SELECTOR_URL || 'http://localhost:8002', TECH_STACK_SELECTOR_URL: process.env.TECH_STACK_SELECTOR_URL || 'https://backend.codenuk.com',
ARCHITECTURE_DESIGNER_URL: process.env.ARCHITECTURE_DESIGNER_URL || 'http://localhost:8003', ARCHITECTURE_DESIGNER_URL: process.env.ARCHITECTURE_DESIGNER_URL || 'https://backend.codenuk.com',
CODE_GENERATOR_URL: process.env.CODE_GENERATOR_URL || 'http://localhost:8004', CODE_GENERATOR_URL: process.env.CODE_GENERATOR_URL || 'https://backend.codenuk.com',
TEST_GENERATOR_URL: process.env.TEST_GENERATOR_URL || 'http://localhost:8005', TEST_GENERATOR_URL: process.env.TEST_GENERATOR_URL || 'https://backend.codenuk.com',
DEPLOYMENT_MANAGER_URL: process.env.DEPLOYMENT_MANAGER_URL || 'http://localhost:8006', DEPLOYMENT_MANAGER_URL: process.env.DEPLOYMENT_MANAGER_URL || 'https://backend.codenuk.com',
DASHBOARD_URL: process.env.DASHBOARD_URL || 'http://localhost:8008', DASHBOARD_URL: process.env.DASHBOARD_URL || 'https://backend.codenuk.com',
SELF_IMPROVING_GENERATOR_URL: process.env.SELF_IMPROVING_GENERATOR_URL || 'http://localhost:8007', SELF_IMPROVING_GENERATOR_URL: process.env.SELF_IMPROVING_GENERATOR_URL || 'https://backend.codenuk.com',
AI_MOCKUP_URL: process.env.AI_MOCKUP_URL || 'http://localhost:8021', AI_MOCKUP_URL: process.env.AI_MOCKUP_URL || 'https://backend.codenuk.com',
UNISON_URL: process.env.UNISON_URL || 'http://localhost:8010', UNISON_URL: process.env.UNISON_URL || 'https://backend.codenuk.com',
}; };
// Log service targets for debugging // Log service targets for debugging
@ -1136,7 +1136,7 @@ app.use('/api/github',
// Update redirect URL to use gateway port if it points to git-integration service // Update redirect URL to use gateway port if it points to git-integration service
let updatedLocation = location; let updatedLocation = location;
if (location.includes('localhost:8012')) { if (location.includes('localhost:8012')) {
updatedLocation = location.replace('localhost:8012', 'localhost:8000'); updatedLocation = location.replace('backend.codenuk.com', 'backend.codenuk.com');
console.log(`🔄 [GIT PROXY] Updated redirect URL: ${updatedLocation}`); console.log(`🔄 [GIT PROXY] Updated redirect URL: ${updatedLocation}`);
} }
@ -1257,7 +1257,7 @@ app.use('/api/vcs',
// Update redirect URL to use gateway port if it points to git-integration service // Update redirect URL to use gateway port if it points to git-integration service
let updatedLocation = location; let updatedLocation = location;
if (location.includes('localhost:8012')) { if (location.includes('localhost:8012')) {
updatedLocation = location.replace('localhost:8012', 'localhost:8000'); updatedLocation = location.replace('backend.codenuk.com', 'backend.codenuk.com');
console.log(`🔄 [VCS PROXY] Updated redirect URL: ${updatedLocation}`); console.log(`🔄 [VCS PROXY] Updated redirect URL: ${updatedLocation}`);
} }
@ -1539,9 +1539,9 @@ const startServer = async () => {
server.listen(PORT, '0.0.0.0', () => { server.listen(PORT, '0.0.0.0', () => {
console.log(`✅ API Gateway running on port ${PORT}`); console.log(`✅ API Gateway running on port ${PORT}`);
console.log(`🌍 Environment: ${process.env.NODE_ENV || 'development'}`); console.log(`🌍 Environment: ${process.env.NODE_ENV || 'development'}`);
console.log(`📋 Health check: http://localhost:${PORT}/health`); console.log(`📋 Health check: https://backend.codenuk.com/health`);
console.log(`📖 Gateway info: http://localhost:${PORT}/api/gateway/info`); console.log(`📖 Gateway info: https://backend.codenuk.com/api/gateway/info`);
console.log(`🔗 WebSocket enabled on: ws://localhost:${PORT}`); console.log(`🔗 WebSocket enabled on: wss://backend.codenuk.com`);
// Log service configuration // Log service configuration
console.log('⚙️ Configured Services:'); console.log('⚙️ Configured Services:');

View File

@ -4,7 +4,7 @@ const helmet = require('helmet');
const session = require('express-session'); const session = require('express-session');
const morgan = require('morgan'); const morgan = require('morgan');
// Import database // Import database (uses environment variables from docker-compose.yml)
const database = require('./config/database'); const database = require('./config/database');
// Import services // Import services
@ -150,11 +150,11 @@ async function initializeServices() {
// Start server // Start server
app.listen(PORT, '0.0.0.0', async () => { app.listen(PORT, '0.0.0.0', async () => {
console.log(`🚀 Git Integration Service running on port ${PORT}`); console.log(`🚀 Git Integration Service running on port ${PORT}`);
console.log(`📊 Health check: http://localhost:${PORT}/health`); console.log(`📊 Health check: https://backend.codenuk.com/health`);
console.log(`🔗 GitHub API: http://localhost:${PORT}/api/github`); console.log(`🔗 GitHub API: https://backend.codenuk.com/api/github`);
console.log(`📝 Commits API: http://localhost:${PORT}/api/commits`); console.log(`📝 Commits API: https://backend.codenuk.com/api/commits`);
console.log(`🔐 OAuth API: http://localhost:${PORT}/api/oauth`); console.log(`🔐 OAuth API: https://backend.codenuk.com/api/oauth`);
console.log(`🪝 Enhanced Webhooks: http://localhost:${PORT}/api/webhooks`); console.log(`🪝 Enhanced Webhooks: https://backend.codenuk.com/api/webhooks`);
// Initialize services after server starts // Initialize services after server starts
await initializeServices(); await initializeServices();

View File

@ -4,19 +4,13 @@ class Database {
constructor() { constructor() {
this.pool = new Pool({ this.pool = new Pool({
host: process.env.POSTGRES_HOST || 'localhost', host: process.env.POSTGRES_HOST || 'localhost',
port: process.env.POSTGRES_PORT || 5432, port: process.env.POSTGRES_PORT || 5432,
database: process.env.POSTGRES_DB || 'dev_pipeline', database: process.env.POSTGRES_DB || 'dev_pipeline',
user: process.env.POSTGRES_USER || 'pipeline_admin', user: process.env.POSTGRES_USER || 'pipeline_admin',
password: process.env.POSTGRES_PASSWORD || 'secure_pipeline_2024', password: process.env.POSTGRES_PASSWORD || 'secure_pipeline_2024',
max: 20, max: 20,
idleTimeoutMillis: 30000, idleTimeoutMillis: 30000,
connectionTimeoutMillis: 2000, connectionTimeoutMillis: 10000,
});
// Handle pool errors
this.pool.on('error', (err) => {
console.error('❌ Database pool error:', err.message);
// Don't crash the process, just log the error
}); });
// Test connection on startup // Test connection on startup
@ -26,12 +20,12 @@ class Database {
async testConnection() { async testConnection() {
try { try {
const client = await this.pool.connect(); const client = await this.pool.connect();
console.log('✅ Database connected successfully'); console.log('✅ Git Integration Database connected successfully');
client.release(); client.release();
} catch (err) { } catch (err) {
console.error('❌ Database connection failed:', err.message); console.error('❌ Git Integration Database connection failed:', err.message);
console.log('⚠️ Continuing without database connection...');
// Don't exit the process, just log the error // Don't exit the process, just log the error
// The service can still start and retry connections later
} }
} }
@ -40,12 +34,30 @@ class Database {
try { try {
const res = await this.pool.query(text, params); const res = await this.pool.query(text, params);
const duration = Date.now() - start; const duration = Date.now() - start;
console.log('📊 Query executed:', { text: text.substring(0, 50), duration, rows: res.rowCount }); console.log('📊 Git Integration Query executed:', {
text: text.substring(0, 50) + '...',
duration,
rows: res.rowCount
});
return res; return res;
} catch (err) { } catch (err) {
console.error('❌ Query error:', err.message); console.error('❌ Git Integration Query error:', err.message);
// Return empty result instead of throwing error throw err;
return { rows: [], rowCount: 0 }; }
}
async transaction(callback) {
const client = await this.pool.connect();
try {
await client.query('BEGIN');
const result = await callback(client);
await client.query('COMMIT');
return result;
} catch (error) {
await client.query('ROLLBACK');
throw error;
} finally {
client.release();
} }
} }
@ -55,7 +67,7 @@ class Database {
async close() { async close() {
await this.pool.end(); await this.pool.end();
console.log('🔌 Database connection closed'); console.log('🔌 Git Integration Database connection closed');
} }
} }

View File

@ -25,8 +25,7 @@ CREATE TABLE IF NOT EXISTS all_repositories (
CREATE INDEX IF NOT EXISTS idx_github_repos_template_id ON all_repositories(template_id); CREATE INDEX IF NOT EXISTS idx_github_repos_template_id ON all_repositories(template_id);
CREATE INDEX IF NOT EXISTS idx_github_repos_owner_name ON all_repositories(owner_name); CREATE INDEX IF NOT EXISTS idx_github_repos_owner_name ON all_repositories(owner_name);
CREATE INDEX IF NOT EXISTS idx_all_repos_provider_name ON all_repositories(provider_name); CREATE INDEX IF NOT EXISTS idx_all_repos_provider_name ON all_repositories(provider_name);
CREATE INDEX IF NOT EXISTS idx_feature_mappings_feature_id ON feature_codebase_mappings(feature_id); -- Note: feature_codebase_mappings table indexes will be created when that table is added
CREATE INDEX IF NOT EXISTS idx_feature_mappings_repo_id ON feature_codebase_mappings(repository_id);
-- Add trigger to update timestamp -- Add trigger to update timestamp
CREATE TRIGGER update_github_repos_updated_at BEFORE UPDATE ON all_repositories CREATE TRIGGER update_github_repos_updated_at BEFORE UPDATE ON all_repositories

View File

@ -9,13 +9,13 @@ ALTER TABLE IF EXISTS all_repositories
CREATE INDEX IF NOT EXISTS idx_github_repos_user_id ON all_repositories(user_id); CREATE INDEX IF NOT EXISTS idx_github_repos_user_id ON all_repositories(user_id);
CREATE INDEX IF NOT EXISTS idx_github_repos_template_user ON all_repositories(template_id, user_id); CREATE INDEX IF NOT EXISTS idx_github_repos_template_user ON all_repositories(template_id, user_id);
-- Add user_id to feature_codebase_mappings -- Add user_id to feature_codebase_mappings (commented out - table doesn't exist yet)
ALTER TABLE IF EXISTS feature_codebase_mappings -- ALTER TABLE IF EXISTS feature_codebase_mappings
ADD COLUMN IF NOT EXISTS user_id UUID REFERENCES users(id) ON DELETE CASCADE; -- ADD COLUMN IF NOT EXISTS user_id UUID REFERENCES users(id) ON DELETE CASCADE;
-- Indexes for feature_codebase_mappings -- Indexes for feature_codebase_mappings (commented out - table doesn't exist yet)
CREATE INDEX IF NOT EXISTS idx_feature_mappings_user_id ON feature_codebase_mappings(user_id); -- CREATE INDEX IF NOT EXISTS idx_feature_mappings_user_id ON feature_codebase_mappings(user_id);
CREATE INDEX IF NOT EXISTS idx_feature_mappings_template_user ON feature_codebase_mappings(template_id, user_id); -- CREATE INDEX IF NOT EXISTS idx_feature_mappings_template_user ON feature_codebase_mappings(template_id, user_id);
-- Note: Columns are nullable to allow backfill before enforcing NOT NULL if desired -- Note: Columns are nullable to allow backfill before enforcing NOT NULL if desired

View File

@ -10,9 +10,9 @@ DROP INDEX IF EXISTS idx_feature_mappings_template_user;
ALTER TABLE IF EXISTS all_repositories ALTER TABLE IF EXISTS all_repositories
DROP COLUMN IF EXISTS template_id; DROP COLUMN IF EXISTS template_id;
-- Remove template_id column from feature_codebase_mappings table -- Remove template_id column from feature_codebase_mappings table (commented out - table doesn't exist yet)
ALTER TABLE IF EXISTS feature_codebase_mappings -- ALTER TABLE IF EXISTS feature_codebase_mappings
DROP COLUMN IF EXISTS template_id; -- DROP COLUMN IF EXISTS template_id;
-- Note: This migration removes the template_id foreign key relationships -- Note: This migration removes the template_id foreign key relationships
-- The tables will now rely on user_id for ownership tracking -- The tables will now rely on user_id for ownership tracking

View File

@ -6,24 +6,25 @@
-- ============================================= -- =============================================
-- Create table for GitHub repositories (enhanced version from provided migration) -- Create table for GitHub repositories (enhanced version from provided migration)
CREATE TABLE IF NOT EXISTS all_repositories ( -- Note: Table already exists from migration 001, skipping recreation
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), -- CREATE TABLE IF NOT EXISTS all_repositories (
template_id UUID, -- References templates(id) but table may not exist -- id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
repository_url VARCHAR(500) NOT NULL, -- template_id UUID, -- References templates(id) but table may not exist
repository_name VARCHAR(200) NOT NULL, -- repository_url VARCHAR(500) NOT NULL,
owner_name VARCHAR(100) NOT NULL, -- repository_name VARCHAR(200) NOT NULL,
provider_name VARCHAR(50) DEFAULT 'github' NOT NULL, -- owner_name VARCHAR(100) NOT NULL,
branch_name VARCHAR(100) DEFAULT 'main', -- provider_name VARCHAR(50) DEFAULT 'github' NOT NULL,
is_public BOOLEAN DEFAULT true, -- branch_name VARCHAR(100) DEFAULT 'main',
requires_auth BOOLEAN DEFAULT false, -- is_public BOOLEAN DEFAULT true,
last_synced_at TIMESTAMP, -- requires_auth BOOLEAN DEFAULT false,
sync_status VARCHAR(50) DEFAULT 'pending', -- last_synced_at TIMESTAMP,
metadata JSONB, -- sync_status VARCHAR(50) DEFAULT 'pending',
codebase_analysis JSONB, -- metadata JSONB,
last_synced_commit_sha VARCHAR(64), -- codebase_analysis JSONB,
created_at TIMESTAMP DEFAULT NOW(), -- last_synced_commit_sha VARCHAR(64),
updated_at TIMESTAMP DEFAULT NOW() -- created_at TIMESTAMP DEFAULT NOW(),
); -- updated_at TIMESTAMP DEFAULT NOW()
-- );
-- ============================================= -- =============================================
-- Repository File Storage Tables -- Repository File Storage Tables
@ -329,8 +330,8 @@ CREATE TABLE IF NOT EXISTS diff_statistics (
-- Indexes for Performance -- Indexes for Performance
-- ============================================= -- =============================================
-- GitHub repositories indexes -- GitHub repositories indexes (commented out - template_id column was removed)
CREATE INDEX IF NOT EXISTS idx_github_repos_template_id ON all_repositories(template_id); -- CREATE INDEX IF NOT EXISTS idx_github_repos_template_id ON all_repositories(template_id);
CREATE INDEX IF NOT EXISTS idx_github_repos_owner_name ON all_repositories(owner_name); CREATE INDEX IF NOT EXISTS idx_github_repos_owner_name ON all_repositories(owner_name);
CREATE INDEX IF NOT EXISTS idx_all_repos_provider_name ON all_repositories(provider_name); CREATE INDEX IF NOT EXISTS idx_all_repos_provider_name ON all_repositories(provider_name);

View File

@ -199,4 +199,8 @@ BEGIN
END IF; END IF;
END $$; END $$;
RAISE NOTICE '🎉 Migration 021 completed - Schema conflicts resolved'; -- Final completion notice
DO $$
BEGIN
RAISE NOTICE '🎉 Migration 021 completed - Schema conflicts resolved';
END $$;

View File

@ -12,14 +12,27 @@ async function runMigrations() {
await database.testConnection(); await database.testConnection();
console.log('✅ Database connected successfully'); console.log('✅ Database connected successfully');
// Get list of migration files // Get list of migration files (skip the tracking system as it's handled by main migration)
const migrationFiles = fs.readdirSync(migrationsDir) const migrationFiles = fs.readdirSync(migrationsDir)
.filter(file => file.endsWith('.sql')) .filter(file => file.endsWith('.sql') && file !== '000_migration_tracking_system.sql')
.sort(); .sort();
console.log(`📄 Found ${migrationFiles.length} migration files:`, migrationFiles); console.log(`📄 Found ${migrationFiles.length} migration files:`, migrationFiles);
for (const migrationFile of migrationFiles) { for (const migrationFile of migrationFiles) {
const migrationVersion = migrationFile.replace('.sql', '');
// Check if migration already applied
const existingMigration = await database.query(
'SELECT version FROM schema_migrations WHERE version = $1 AND service = $2',
[migrationVersion, 'git-integration']
);
if (existingMigration.rows.length > 0) {
console.log(`⏭️ Skipping already applied migration: ${migrationFile}`);
continue;
}
console.log(`🚀 Running migration: ${migrationFile}`); console.log(`🚀 Running migration: ${migrationFile}`);
const migrationPath = path.join(migrationsDir, migrationFile); const migrationPath = path.join(migrationsDir, migrationFile);
@ -27,6 +40,13 @@ async function runMigrations() {
try { try {
await database.query(migrationSQL); await database.query(migrationSQL);
// Record migration in main schema_migrations table
await database.query(
'INSERT INTO schema_migrations (version, service, description) VALUES ($1, $2, $3) ON CONFLICT (version) DO NOTHING',
[migrationFile.replace('.sql', ''), 'git-integration', `Git integration migration: ${migrationFile}`]
);
console.log(`✅ Migration ${migrationFile} completed successfully!`); console.log(`✅ Migration ${migrationFile} completed successfully!`);
} catch (err) { } catch (err) {
const message = (err && err.message) ? err.message.toLowerCase() : ''; const message = (err && err.message) ? err.message.toLowerCase() : '';

View File

@ -32,7 +32,7 @@ const generateAuthResponse = (res, repository_url, branch_name, userId) => {
const rawAuthUrl = oauthService.getAuthUrl(state, userIdForAuth); const rawAuthUrl = oauthService.getAuthUrl(state, userIdForAuth);
console.log('🔧 [generateAuthResponse] Generated raw auth URL:', rawAuthUrl); console.log('🔧 [generateAuthResponse] Generated raw auth URL:', rawAuthUrl);
const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'http://localhost:8000'; const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'https://backend.codenuk.com';
const serviceRelative = '/api/github/auth/github'; const serviceRelative = '/api/github/auth/github';
const serviceAuthUrl = `${gatewayBase}${serviceRelative}?redirect=1&state=${encodeURIComponent(state)}${userIdForAuth ? `&user_id=${encodeURIComponent(userIdForAuth)}` : ''}`; const serviceAuthUrl = `${gatewayBase}${serviceRelative}?redirect=1&state=${encodeURIComponent(state)}${userIdForAuth ? `&user_id=${encodeURIComponent(userIdForAuth)}` : ''}`;
@ -153,7 +153,7 @@ router.post('/attach-repository', async (req, res) => {
const rawAuthUrl = oauthService.getAuthUrl(state, userIdForAuth); const rawAuthUrl = oauthService.getAuthUrl(state, userIdForAuth);
console.log('🔧 [INLINE AUTH] Generated raw auth URL:', rawAuthUrl); console.log('🔧 [INLINE AUTH] Generated raw auth URL:', rawAuthUrl);
const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'http://localhost:8000'; const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'https://backend.codenuk.com';
const serviceRelative = '/api/github/auth/github'; const serviceRelative = '/api/github/auth/github';
const serviceAuthUrl = `${gatewayBase}${serviceRelative}?redirect=1&state=${encodeURIComponent(state)}${userIdForAuth ? `&user_id=${encodeURIComponent(userIdForAuth)}` : ''}`; const serviceAuthUrl = `${gatewayBase}${serviceRelative}?redirect=1&state=${encodeURIComponent(state)}${userIdForAuth ? `&user_id=${encodeURIComponent(userIdForAuth)}` : ''}`;
@ -207,7 +207,7 @@ router.post('/attach-repository', async (req, res) => {
const state = `${stateBase}|uid=${userIdForAuth || ''}|repo=${encodedRepoUrl}|branch=${encodedBranchName}`; const state = `${stateBase}|uid=${userIdForAuth || ''}|repo=${encodedRepoUrl}|branch=${encodedBranchName}`;
const rawAuthUrl = oauthService.getAuthUrl(state, userIdForAuth); const rawAuthUrl = oauthService.getAuthUrl(state, userIdForAuth);
const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'http://localhost:8000'; const gatewayBase = process.env.API_GATEWAY_PUBLIC_URL || 'https://backend.codenuk.com';
const serviceRelative = '/api/github/auth/github'; const serviceRelative = '/api/github/auth/github';
const serviceAuthUrl = `${gatewayBase}${serviceRelative}?redirect=1&state=${encodeURIComponent(state)}${userIdForAuth ? `&user_id=${encodeURIComponent(userIdForAuth)}` : ''}`; const serviceAuthUrl = `${gatewayBase}${serviceRelative}?redirect=1&state=${encodeURIComponent(state)}${userIdForAuth ? `&user_id=${encodeURIComponent(userIdForAuth)}` : ''}`;

View File

@ -116,7 +116,7 @@ router.get('/auth/github/callback', async (req, res) => {
// Attempt analysis and sync with fallback // Attempt analysis and sync with fallback
const codebaseAnalysis = await githubService.analyzeCodebase(owner, repo, actualBranch, false); const codebaseAnalysis = await githubService.analyzeCodebase(owner, repo, actualBranch, false);
const insertQuery = ` const insertQuery = `
INSERT INTO github_repositories ( INSERT INTO all_repositories (
repository_url, repository_name, owner_name, repository_url, repository_name, owner_name,
branch_name, is_public, metadata, codebase_analysis, sync_status, branch_name, is_public, metadata, codebase_analysis, sync_status,
requires_auth, user_id requires_auth, user_id
@ -140,7 +140,7 @@ router.get('/auth/github/callback', async (req, res) => {
// Try to sync // Try to sync
const downloadResult = await githubService.syncRepositoryWithFallback(owner, repo, actualBranch, repositoryRecord.id, repositoryData.visibility !== 'private'); const downloadResult = await githubService.syncRepositoryWithFallback(owner, repo, actualBranch, repositoryRecord.id, repositoryData.visibility !== 'private');
const finalSyncStatus = downloadResult.success ? 'synced' : 'error'; const finalSyncStatus = downloadResult.success ? 'synced' : 'error';
await database.query('UPDATE github_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2', [finalSyncStatus, repositoryRecord.id]); await database.query('UPDATE all_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2', [finalSyncStatus, repositoryRecord.id]);
autoAttach = { repository_id: repositoryRecord.id, sync_status: finalSyncStatus }; autoAttach = { repository_id: repositoryRecord.id, sync_status: finalSyncStatus };
} }
} }
@ -149,7 +149,7 @@ router.get('/auth/github/callback', async (req, res) => {
} }
// Redirect back to frontend if configured // Redirect back to frontend if configured
const frontendUrl = process.env.FRONTEND_URL || 'http://localhost:3000'; const frontendUrl = process.env.FRONTEND_URL || 'https://dashboard.codenuk.com';
try { try {
const redirectUrl = `${frontendUrl}/project-builder?github_connected=1&user=${encodeURIComponent(githubUser.login)}${autoAttach ? `&repo_attached=1&repository_id=${encodeURIComponent(autoAttach.repository_id)}&sync_status=${encodeURIComponent(autoAttach.sync_status)}` : ''}`; const redirectUrl = `${frontendUrl}/project-builder?github_connected=1&user=${encodeURIComponent(githubUser.login)}${autoAttach ? `&repo_attached=1&repository_id=${encodeURIComponent(autoAttach.repository_id)}&sync_status=${encodeURIComponent(autoAttach.sync_status)}` : ''}`;
return res.redirect(302, redirectUrl); return res.redirect(302, redirectUrl);

View File

@ -5,7 +5,7 @@ class BitbucketOAuthService {
constructor() { constructor() {
this.clientId = process.env.BITBUCKET_CLIENT_ID; this.clientId = process.env.BITBUCKET_CLIENT_ID;
this.clientSecret = process.env.BITBUCKET_CLIENT_SECRET; this.clientSecret = process.env.BITBUCKET_CLIENT_SECRET;
this.redirectUri = process.env.BITBUCKET_REDIRECT_URI || 'http://localhost:8012/api/vcs/bitbucket/auth/callback'; this.redirectUri = process.env.BITBUCKET_REDIRECT_URI || 'https://backend.codenuk.com/api/vcs/bitbucket/auth/callback';
} }
getAuthUrl(state) { getAuthUrl(state) {

View File

@ -323,7 +323,7 @@ class EnhancedWebhookService {
} }
const query = ` const query = `
SELECT id FROM github_repositories SELECT id FROM all_repositories
WHERE owner_name = $1 AND repository_name = $2 WHERE owner_name = $1 AND repository_name = $2
LIMIT 1 LIMIT 1
`; `;
@ -361,7 +361,7 @@ class EnhancedWebhookService {
if (afterSha) { if (afterSha) {
const query = ` const query = `
UPDATE github_repositories UPDATE all_repositories
SET last_synced_at = NOW(), SET last_synced_at = NOW(),
last_synced_commit_sha = $2, last_synced_commit_sha = $2,
sync_status = 'completed' sync_status = 'completed'

View File

@ -8,7 +8,7 @@ class GiteaOAuthService {
this.clientId = process.env.GITEA_CLIENT_ID; this.clientId = process.env.GITEA_CLIENT_ID;
this.clientSecret = process.env.GITEA_CLIENT_SECRET; this.clientSecret = process.env.GITEA_CLIENT_SECRET;
this.baseUrl = (process.env.GITEA_BASE_URL || 'https://gitea.com').replace(/\/$/, ''); this.baseUrl = (process.env.GITEA_BASE_URL || 'https://gitea.com').replace(/\/$/, '');
this.redirectUri = process.env.GITEA_REDIRECT_URI || 'http://localhost:8012/api/vcs/gitea/auth/callback'; this.redirectUri = process.env.GITEA_REDIRECT_URI || 'https://backend.codenuk.com/api/vcs/gitea/auth/callback';
} }
getAuthUrl(state) { getAuthUrl(state) {

View File

@ -566,7 +566,7 @@ class GitHubIntegrationService {
// Persist last synced commit // Persist last synced commit
try { try {
await database.query( await database.query(
'UPDATE github_repositories SET last_synced_commit_sha = $1, last_synced_at = NOW(), updated_at = NOW() WHERE id = $2', 'UPDATE all_repositories SET last_synced_commit_sha = $1, last_synced_at = NOW(), updated_at = NOW() WHERE id = $2',
[afterSha || beforeSha || null, repositoryId] [afterSha || beforeSha || null, repositoryId]
); );
} catch (_) {} } catch (_) {}

View File

@ -6,7 +6,7 @@ class GitHubOAuthService {
constructor() { constructor() {
this.clientId = process.env.GITHUB_CLIENT_ID; this.clientId = process.env.GITHUB_CLIENT_ID;
this.clientSecret = process.env.GITHUB_CLIENT_SECRET; this.clientSecret = process.env.GITHUB_CLIENT_SECRET;
this.redirectUri = process.env.GITHUB_REDIRECT_URI || 'http://localhost:8000/api/github/auth/github/callback'; this.redirectUri = process.env.GITHUB_REDIRECT_URI || 'https://backend.codenuk.com/api/github/auth/github/callback';
if (!this.clientId || !this.clientSecret) { if (!this.clientId || !this.clientSecret) {
console.warn('GitHub OAuth not configured. Only public repositories will be accessible.'); console.warn('GitHub OAuth not configured. Only public repositories will be accessible.');
@ -82,7 +82,7 @@ class GitHubOAuthService {
const query = ` const query = `
INSERT INTO github_user_tokens (access_token, github_username, github_user_id, scopes, expires_at, user_id, is_primary) INSERT INTO github_user_tokens (access_token, github_username, github_user_id, scopes, expires_at, user_id, is_primary)
VALUES ($1, $2, $3, $4, $5, $6, $7) VALUES ($1, $2, $3, $4, $5, $6, $7)
ON CONFLICT (user_id, github_username) ON CONFLICT (user_id, github_username) WHERE user_id IS NOT NULL
DO UPDATE SET DO UPDATE SET
access_token = $1, access_token = $1,
github_user_id = $3, github_user_id = $3,

View File

@ -74,7 +74,7 @@ class WebhookService {
// Find repository_id in our DB if attached // Find repository_id in our DB if attached
const repoLookup = await database.query( const repoLookup = await database.query(
'SELECT id FROM github_repositories WHERE owner_name = $1 AND repository_name = $2 ORDER BY created_at DESC LIMIT 1', 'SELECT id FROM all_repositories WHERE owner_name = $1 AND repository_name = $2 ORDER BY created_at DESC LIMIT 1',
[repoOwner, repoName] [repoOwner, repoName]
); );
const repoId = repoLookup.rows[0]?.id || null; const repoId = repoLookup.rows[0]?.id || null;
@ -150,7 +150,7 @@ class WebhookService {
try { try {
// Mark syncing // Mark syncing
await database.query( await database.query(
'UPDATE github_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2', 'UPDATE all_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2',
['syncing', repoId] ['syncing', repoId]
); );
@ -169,14 +169,14 @@ class WebhookService {
} }
await database.query( await database.query(
'UPDATE github_repositories SET sync_status = $1, last_synced_at = NOW(), updated_at = NOW() WHERE id = $2', 'UPDATE all_repositories SET sync_status = $1, last_synced_at = NOW(), updated_at = NOW() WHERE id = $2',
[downloadResult.success ? 'synced' : 'error', repoId] [downloadResult.success ? 'synced' : 'error', repoId]
); );
} catch (syncErr) { } catch (syncErr) {
console.warn('Auto-sync failed:', syncErr.message); console.warn('Auto-sync failed:', syncErr.message);
try { try {
await database.query( await database.query(
'UPDATE github_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2', 'UPDATE all_repositories SET sync_status = $1, updated_at = NOW() WHERE id = $2',
['error', repoId] ['error', repoId]
); );
} catch (_) {} } catch (_) {}
@ -190,7 +190,7 @@ class WebhookService {
// Find repositories in our database that match this GitHub repository // Find repositories in our database that match this GitHub repository
const query = ` const query = `
SELECT gr.*, rs.storage_status, rs.local_path SELECT gr.*, rs.storage_status, rs.local_path
FROM github_repositories gr FROM all_repositories gr
LEFT JOIN repository_storage rs ON gr.id = rs.repository_id LEFT JOIN repository_storage rs ON gr.id = rs.repository_id
WHERE gr.owner_name = $1 AND gr.repository_name = $2 WHERE gr.owner_name = $1 AND gr.repository_name = $2
`; `;
@ -203,7 +203,7 @@ class WebhookService {
// Update last synced timestamp // Update last synced timestamp
for (const repo of result.rows) { for (const repo of result.rows) {
await database.query( await database.query(
'UPDATE github_repositories SET last_synced_at = NOW(), updated_at = NOW() WHERE id = $1', 'UPDATE all_repositories SET last_synced_at = NOW(), updated_at = NOW() WHERE id = $1',
[repo.id] [repo.id]
); );

View File

@ -5,7 +5,7 @@
- **Version**: 1.0.0 - **Version**: 1.0.0
- **Port**: 8014 (external) → 8010 (internal) - **Port**: 8014 (external) → 8010 (internal)
- **Status**: ✅ OPERATIONAL - **Status**: ✅ OPERATIONAL
- **Base URL**: `http://localhost:8014` - **Base URL**: `https://backend.codenuk.com`
## 🔗 Complete Endpoint Inventory ## 🔗 Complete Endpoint Inventory
@ -153,7 +153,7 @@
### Unified Recommendation Request ### Unified Recommendation Request
```bash ```bash
curl -X POST http://localhost:8014/api/recommendations/unified \ curl -X POST https://backend.codenuk.com/api/recommendations/unified \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{ -d '{
"domain": "e-commerce", "domain": "e-commerce",
@ -164,12 +164,12 @@ curl -X POST http://localhost:8014/api/recommendations/unified \
### Health Check Request ### Health Check Request
```bash ```bash
curl http://localhost:8014/health curl https://backend.codenuk.com/health
``` ```
### Tech Stack Only Request ### Tech Stack Only Request
```bash ```bash
curl "http://localhost:8014/api/recommendations/tech-stack?domain=web%20development&budget=500" curl "https://backend.codenuk.com/api/recommendations/tech-stack?domain=web%20development&budget=500"
``` ```
## ✅ Summary ## ✅ Summary

View File

@ -113,7 +113,7 @@ The service uses a `config.env` file for environment variables. This file is alr
### Base URL ### Base URL
``` ```
http://localhost:8010 https://backend.codenuk.com
``` ```
### Endpoints ### Endpoints
@ -198,7 +198,7 @@ Service information and available endpoints.
### Basic Unified Recommendation ### Basic Unified Recommendation
```bash ```bash
curl -X POST http://localhost:8010/api/recommendations/unified \ curl -X POST https://backend.codenuk.com/api/recommendations/unified \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{ -d '{
"domain": "e-commerce", "domain": "e-commerce",
@ -210,7 +210,7 @@ curl -X POST http://localhost:8010/api/recommendations/unified \
### With Template ID ### With Template ID
```bash ```bash
curl -X POST http://localhost:8010/api/recommendations/unified \ curl -X POST https://backend.codenuk.com/api/recommendations/unified \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{ -d '{
"domain": "startup", "domain": "startup",
@ -224,25 +224,25 @@ curl -X POST http://localhost:8010/api/recommendations/unified \
### Tech Stack Only ### Tech Stack Only
```bash ```bash
curl "http://localhost:8010/api/recommendations/tech-stack?domain=web%20development&budget=500" curl "https://backend.codenuk.com/api/recommendations/tech-stack?domain=web%20development&budget=500"
``` ```
### Template Only ### Template Only
```bash ```bash
curl "http://localhost:8010/api/recommendations/template/123e4567-e89b-12d3-a456-426614174000?force_refresh=true" curl "https://backend.codenuk.com/api/recommendations/template/123e4567-e89b-12d3-a456-426614174000?force_refresh=true"
``` ```
## 🏥 Health Monitoring ## 🏥 Health Monitoring
### Health Check ### Health Check
```bash ```bash
curl http://localhost:8010/health curl https://backend.codenuk.com/health
``` ```
### Detailed Health Check ### Detailed Health Check
```bash ```bash
curl http://localhost:8010/health/detailed curl https://backend.codenuk.com/health/detailed
``` ```
## 📊 Response Schema ## 📊 Response Schema

View File

@ -8,7 +8,7 @@
"variable": [ "variable": [
{ {
"key": "baseUrl", "key": "baseUrl",
"value": "http://localhost:8010", "value": "https://backend.codenuk.com",
"type": "string", "type": "string",
"description": "Base URL for Unison service" "description": "Base URL for Unison service"
}, },

View File

@ -97,7 +97,7 @@ docker-compose logs user-auth
### 2. Test Registration ### 2. Test Registration
1. Visit `http://localhost:3001/signup` 1. Visit `https://dashboard.codenuk.com/signup`
2. Register a new user 2. Register a new user
3. Check logs for email status 3. Check logs for email status

View File

@ -16,8 +16,8 @@ GMAIL_APP_PASSWORD=your-app-password
# Service Configuration # Service Configuration
PORT=8011 PORT=8011
NODE_ENV=development NODE_ENV=development
FRONTEND_URL=http://localhost:3000 FRONTEND_URL=https://dashboard.codenuk.com
AUTH_PUBLIC_URL=http://localhost:8011 AUTH_PUBLIC_URL=https://backend.codenuk.com
# Database Configuration # Database Configuration
POSTGRES_HOST=postgres POSTGRES_HOST=postgres

View File

@ -96,7 +96,7 @@ app.get('/', (req, res) => {
message: 'User Authentication Service - JWT-based auth with feature preferences', message: 'User Authentication Service - JWT-based auth with feature preferences',
version: '1.0.0', version: '1.0.0',
documentation: { documentation: {
base_url: `http://localhost:${PORT}`, base_url: `https://backend.codenuk.com`,
endpoints: { endpoints: {
health: '/health', health: '/health',
auth: '/api/auth', auth: '/api/auth',

View File

@ -2,7 +2,7 @@ const axios = require('axios');
class ServiceClient { class ServiceClient {
constructor() { constructor() {
this.templateManagerUrl = process.env.TEMPLATE_MANAGER_URL || 'http://localhost:8009'; this.templateManagerUrl = process.env.TEMPLATE_MANAGER_URL || 'https://backend.codenuk.com';
} }
async getCustomFeatures(status, limit = 50, offset = 0, authToken) { async getCustomFeatures(status, limit = 50, offset = 0, authToken) {

View File

@ -9,7 +9,7 @@ In the project directory, you can run:
### `npm start` ### `npm start`
Runs the app in the development mode.\ Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. Open [https://dashboard.codenuk.com](https://dashboard.codenuk.com) to view it in the browser.
The page will reload if you make edits.\ The page will reload if you make edits.\
You will also see any lint errors in the console. You will also see any lint errors in the console.

View File

@ -30,7 +30,7 @@ export default function ArchitectureDesigner() {
console.log('🏗️ Generating architecture with data:', techStackRecommendations); console.log('🏗️ Generating architecture with data:', techStackRecommendations);
const response = await fetch('http://localhost:8003/api/v1/design-architecture', { const response = await fetch('https://backend.codenuk.com/api/v1/design-architecture', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@ -26,7 +26,7 @@
// return; // return;
// } // }
// const response = await fetch('http://localhost:8001/api/v1/generate-business-questions', { // const response = await fetch('https://backend.codenuk.com/api/v1/generate-business-questions', {
// method: 'POST', // method: 'POST',
// headers: { // headers: {
// 'Content-Type': 'application/json', // 'Content-Type': 'application/json',
@ -102,7 +102,7 @@
// console.log('🚀 Calling tech stack selector with:', completeData); // console.log('🚀 Calling tech stack selector with:', completeData);
// const response = await fetch('http://localhost:8002/api/v1/select', { // const response = await fetch('https://backend.codenuk.com/api/v1/select', {
// method: 'POST', // method: 'POST',
// headers: { // headers: {
// 'Content-Type': 'application/json', // 'Content-Type': 'application/json',
@ -279,7 +279,7 @@ export default function BusinessQuestionsScreen() {
console.log('🚀 Sending feature data for business questions:', aiFeature); console.log('🚀 Sending feature data for business questions:', aiFeature);
// Call requirement processor to generate business questions // Call requirement processor to generate business questions
const response = await fetch('http://localhost:8001/api/v1/generate-business-questions', { const response = await fetch('https://backend.codenuk.com/api/v1/generate-business-questions', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -361,7 +361,7 @@ export default function BusinessQuestionsScreen() {
console.log('🚀 Sending complete data to tech stack selector:', completeData); console.log('🚀 Sending complete data to tech stack selector:', completeData);
// Call enhanced tech stack selector directly // Call enhanced tech stack selector directly
const response = await fetch('http://localhost:8002/api/v1/select', { const response = await fetch('https://backend.codenuk.com/api/v1/select', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@ -34,7 +34,7 @@ export default function ArchitectureDesigner() {
console.log('🏗️ Generating architecture with data:', techStackRecommendations); console.log('🏗️ Generating architecture with data:', techStackRecommendations);
const response = await fetch('http://localhost:8003/api/v1/design-architecture', { const response = await fetch('https://backend.codenuk.com/api/v1/design-architecture', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@ -121,7 +121,7 @@ export default function BusinessQuestionsScreen() {
console.log('🚀 Sending comprehensive system data to tech stack selector:', completeData); console.log('🚀 Sending comprehensive system data to tech stack selector:', completeData);
// Call enhanced tech stack selector directly // Call enhanced tech stack selector directly
const response = await fetch('http://localhost:8002/api/v1/select', { const response = await fetch('https://backend.codenuk.com/api/v1/select', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@ -72,7 +72,7 @@ export default function CodeGenerationFlow() {
try { try {
// First, send project data to code-generator for session storage // First, send project data to code-generator for session storage
const setupResponse = await fetch('http://localhost:8004/api/v1/setup-generation', { const setupResponse = await fetch('https://backend.codenuk.com/api/v1/setup-generation', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({
@ -90,7 +90,7 @@ export default function CodeGenerationFlow() {
// Start Server-Sent Events stream // Start Server-Sent Events stream
const eventSource = new EventSource( const eventSource = new EventSource(
`http://localhost:8004/api/v1/generate-stream/${architectureData.project_metadata.project_id}` `https://backend.codenuk.com/api/v1/generate-stream/${architectureData.project_metadata.project_id}`
); );
eventSource.onmessage = (event) => { eventSource.onmessage = (event) => {

View File

@ -2,7 +2,7 @@
// // Configure API client for requirement processor // // Configure API client for requirement processor
// const apiClient = axios.create({ // const apiClient = axios.create({
// baseURL: 'http://localhost:8001', // Direct to requirement processor // baseURL: 'https://backend.codenuk.com', // Direct to requirement processor
// timeout: 30000, // timeout: 30000,
// headers: { // headers: {
// 'Content-Type': 'application/json', // 'Content-Type': 'application/json',
@ -11,7 +11,7 @@
// // Configure API client for Template-Manager service // // Configure API client for Template-Manager service
// const templateApiClient = axios.create({ // const templateApiClient = axios.create({
// baseURL: 'http://localhost:8009', // Direct to template-manager // baseURL: 'https://backend.codenuk.com', // Direct to template-manager
// timeout: 30000, // timeout: 30000,
// headers: { // headers: {
// 'Content-Type': 'application/json', // 'Content-Type': 'application/json',