Deployment Strategies
Relevant source files
The following files were used as context for generating this wiki page:
The Technical Analysis project employs a multi-tiered deployment strategy covering a React-based frontend, a NestJS backend, and a Python-based indicator service. The project is structured as a monorepo, requiring synchronized build and execution steps across different environments. The strategy focuses on transitioning from development watch modes to optimized production bundles using various build tools like Webpack (via Create React App), Nest CLI, and Rollup.
Deployment involves preparing the environment with specific runtimes (Node.js, Python), installing dependencies via npm, yarn, or poetry, and executing build scripts that minify and optimize assets for performance.
Sources: readme.md:14-20, frontend/README.md:1-40, backend/package.json:11-20
Frontend Deployment
The frontend is a React application created with create-react-app. The deployment process centers around the yarn build command, which generates an optimized production bundle in a build/ folder.
Production Build Process
When running the build, the application correctly bundles React in production mode and optimizes the build for performance. The resulting files are minified, and filenames include hashes to ensure efficient caching and cache-busting during deployment.
Sources: frontend/README.md:27-35, frontend/package.json:34
Library Distribution (KLineChart)
The project includes a sub-module klinechart which uses Rollup for deployment. It supports multiple UMD (Universal Module Definition) targets:
- Standard:
klinecharts.js(dev) andklinecharts.min.js(prod). - Blank:
klinecharts.blank.js(dev/prod). - Simple:
klinecharts.simple.js(dev/prod).
Production builds for this library utilize terser for code compression and rollup-plugin-filesize to monitor bundle size.
Sources: frontend/src/klinechart/config/rollup.config.js:10-75
Backend Deployment
The backend is built using the NestJS framework. Its deployment strategy relies on compiling TypeScript into JavaScript and running the resulting files from a dist/ directory.
Build and Execution Flow
- Prebuild: The
rimraf distcommand ensures a clean environment by removing previous builds. - Build:
nest buildcompiles the TypeScript source into the distribution folder. - Start Production: The server is launched using
node dist/main.
Sources: backend/package.json:12-17
Service Interaction Diagram
The following diagram illustrates the deployment components and how they interact in a production environment:
The diagram shows the flow from the client through the deployed frontend and backend components. Sources: readme.md:14-20, backend/package.json:36-40
Deployment Environment Requirements
The project requires several environments to be configured for a successful deployment.
| Requirement | Purpose | Source File |
|---|---|---|
| Node.js | Runtime for Frontend and NestJS Backend | readme.md:14 |
| Python / Poetry | Runtime and dependency management for Indicator service | readme.md:14 |
| .env file | Configuration for TINKOFF_SECRET in /backend | readme.md:18 |
| SQLite3 | Local database persistence | backend/package.json:44 |
Sources: readme.md:14-20, backend/package.json:44
Continuous Integration and Quality Assurance
The repository includes configuration for testing and linting, which are prerequisites for deployment to ensure code quality.
- Testing: Both frontend and backend use
jest. Backend deployment scripts includetest:e2eandtest:covfor coverage reporting. - Linting:
eslintis used across the root, backend, and frontend packages to maintain code standards before build. - Package Management: The project utilizes
npmat the root and backend levels, while the frontend documentation referencesyarn.
Sources: package.json:11-16, backend/package.json:18-24, frontend/README.md:13-25
Deployment Summary
Deployment for the Technical Analysis project is a multi-step process:
- Frontend: Assets are built via
react-scripts buildto create a staticbuild/directory for web server hosting. - Backend: TypeScript is compiled via
nest buildand served as a Node.js process. - Indicators: The Python service is deployed by installing dependencies with
poetryand runningmain.py.
The strategy ensures that each micro-component (frontend, API, and calculation engine) is optimized for its respective runtime before being interconnected.
Sources: readme.md:14-20, backend/package.json:11-17, frontend/package.json:33-35