How jdevcs/veri-wallet works
Project Type and Purpose
• This is a full-stack verifiable credential wallet:
• Frontend: React 18 + TypeScript, built with Vite
• Backend: NestJS API for issuing, storing, and verifying verifiable credentials
• Storage: File-based persistence (no external database)
• Crypto: Ed25519 signing with encrypted keypair
• CI: GitHub Actions builds/tests both frontend and backend
File Structure Analysis
• Top-level directories:
• backend-veri-wallet/ – NestJS project (controllers, services, modules, crypto, storage, tests)
• ui-veri-wallet/ – Vite/React SPA (pages, components, API client)
• docs/ – Markdown docs for both backend and frontend
• Configuration and build scripts:
• Dockerfile in backend, CI workflow in .github/workflows/ci.yml
• tsconfig.json, ESLint, Prettier, Vite config, environment variable usage
Key Components
a. Frontend (ui-veri-wallet)
• Pages: DashboardPage, IssueCredentialPage, VerifyCredentialPage
• Components: Header, CredentialList, IssueCredentialForm, VerifyCredentialForm
• API client: credentialsApi.ts uses REST calls (POST /credentials, GET /credentials, POST /credentials/verify, DELETE /credentials/:id)
• Dev server (Vite) and build step
b. Backend (backend-veri-wallet)
• NestJS Modules: CredentialsModule
• Controllers: CredentialsController (HTTP endpoints for issue, list, fetch, verify, delete)
• Services:
• CredentialService (orchestrates issue/verify flows)
• CredentialSignerService (crypto signing)
• KeyManagerService (key loading/decryption)
• Storage layer:
• CredentialRepository interface
• FileCredentialRepository implementation (reads/writes JSON files under data/)
• Main entry: main.ts initializes Nest application, loads config (PORT, KEYPAIR_PASSPHRASE)
c. Persistence
• File system storage: data/keypair.json (encrypted), data/credentials/*.json
d. External/Infrastructure
• Environment variables: PORT, KEYPAIR_PASSPHRASE, VITE_API_BASE_URL
• Docker (optional containerized backend)
• CI pipeline (GitHub Actions)
Interactions & Data Flows
• Browser → React SPA
• React SPA → REST API calls to NestJS backend
• NestJS Controller → Service layer → Crypto/Storage modules → File system
• Verification flow: Controller → Service → CredentialSignerService verifies signature
• CI pipeline: checks out code → installs dependencies → runs tests (backend) and build (frontend)
Architectural Patterns
• Backend: NestJS’s modular/MVC pattern (Controllers, Providers, Modules)
• Frontend: Component-based SPA, API separation
• Dependency injection in NestJS for crypto and storage abstractions
Essential Elements
• Clear labels for all components, modules, and external resources