How oopman64bit/vc_wallet_hometask works
Project type and purpose
• Full-stack application for issuing, storing, sharing, and verifying RSA-signed verifiable credentials.
• Frontend: React SPA on port 3000 (or 80 in Docker).
• Backend: NestJS API on port 3001, file-based storage, Swagger docs at /api.
Main components
A. Client Layer
1. Browser / React SPA
– Components: IssueCredentialForm, VerifyModal, ShareModal, CredentialCard, Toast, etc.
– Axios-based api.ts service with correlation IDs.
B. API Layer
2. NestJS Backend
– Controllers:
• CredentialsController (POST /api/v1/credentials, GET /api/v1/credentials, POST /api/v1/credentials/verify)
• HealthController (GET /api/v1/health)
– Modules: CredentialsModule, HealthModule, AppModule
– Services:
• CredentialsService (orchestrates issue/verify flows)
• CryptoService (RSA signing/verifying)
• StorageService (reads/writes data/credentials.json)
– Common utilities:
• LoggingInterceptor (Winston logger)
• TransformInterceptor, HttpExceptionFilter, BusinessException
• Configuration (+ .env support via configuration.ts)
C. Data Layer
3. File-based storage
– data/credentials.json (mounted via Docker volume or local backend/data/)
D. Infrastructure & DevOps
4. Docker & Docker‐Compose
– Multi‐stage Dockerfile for backend
– docker-compose.yml orchestrates backend container (exposes 3001:3001)
5. Swagger UI (hosted at /api)
6. Jest Tests
– Unit tests under src/…/*.spec.ts
– E2E tests under test/credentials.e2e-spec.ts
Relationships & data flow
• Backend Controllers route requests into Services and common layers.
• CredentialsService calls CryptoService for signing/verifying, then StorageService to persist or retrieve JSON.
• LoggingInterceptor and ExceptionFilter intercept all requests/responses (cross-cutting).
• HealthController pings HealthService (e.g., always returns “ok”).
• Swagger module introspects Controllers and exposes OpenAPI UI.
Architectural patterns & design principles
• Layered architecture (Controllers → Services → Data).
• Module-based organization (NestJS modules).
• Cross-cutting concerns handled via interceptors/filters (logging, error handling, transformations).
• File‐based persistence (simple JSON store, placed in a dedicated data volume).
• Separation of concerns: frontend UI vs. backend API vs. storage.
– Ports, protocols, and data stores are annotated.