How impradp/lease-pixie-frontend works
Project type and purpose
• This is a full-stack TypeScript web application built on Next.js (App Router).
• It provides a client-side UI (React) with server-side rendering and edge middleware, integrates with multiple backend microservices (account, auth, portfolio, property, vendor, Plaid, etc.), and is deployed via CI/CD (Azure/Vercel).
File structure
• Top level:
• app/—Next.js pages and layouts (client & server components).
• components/—reusable UI building blocks.
• lib/—API wrappers, middleware, shared services and utilities.
• config/ & data/—static configuration and reference data.
• middleware.ts—global edge middleware (auth gating).
• CI/CD: .github/workflows/azure-ci-cd.yml.
• Patterns:
• Layered architecture: UI → page → component → service → external API.
• Next.js App Router for SSR/SSG and client/server boundary.
• Clear separation of concerns: UI, data services, middleware.
README for additional insights
• Confirms use of create-next-app, Next.js App Router, optimized fonts, Vercel deployment.
• No built-in database—backend concerns are delegated to external services.
a. Main components
1. Browser (end user).
2. CDN / Edge (Vercel, static assets, SSR edge functions).
3. Next.js Application
• Client Components (charts, forms, navigation).
• Server Components (data fetching, page rendering).
• Global Middleware (auth guard).
4. API Layer (lib/api.ts, lib/services/*)
5. External Backend Microservices (account, auth, depositAccount, email, login, portfolio, property, user, vendor).
6. Third-Party Services (Plaid).
b. Relationships and interactions
• Browser ↔ CDN/Edge ↔ Next.js:
– Static asset requests served by CDN.
– Page requests are routed to SSR/Edge functions.
• Next.js Server Components + Middleware → API Layer:
– middleware.ts enforces authentication.
– Server Components call lib/services/* wrappers.
• API Layer → External Microservices:
– HTTP/REST calls (endpoints defined in lib/constants/endpoints.ts).
• Some Client Components call API Layer directly via fetch or next/link transitions.
• Next.js may also proxy certain API calls through its own API Routes (if implemented).
• Plaid Integration: Service wrapper in lib/services/plaid.ts interacts with Plaid’s API.
c. Architectural patterns/design principles
• Layered/hexagonal architecture—UI, application (pages), domain (services), infrastructure (external APIs).
• Next.js App Router separates client vs server.
• Centralized service layer abstracts external APIs.
• DRY UI components in components/ui/*.
• Middleware-based auth ensures secure server rendering.
d. Key technologies/frameworks/libraries
• Next.js (App Router) for SSR/SSG and routing.
• React + TypeScript for UI.
• Tailwind CSS (via tailwind.config.ts) for styling.
• Husky + lint/jest for Git hooks and testing.
• GitHub Actions for CI/CD to Azure/Vercel.
• Plaid SDK for financial integrations.
Elements
• Clear labels: Browser, CDN/Edge, Next.js App, Middleware, API Layer, Microservices, Plaid.
• UX flows (Browser → Next.js → Services).
• Data flows (Services → Microservices → DB or third party).
• Blue rectangles for Next.js components (Pages, Middleware).
Recommended breakdown of components
• Layer 1 (Client):
• Pages (src/app/*), UI Components (components/*).
• Layer 2 (Server):
• Middleware (middleware.ts), Server Components (page.tsx with server code).
• Layer 3 (Service/Integration):
• API wrappers (lib/services/*), Endpoint definitions (lib/constants/endpoints.ts).
• Layer 4 (External Systems):
• Auth Service, Account Service, Portfolio Service, Property Service, Vendor Service, Plaid API.