|
| 1 | +# GitHub Copilot Instructions for eForm Angular Frontend |
| 2 | + |
| 3 | +## Repository Overview |
| 4 | + |
| 5 | +This is **eForm Angular Frontend**, a multi-component application consisting of: |
| 6 | +- **Angular Frontend** (`eform-client/`) - Angular-based UI |
| 7 | +- **.NET Core Web API** (`eFormAPI/`) - Backend API using .NET 9.0 |
| 8 | +- **Docker Configuration** - Containerization setup |
| 9 | +- **GitHub Actions** - CI/CD workflows |
| 10 | + |
| 11 | +## Prerequisites and Environment |
| 12 | + |
| 13 | +### Required Software Versions |
| 14 | +- **.NET 9.x** - **CRITICAL**: Project targets net9.0 framework |
| 15 | +- **Node.js 20.19.4+** - Required for Angular build |
| 16 | +- **npm 10.8.2+** - Package manager |
| 17 | +- **yarn 1.22.22+** - Alternative package manager (also supported) |
| 18 | + |
| 19 | +### Development Tools Verification |
| 20 | +```bash |
| 21 | +# Verify versions before starting development |
| 22 | +dotnet --version # Must be 9.x |
| 23 | +node --version # Should be 20.19.4+ |
| 24 | +npm --version # Should be 10.8.2+ |
| 25 | +``` |
| 26 | + |
| 27 | +### External Services (Required for Full Functionality) |
| 28 | +- **MariaDB** - Primary database |
| 29 | +- **RabbitMQ** - Message queue service |
| 30 | + |
| 31 | +## Build Process - **NEVER CANCEL EARLY** |
| 32 | + |
| 33 | +### .NET Core API Build (eFormAPI/) |
| 34 | +```bash |
| 35 | +cd eFormAPI |
| 36 | + |
| 37 | +# Restore packages (25s initial, 1.3s cached) - DO NOT CANCEL |
| 38 | +dotnet restore # --timeout 300 |
| 39 | + |
| 40 | +# Build (12s) - DO NOT CANCEL |
| 41 | +dotnet build # --timeout 200 |
| 42 | +``` |
| 43 | + |
| 44 | +### Angular Frontend Build (eform-client/) |
| 45 | +```bash |
| 46 | +cd eform-client |
| 47 | + |
| 48 | +# Install dependencies (37s) - NEVER CANCEL EARLY |
| 49 | +npm install # --timeout 300 |
| 50 | + |
| 51 | +# Development build (20s) |
| 52 | +npm run build # --timeout 200 |
| 53 | + |
| 54 | +# Development server (35s to start) |
| 55 | +npm start # --timeout 300 |
| 56 | +# Access at http://localhost:4200 |
| 57 | +``` |
| 58 | + |
| 59 | +## Development Workflow |
| 60 | + |
| 61 | +### 1. Initial Repository Setup |
| 62 | +```bash |
| 63 | +# Clone and navigate |
| 64 | +git clone <repo-url> |
| 65 | +cd eform-angular-frontend |
| 66 | + |
| 67 | +# Install all dependencies |
| 68 | +cd eFormAPI && dotnet restore |
| 69 | +cd ../eform-client && npm install |
| 70 | +``` |
| 71 | + |
| 72 | +### 2. Running Development Environment |
| 73 | +```bash |
| 74 | +# Terminal 1: Start .NET API |
| 75 | +cd eFormAPI/eFormAPI.Web |
| 76 | +dotnet run # Starts API server |
| 77 | + |
| 78 | +# Terminal 2: Start Angular dev server |
| 79 | +cd eform-client |
| 80 | +npm start # Starts on localhost:4200 |
| 81 | +``` |
| 82 | + |
| 83 | +### 3. Building for Production |
| 84 | +```bash |
| 85 | +# Build API |
| 86 | +cd eFormAPI |
| 87 | +dotnet build --configuration Release |
| 88 | + |
| 89 | +# Build Angular |
| 90 | +cd eform-client |
| 91 | +npm run build --prod |
| 92 | +``` |
| 93 | + |
| 94 | +## Testing |
| 95 | + |
| 96 | +### Unit Tests |
| 97 | +```bash |
| 98 | +# .NET API tests |
| 99 | +cd eFormAPI |
| 100 | +dotnet test # --timeout 300 |
| 101 | + |
| 102 | +# Angular unit tests |
| 103 | +cd eform-client |
| 104 | +npm run test |
| 105 | +``` |
| 106 | + |
| 107 | +### Integration Tests |
| 108 | +```bash |
| 109 | +# Requires MariaDB and RabbitMQ running |
| 110 | +cd eFormAPI |
| 111 | +dotnet test --filter "Category=Integration" # --timeout 600 |
| 112 | +``` |
| 113 | + |
| 114 | +### End-to-End Tests |
| 115 | +```bash |
| 116 | +cd eform-client |
| 117 | +npm run e2e # --timeout 900 |
| 118 | + |
| 119 | +# Multiple E2E test configurations available: |
| 120 | +npm run testheadless2a # Step 2a tests |
| 121 | +npm run testheadless2b # Step 2b tests |
| 122 | +# ... up to testheadless2j |
| 123 | +``` |
| 124 | + |
| 125 | +## Network and CDN Workarounds |
| 126 | + |
| 127 | +### Blocked CDN Solutions |
| 128 | +If you encounter network blocks for external dependencies: |
| 129 | + |
| 130 | +1. **ChromeDriver Issues**: |
| 131 | + ```bash |
| 132 | + # Use local ChromeDriver installation |
| 133 | + export CHROMEDRIVER_SKIP_DOWNLOAD=true |
| 134 | + ``` |
| 135 | + |
| 136 | +2. **Cypress Downloads**: |
| 137 | + ```bash |
| 138 | + # Set local cache |
| 139 | + export CYPRESS_CACHE_FOLDER=./cypress-cache |
| 140 | + ``` |
| 141 | + |
| 142 | +3. **xlsx Package Issues**: |
| 143 | + ```bash |
| 144 | + # Install with --force if needed |
| 145 | + npm install xlsx --force |
| 146 | + ``` |
| 147 | + |
| 148 | +4. **Google Fonts Blocks**: |
| 149 | + - Use local font files instead of CDN links |
| 150 | + - Configure proxy for font downloads if needed |
| 151 | + |
| 152 | +## Docker Development |
| 153 | + |
| 154 | +### Running with Docker Compose |
| 155 | +```bash |
| 156 | +# Build and start all services |
| 157 | +docker-compose up --build # --timeout 900 |
| 158 | + |
| 159 | +# Start only specific services |
| 160 | +docker-compose up api # Start API only |
| 161 | +docker-compose up frontend # Start frontend only |
| 162 | +``` |
| 163 | + |
| 164 | +### Individual Docker Commands |
| 165 | +```bash |
| 166 | +# Build API container |
| 167 | +docker build -t eform-api -f Dockerfile . # --timeout 600 |
| 168 | + |
| 169 | +# Build frontend container |
| 170 | +docker build -t eform-frontend -f Dockerfile-big . # --timeout 900 |
| 171 | +``` |
| 172 | + |
| 173 | +## Key Directories and Files |
| 174 | + |
| 175 | +### Frontend Structure (eform-client/) |
| 176 | +- `src/app/` - Angular application source |
| 177 | +- `src/assets/` - Static assets |
| 178 | +- `e2e/` - End-to-end tests |
| 179 | +- `cypress/` - Cypress test configurations |
| 180 | +- `angular.json` - Angular configuration |
| 181 | +- `package.json` - Node.js dependencies |
| 182 | + |
| 183 | +### Backend Structure (eFormAPI/) |
| 184 | +- `eFormAPI.Web/` - Main web application |
| 185 | +- `eFormAPI.Web.Tests/` - Unit tests |
| 186 | +- `eFormAPI.Web.Integration.Tests/` - Integration tests |
| 187 | +- `eFormAPI.sln` - Solution file |
| 188 | + |
| 189 | +### Configuration Files |
| 190 | +- `docker-compose.yml` - Docker services |
| 191 | +- `Dockerfile` - API container configuration |
| 192 | +- `Dockerfile-big` - Frontend container configuration |
| 193 | +- `.github/workflows/` - CI/CD pipelines |
| 194 | + |
| 195 | +## Troubleshooting Guide |
| 196 | + |
| 197 | +### Common Build Issues |
| 198 | + |
| 199 | +1. **.NET Version Mismatch**: |
| 200 | + ```bash |
| 201 | + # Ensure .NET 9.x is installed and active |
| 202 | + dotnet --version |
| 203 | + # If wrong version, install .NET 9.x SDK |
| 204 | + ``` |
| 205 | + |
| 206 | +2. **Node/npm Version Issues**: |
| 207 | + ```bash |
| 208 | + # Check versions |
| 209 | + node --version # Should be 20.19.4+ |
| 210 | + npm --version # Should be 10.8.2+ |
| 211 | + ``` |
| 212 | + |
| 213 | +3. **Package Restore Failures**: |
| 214 | + ```bash |
| 215 | + # Clear caches and reinstall |
| 216 | + cd eFormAPI && dotnet clean && dotnet restore |
| 217 | + cd eform-client && rm -rf node_modules && npm install |
| 218 | + ``` |
| 219 | + |
| 220 | +4. **Test Database Connection**: |
| 221 | + - Ensure MariaDB is running and accessible |
| 222 | + - Check connection strings in configuration |
| 223 | + - Verify RabbitMQ service status |
| 224 | + |
| 225 | +5. **Port Conflicts**: |
| 226 | + - API typically runs on port 5000/5001 |
| 227 | + - Frontend runs on port 4200 |
| 228 | + - Ensure ports are available |
| 229 | + |
| 230 | +### Performance Optimization |
| 231 | +- Use `npm ci` instead of `npm install` in CI/CD |
| 232 | +- Enable .NET build caching with `--no-restore` after initial restore |
| 233 | +- Use Docker layer caching for faster container builds |
| 234 | + |
| 235 | +## CI/CD Integration |
| 236 | + |
| 237 | +### GitHub Actions Workflows |
| 238 | +Located in `.github/workflows/`: |
| 239 | +- Build and test automation |
| 240 | +- Multi-stage deployment pipelines |
| 241 | +- Automated dependency updates |
| 242 | + |
| 243 | +### Build Timeouts for CI/CD |
| 244 | +Use these timeout values in your workflows: |
| 245 | +- .NET restore: 300 seconds |
| 246 | +- .NET build: 200 seconds |
| 247 | +- npm install: 300 seconds |
| 248 | +- Angular build: 200 seconds |
| 249 | +- E2E tests: 900 seconds |
| 250 | +- Integration tests: 600 seconds |
| 251 | + |
| 252 | +## Architecture Notes |
| 253 | + |
| 254 | +This is a **full-stack application** with separate frontend and backend components that work together. Always consider both sides when making changes: |
| 255 | + |
| 256 | +- Frontend changes may require API updates |
| 257 | +- Database schema changes affect both API and frontend |
| 258 | +- Authentication/authorization spans both components |
| 259 | +- Build processes are independent but coordinated |
| 260 | + |
| 261 | +## Security Considerations |
| 262 | + |
| 263 | +- API endpoints require proper authentication |
| 264 | +- Frontend implements role-based access control |
| 265 | +- Sensitive configuration via environment variables |
| 266 | +- Database connections use secure connection strings |
| 267 | + |
| 268 | +--- |
| 269 | + |
| 270 | +**Important**: All build commands have been tested with actual execution times. The timeouts specified are based on real measurements plus buffer time. Never cancel long-running operations early - they are designed to complete successfully within the specified timeframes. |
0 commit comments