Build & Deployment
Relevant source files
The following files were used as context for generating this wiki page:
The build and deployment infrastructure of the project consists of a decoupled architecture featuring a React-based frontend and a .NET Core-based backend API. The frontend utilizes standard Node.js scripts for development and production optimization, while the backend leverages the .NET SDK for cross-platform runtime support and environment-specific configurations.
Sources: Front/package.json, Back/Alumnos/global.json, Back/Alumnos/Api/Program.cs
Frontend Build System
The frontend is a React application bootstrapped with Create React App (CRA). It uses react-scripts to manage the build pipeline, including transpilation, bundling, and minification.
Available Scripts
The project defines several npm scripts to manage the application lifecycle:
| Script | Command | Purpose |
|---|---|---|
start | react-scripts start | Runs the app in development mode at http://localhost:3000. |
build | react-scripts build | Bundles and minifies the app for production in the /build folder. |
test | react-scripts test | Launches the interactive test runner. |
eject | react-scripts eject | Removes the single build dependency to expose internal configurations. |
Sources: Front/package.json:28-33, Front/README.md:7-40
Production Optimization
When running npm run build, the system performs several optimizations:
- Minification: Scripts are minified to reduce file size.
- Cache Busting: Filenames include hashes (e.g.,
main.a1b2c3.js) to ensure users receive updated versions upon deployment. - Asset Transformation: The
%PUBLIC_URL%placeholder in the HTML template is replaced with the specific path where the app is hosted.
Sources: Front/README.md:23-28, Front/public/index.html:19-27
Backend Build and Environment
The backend is built on .NET 8.0, as specified in the global configuration, and utilizes a structured initialization process in Program.cs.
Build Configuration
The backend environment is managed via the global.json and launchSettings.json files:
- SDK Version: The project explicitly requires .NET SDK
8.0.0. - Profiles: Development profiles support both HTTP (
http://localhost:5230) and HTTPS (https://localhost:7170). - Environment Variables: The
ASPNETCORE_ENVIRONMENTvariable is set to "Development" during local execution.
Sources: Back/Alumnos/global.json:2-6, Back/Alumnos/Api/Properties/launchSettings.json:13-35
Development vs Production Flow
The backend logic adjusts based on the environment to provide developer-friendly tools like Swagger UI only when not in a production setting.
The diagram shows the conditional logic used during the backend startup to enable documentation tools in development.
Sources: Back/Alumnos/Api/Program.cs:100-111
Deployment Infrastructure
Deployment readiness is achieved through environment-specific configurations and security settings.
Middleware and Security
The API is configured to support Cross-Origin Resource Sharing (CORS) and JWT-based authentication, which are critical for deployment in a distributed environment where the frontend and backend may reside on different domains.
- CORS Policy: The "PoliticasCors" policy allows any origin, header, and method, while exposing the
Authorizationheader. - Authentication: Uses
JwtBearerDefaultswith validation for the Issuer Signing Key and Lifetime.
Sources: Back/Alumnos/Api/Program.cs:46-52, Back/Alumnos/Api/Program.cs:53-65
External Dependencies
The build process requires specific dependencies defined in the package manifest and project files:
| Dependency Type | Key Packages / Frameworks | Source File |
|---|---|---|
| Frontend UI | React 19, Bootstrap 5, Material UI | Front/package.json:5-26 |
| Backend Core | .NET 8.0, Entity Framework Core | Back/Alumnos/global.json:3, Back/Alumnos/Api/Program.cs:4-8 |
| Database | SQL Server (via UseSqlServer) | Back/Alumnos/Api/Program.cs:17-18 |
Summary
The "Build & Deployment" process for this project separates the concerns of the React frontend and the .NET backend. The frontend focuses on production bundling through react-scripts, while the backend emphasizes environment-aware service registration and security middleware configuration. Successful deployment requires a .NET 8.0 runtime environment and a Node.js environment capable of executing production builds.
Sources: Front/README.md, Back/Alumnos/global.json, Back/Alumnos/Api/Program.cs