Consolidate 3 separate applications (reports-app, data-entry-app, telegram-bot) into a unified
architecture with single backend and frontend:
Backend Changes:
- Unified FastAPI backend at backend/ with modular structure
- Modules: reports, data_entry, telegram in backend/modules/
- Centralized config.py and main.py with all routers registered
- Single worker mode (--workers 1) for Telegram bot compatibility
- Shared Oracle connection pool and JWT authentication
- Unified requirements.txt and environment configuration
Frontend Changes:
- Single Vue.js SPA with module-based routing
- Unified frontend at src/ with modules in src/modules/{reports,data-entry}/
- Shared components and stores in src/shared/
- Error boundaries for module isolation
- Dual API proxy in Vite for module communication
Infrastructure:
- New unified startup scripts: start-prod.sh, start-test.sh, start-backend.sh
- Environment templates: .env.dev.example, .env.test.example, .env.prod.example
- Updated deployment scripts for Windows IIS
- Simplified SSH tunnel management
Documentation:
- Comprehensive CLAUDE.md with architecture overview
- Module-specific docs in docs/{data-entry,telegram}/
- Architecture decision records in docs/ARCHITECTURE-DECISIONS.md
- Deployment guides consolidated in deployment/windows/docs/
This migration reduces complexity, improves maintainability, and enables easier
deployment while maintaining all existing functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
114 lines
3.6 KiB
JavaScript
114 lines
3.6 KiB
JavaScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
// Plugin to replace BUILD_TIMESTAMP in index.html at build
|
|
function htmlTimestampPlugin() {
|
|
return {
|
|
name: 'html-timestamp',
|
|
transformIndexHtml(html) {
|
|
return html.replace('BUILD_TIMESTAMP', new Date().toISOString())
|
|
}
|
|
}
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [vue(), htmlTimestampPlugin()],
|
|
// Base path for IIS sub-application at /roa2web
|
|
base: process.env.NODE_ENV === 'production' ? '/roa2web/' : '/',
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
'@shared': fileURLToPath(new URL('./src/shared', import.meta.url)),
|
|
'@reports': fileURLToPath(new URL('./src/modules/reports', import.meta.url)),
|
|
'@data-entry': fileURLToPath(new URL('./src/modules/data-entry', import.meta.url))
|
|
},
|
|
dedupe: ['vue', 'vue-router', 'pinia', 'primevue']
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
host: true,
|
|
// Disable file watching to prevent WSL2 deadlock
|
|
watch: null,
|
|
// Disable HMR completely
|
|
hmr: false,
|
|
// Single proxy configuration for unified backend
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8000',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
configure: (proxy, options) => {
|
|
proxy.on('proxyReq', (proxyReq, req, res) => {
|
|
// Preserve authorization header during redirects
|
|
if (req.headers.authorization) {
|
|
proxyReq.setHeader('Authorization', req.headers.authorization);
|
|
}
|
|
// Preserve X-Selected-Company header for data-entry
|
|
if (req.headers['x-selected-company']) {
|
|
proxyReq.setHeader('X-Selected-Company', req.headers['x-selected-company']);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
'/uploads': {
|
|
target: 'http://localhost:8000',
|
|
changeOrigin: true,
|
|
secure: false
|
|
}
|
|
}
|
|
},
|
|
optimizeDeps: {
|
|
include: ['vue', 'vue-router', 'pinia']
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
sourcemap: true,
|
|
commonjsOptions: {
|
|
include: [/node_modules/]
|
|
},
|
|
// Cache busting - generate new hashes on each build
|
|
assetsInlineLimit: 0, // Don't inline small assets, use separate files with hash
|
|
rollupOptions: {
|
|
output: {
|
|
// Force unique hashes for all files
|
|
entryFileNames: `assets/[name].[hash].js`,
|
|
chunkFileNames: `assets/[name].[hash].js`,
|
|
assetFileNames: `assets/[name].[hash].[ext]`,
|
|
// Manual chunks for better lazy loading and code splitting
|
|
manualChunks: {
|
|
// Core vendors
|
|
'vendor-core': ['vue', 'vue-router', 'pinia'],
|
|
'vendor-primevue': [
|
|
'primevue/config',
|
|
'primevue/button',
|
|
'primevue/datatable',
|
|
'primevue/column',
|
|
'primevue/inputtext',
|
|
'primevue/password',
|
|
'primevue/dropdown',
|
|
'primevue/calendar',
|
|
'primevue/dialog',
|
|
'primevue/toast',
|
|
'primevue/confirmdialog'
|
|
],
|
|
'vendor-utils': ['axios', 'date-fns'],
|
|
|
|
// Charts (reports only - will be lazy loaded)
|
|
'vendor-charts': ['chart.js', 'vue-chartjs'],
|
|
|
|
// Excel/PDF exports (lazy loaded)
|
|
'vendor-export': ['xlsx', 'jspdf', 'jspdf-autotable']
|
|
|
|
// Note: Reports and Data Entry modules will be lazy loaded via dynamic imports
|
|
}
|
|
}
|
|
}
|
|
},
|
|
// Add timestamp to build for versioning
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(new Date().toISOString()),
|
|
__BUILD_TIMESTAMP__: JSON.stringify(Date.now())
|
|
}
|
|
})
|