161 | {body} 162 |
163 | ) 164 | }) 165 | FormMessage.displayName = "FormMessage" 166 | 167 | export { 168 | useFormField, 169 | Form, 170 | FormItem, 171 | FormLabel, 172 | FormControl, 173 | FormDescription, 174 | FormMessage, 175 | FormField, 176 | } 177 | -------------------------------------------------------------------------------- /DEPLOYMENT.md: -------------------------------------------------------------------------------- 1 | # QuantDash Deployment Guide 2 | 3 | ## 🚀 Render.com Deployment 4 | 5 | ### Option A: Manual Deployment (Recommended) 6 | 7 | #### Backend Deployment: 8 | 1. **Create Web Service** on Render.com 9 | 2. **Connect GitHub Repository** 10 | 3. **Configure Service:** 11 | - **Name**: `quantdash-backend` 12 | - **Environment**: `Python 3` 13 | - **Region**: Choose closest to your users 14 | - **Branch**: `master` 15 | - **Root Directory**: `backend` 16 | - **Build Command**: `pip install -r ../requirements.txt` 17 | - **Start Command**: `python src/api/server.py` 18 | 19 | 4. **Environment Variables:** 20 | ``` 21 | PYTHONPATH=/opt/render/project/src/backend/src 22 | PORT=8000 23 | ``` 24 | 25 | #### Frontend Deployment: 26 | 1. **Create Static Site** on Render.com 27 | 2. **Connect Same GitHub Repository** 28 | 3. **Configure Service:** 29 | - **Name**: `quantdash-frontend` 30 | - **Environment**: `Static Site` 31 | - **Root Directory**: `frontend` 32 | - **Build Command**: `npm ci && npm run build` 33 | - **Publish Directory**: `dist` 34 | 35 | 4. **Environment Variables:** 36 | ``` 37 | VITE_API_BASE_URL=https://quantdash-backend.onrender.com/api 38 | ``` 39 | 40 | ### Option B: Infrastructure as Code 41 | 42 | 1. **Push render.yaml** to your repository 43 | 2. **Connect to Render** via Blueprint 44 | 3. **Deploy both services** automatically 45 | 46 | --- 47 | 48 | ## 🐳 Docker Deployment 49 | 50 | ### Local Testing: 51 | ```bash 52 | # Build and run with Docker Compose 53 | docker-compose up --build 54 | 55 | # Access application 56 | open http://localhost 57 | ``` 58 | 59 | ### Production Docker: 60 | ```bash 61 | # Build backend 62 | docker build -f Dockerfile.backend -t quantdash-backend . 63 | 64 | # Build frontend 65 | docker build -f Dockerfile.frontend -t quantdash-frontend . 66 | 67 | # Run containers 68 | docker run -d -p 8000:8000 quantdash-backend 69 | docker run -d -p 80:80 quantdash-frontend 70 | ``` 71 | 72 | --- 73 | 74 | ## 🔧 Environment Configuration 75 | 76 | ### Development (.env.local): 77 | ``` 78 | VITE_API_BASE_URL=http://localhost:8000/api 79 | ``` 80 | 81 | ### Production (.env.production): 82 | ``` 83 | VITE_API_BASE_URL=https://quantdash-backend.onrender.com/api 84 | ``` 85 | 86 | --- 87 | 88 | ## 📋 Pre-Deployment Checklist 89 | 90 | ### Backend Ready: 91 | - [ ] All dependencies in requirements.txt 92 | - [ ] CORS configured for production domains 93 | - [ ] Environment variables support 94 | - [ ] Health check endpoints added 95 | - [ ] Error handling implemented 96 | 97 | ### Frontend Ready: 98 | - [ ] Production build working (`npm run build`) 99 | - [ ] Environment variables configured 100 | - [ ] API URLs pointing to production 101 | - [ ] Static assets optimized 102 | - [ ] Mobile responsiveness tested 103 | 104 | ### General: 105 | - [ ] All secrets removed from code 106 | - [ ] Database/cache strategy defined 107 | - [ ] Monitoring/logging configured 108 | - [ ] Performance optimized 109 | - [ ] Security headers added 110 | 111 | --- 112 | 113 | ## 🚦 Testing Deployment 114 | 115 | ### 1. Local Production Test: 116 | ```bash 117 | # Test backend 118 | cd backend && python src/api/server.py 119 | 120 | # Test frontend build 121 | cd frontend && npm run build && npm run preview 122 | ``` 123 | 124 | ### 2. Verify API Endpoints: 125 | ```bash 126 | curl https://quantdash-backend.onrender.com/health 127 | curl https://quantdash-backend.onrender.com/api/tickers 128 | ``` 129 | 130 | ### 3. Frontend Verification: 131 | - [ ] Application loads 132 | - [ ] API calls work 133 | - [ ] Charts render correctly 134 | - [ ] Mobile responsive 135 | - [ ] All strategies functional 136 | 137 | --- 138 | 139 | ## 🔒 Security Considerations 140 | 141 | 1. **CORS**: Restrict to production domains only 142 | 2. **HTTPS**: Ensure all API calls use HTTPS 143 | 3. **Rate Limiting**: Consider adding API rate limits 144 | 4. **Environment Variables**: Never commit secrets 145 | 5. **Input Validation**: Validate all user inputs 146 | 147 | --- 148 | 149 | ## 📊 Monitoring & Maintenance 150 | 151 | ### Health Checks: 152 | - Backend: `https://quantdash-backend.onrender.com/health` 153 | - Frontend: Monitor loading time and functionality 154 | 155 | ### Performance: 156 | - Monitor API response times 157 | - Track memory usage 158 | - Monitor error rates 159 | 160 | ### Updates: 161 | 1. Test changes locally 162 | 2. Deploy to staging (if available) 163 | 3. Deploy to production 164 | 4. Verify functionality 165 | 166 | --- 167 | 168 | ## 🆘 Troubleshooting 169 | 170 | ### Common Issues: 171 | 172 | **"Module not found" errors:** 173 | - Check PYTHONPATH environment variable 174 | - Verify all imports use relative paths 175 | 176 | **CORS errors:** 177 | - Update allowed origins in server.py 178 | - Check environment variable URLs 179 | 180 | **Build failures:** 181 | - Check Node.js version compatibility 182 | - Verify all dependencies are listed 183 | - Clear cache and rebuild 184 | 185 | **API connection failures:** 186 | - Verify backend URL in environment variables 187 | - Check backend service logs 188 | - Test endpoints manually 189 | 190 | --- 191 | 192 | ## 📞 Support 193 | 194 | - **Documentation**: See main README.md 195 | - **Issues**: GitHub Issues 196 | - **Logs**: Check Render service logs for debugging 197 | -------------------------------------------------------------------------------- /frontend/src/components/ui/toast.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as ToastPrimitives from "@radix-ui/react-toast" 3 | import { cva, type VariantProps } from "class-variance-authority" 4 | import { X } from "lucide-react" 5 | 6 | import { cn } from "@/lib/utils" 7 | 8 | const ToastProvider = ToastPrimitives.Provider 9 | 10 | const ToastViewport = React.forwardRef< 11 | React.ElementRef