feat: Sprint 6 - documentation and infrastructure
- Docker setup (Dockerfile.backend, Dockerfile.frontend, nginx, docker-compose) - Architecture overview with Mermaid sequence diagram - README with quick start and Docker instructions - Verify OpenAPI spec and ADR docs
This commit is contained in:
parent
9ae3906971
commit
d4a7ccf1c9
51
README.md
Normal file
51
README.md
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# MoexVibe
|
||||||
|
|
||||||
|
Веб-приложение для анализа ценных бумаг Московской биржи (MOEX).
|
||||||
|
|
||||||
|
## Tech Stack
|
||||||
|
|
||||||
|
- **Backend:** NestJS, TypeScript, OpenAPI (Swagger)
|
||||||
|
- **Frontend:** React, TypeScript, Vite, TanStack Query, lightweight-charts
|
||||||
|
- **Infrastructure:** Docker, docker-compose
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install dependencies
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# Start backend (http://localhost:3000)
|
||||||
|
npm run dev:backend
|
||||||
|
|
||||||
|
# Start frontend (http://localhost:5173)
|
||||||
|
npm run dev:frontend
|
||||||
|
```
|
||||||
|
|
||||||
|
Swagger UI: http://localhost:3000/api/docs
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up --build
|
||||||
|
```
|
||||||
|
|
||||||
|
- Frontend: http://localhost:80
|
||||||
|
- Backend: http://localhost:3000
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run test:backend
|
||||||
|
```
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
apps/
|
||||||
|
backend/ — NestJS API (single point of access to MOEX ISS)
|
||||||
|
frontend/ — React SPA with Vite
|
||||||
|
docs/
|
||||||
|
architecture/ — ADR documents and diagrams
|
||||||
|
openapi/ — OpenAPI specification
|
||||||
|
superpowers/ — Design specs and implementation plans
|
||||||
|
```
|
||||||
20
docker-compose.yml
Normal file
20
docker-compose.yml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
services:
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/Dockerfile.backend
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
- PORT=3000
|
||||||
|
- MOEX_BASE_URL=https://iss.moex.com/iss
|
||||||
|
- MOEX_RATE_LIMIT=10
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/Dockerfile.frontend
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
14
docker/Dockerfile.backend
Normal file
14
docker/Dockerfile.backend
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
FROM node:20-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json tsconfig.base.json ./
|
||||||
|
COPY apps/backend/ apps/backend/
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build -w apps/backend
|
||||||
|
|
||||||
|
FROM node:20-alpine AS production
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app/apps/backend/dist ./dist
|
||||||
|
COPY --from=build /app/apps/backend/node_modules ./node_modules
|
||||||
|
COPY --from=build /app/apps/backend/package.json ./
|
||||||
|
EXPOSE 3000
|
||||||
|
CMD ["node", "dist/main.js"]
|
||||||
12
docker/Dockerfile.frontend
Normal file
12
docker/Dockerfile.frontend
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
FROM node:20-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json tsconfig.base.json ./
|
||||||
|
COPY apps/frontend/ apps/frontend/
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build -w apps/frontend
|
||||||
|
|
||||||
|
FROM nginx:alpine
|
||||||
|
COPY --from=build /app/apps/frontend/dist /usr/share/nginx/html
|
||||||
|
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
15
docker/nginx.conf
Normal file
15
docker/nginx.conf
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://backend:3000;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
docs/architecture/overview.md
Normal file
24
docs/architecture/overview.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Architecture Overview
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
sequenceDiagram
|
||||||
|
participant User
|
||||||
|
participant Frontend as React SPA
|
||||||
|
participant Backend as NestJS API
|
||||||
|
participant Cache as In-Memory Cache
|
||||||
|
participant MOEX as MOEX ISS
|
||||||
|
|
||||||
|
User->>Frontend: Search / View instrument
|
||||||
|
Frontend->>Backend: GET /api/v1/securities/search?q=SBER
|
||||||
|
Backend->>Cache: getOrFetch('search:sber')
|
||||||
|
alt Cache miss
|
||||||
|
Cache->>Backend: null
|
||||||
|
Backend->>MOEX: GET /iss/securities?q=SBER
|
||||||
|
MOEX-->>Backend: raw data
|
||||||
|
Backend->>Cache: set('search:sber', normalized, TTL=3600)
|
||||||
|
else Cache hit
|
||||||
|
Cache-->>Backend: cached data
|
||||||
|
end
|
||||||
|
Backend-->>Frontend: normalized response
|
||||||
|
Frontend-->>User: rendered UI
|
||||||
|
```
|
||||||
Loading…
x
Reference in New Issue
Block a user