How interview-repo/vitasystems works
Project type and purpose
• This is a single-page front-end web application built with React, TypeScript, and Vite.
• Its purpose is to guide users through a multi-step form (budget selection, contact info, service selection, submit request, success confirmation) and to provide a tracking dashboard (login + project status tracking).
• It communicates with a remote backend via an HTTP API (see src/api/http-client.ts, auth-manager.ts).
File structure
• Top-level entries:
• public, index.html: static assets and app shell
• src: all application code
• src/api: API-layer (HTTP client, auth manager, types, endpoints)
• src/common/utils: shared utilities (formatDate, sleep, storage abstraction)
• src/components: generic UI components (navigation, progress bar)
• src/features: feature modules, each implementing a slice of UX
– form: multi-step form sub-directories per step
– tracking: dashboard and login sub-directories
• src/hooks: custom React hooks (multi-step form, tracking, copy to clipboard)
• Config & tooling:
– Vite (vite.config.ts) for dev/build
– ESLint (eslint.config.js)
– Tailwind CSS (tailwind.config.js)
– TypeScript configs (tsconfig.app.json, tsconfig.node.json)
– Vercel config for deployment
Key insights from README
• Project scaffold: React + TypeScript + Vite, with ESLint and optional plugins.
• No backend code shipped here—this repo only holds the front-end layer.
Main components
a. Client / UI Layer
– React app (entry point src/main.tsx → App.tsx)
– Presentation components under src/components & src/features
– State management via React hooks (useMultiStepForm, useTracking)
b. API Layer
– HTTP client (src/api/http-client.ts)
– Auth manager (src/api/auth-manager.ts) handling tokens, login/logout flows
– Constants / types defining contract with backend (src/api/constants.ts, types.ts)
c. Local Persistence
– storage util (src/common/utils/storage.ts) for caching tokens or form state
d. Build & Deployment
– Vite dev server → HMR → produces production bundle
– Vercel config (vercel.json) for CD
e. External Services
– Backend REST endpoints (authentication, form submission, tracking data)
– Optional third-party APIs (if any, not shown here)
Relationships and interactions
• User interacts with the React UI → triggers actions in feature modules → invoke hooks → calls API layer.
• HTTP client attaches auth token via auth-manager → sends requests to backend → receives JSON → mapping to types → UI updates.
• Local storage reads/writes tokens and form progress.
Architectural patterns and design principles
• Layered architecture: Presentation (components) → Business logic (feature modules + hooks) → API layer → Persistence / external
• “Feature-first” directory structure: keeps code for each feature (form, tracking) co-located.
• Separation of concerns: common utilities in one place; API concerns abstracted away from components.
Final recommendations
• Custom hooks as first-class elements to show where state and side effects live.
• Async flow: how auth-manager obtains/stores tokens and how http-client injects them.