Multifamily Unit Feature Comparison Tool for Investment and Acquisition Analysis.
Feature Analyst V2 is a web-based application that helps investment and acquisition analysts identify rent premiums associated with specific property features across multifamily communities. Built as a Yarn Workspaces monorepo with TypeScript.
Production URL: TBD (will deploy to AWS)
- Frontend: React 18 + TypeScript + Vite + TanStack Table v8
- Backend: Node.js + Express + TypeScript
- Database: PostgreSQL (data warehouse)
- Package Manager: Yarn 3.5.1+ (workspaces)
- Build Tool: Vite (frontend), TSC (backend)
feature-analyst-v2/
├── backend/ # Express API server
│ ├── src/
│ │ ├── routes/ # API endpoints (7 routes)
│ │ ├── services/ # Business logic layer
│ │ ├── repositories/# Data access layer (PostgreSQL)
│ │ └── utils/ # Utilities (CSV export, Census API, etc.)
│ ├── package.json
│ └── tsconfig.json
├── frontend/ # React SPA
│ ├── src/
│ │ ├── components/ # React components (6 main components)
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API client
│ │ ├── types/ # Frontend-specific types
│ │ └── styles/ # CSS stylesheets
│ ├── package.json
│ └── vite.config.ts
├── shared/ # Shared TypeScript types and utilities
│ ├── src/
│ │ ├── types.ts # Domain models, DTOs, API contracts
│ │ └── index.ts
│ └── package.json
├── package.json # Root workspace config
└── tsconfig.json # Root TypeScript config
- Node.js: v22.0.0 or higher
- Yarn: v3.5.1 or higher
- PostgreSQL: v14+ (for data warehouse)
- Clone the repository:
git clone <repository-url>
cd test-apps-feature-analyst-v2- Install dependencies (all workspaces):
yarn install- Set up environment variables:
# Backend environment
cp backend/.env.example backend/.env
# Edit backend/.env with your PostgreSQL credentials- Build all packages:
yarn buildRun both frontend and backend in development mode:
yarn devThis will start:
- Backend API: http://localhost:3001
- Frontend: http://localhost:5173
Or run them individually:
# Backend only
yarn workspace @feature-analyst/backend dev
# Frontend only
yarn workspace @feature-analyst/frontend devRoot-level scripts:
yarn dev- Run both frontend and backend in dev modeyarn build- Build all packagesyarn lint- Lint all packagesyarn type-check- TypeScript type checking across all packagesyarn test- Run tests in all packagesyarn clean- Remove all build artifacts and node_modules
Package-specific scripts:
# Shared package
yarn workspace @feature-analyst/shared build
yarn workspace @feature-analyst/shared type-check
# Backend package
yarn workspace @feature-analyst/backend dev
yarn workspace @feature-analyst/backend build
yarn workspace @feature-analyst/backend test
# Frontend package
yarn workspace @feature-analyst/frontend dev
yarn workspace @feature-analyst/frontend build
yarn workspace @feature-analyst/frontend previewThe backend exposes 7 REST API endpoints:
Retrieve list of communities with optional MSA filter.
Query Params: msaId, limit, offset
Get detailed information for a specific community.
Search units with comprehensive filters (AND logic for features).
Body: SearchFilters (communityIds, features, bedrooms, bathrooms, price, sqft, etc.)
List available features for filtering, sorted by popularity.
Query Params: communityId (optional)
List available metro statistical areas.
Get MSA demographics from US Census Bureau API.
Export filtered units to CSV or JSON.
Body: ExportRequest (filters + format)
The frontend includes 6 main components:
- CommunityBrowser - Browse and select communities
- AdvancedFilterPanel - Comprehensive filter controls
- UnitComparisonTable - Sortable unit data table (TanStack Table)
- PhotoFloorPlanViewer - Image viewer modal/lightbox
- ExportButton - CSV/JSON export controls
- MSAStatisticsPanel - Metro area demographics display
See database-schema.sql for PostgreSQL schema.
Key Tables:
communities- Community/property informationunits- Unit/apartment datafeatures- Feature/amenity definitionsunit_features- Many-to-many relationshipmsas- Metro statistical areas
NODE_ENV=development
PORT=3001
CORS_ORIGIN=http://localhost:5173
# PostgreSQL
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=feature_analyst
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_password
# US Census Bureau API
CENSUS_API_KEY=your_api_key
# Caching
CACHE_TTL_SECONDS=86400
CACHE_ENABLED=trueSee backend/.env.example for full configuration.
The project uses TypeScript 5+ with strict mode enabled across all packages:
- Root tsconfig.json: Base configuration with path aliases
- Backend tsconfig.json: CommonJS modules for Node.js
- Frontend tsconfig.json: ESNext modules for Vite bundler
- Shared tsconfig.json: Library build configuration
Path aliases are configured for clean imports:
@shared/*- Shared package types@backend/*- Backend source files (backend only)@frontend/*or@/*- Frontend source files (frontend only)
- Define types in
shared/src/types.ts - Create API endpoint in
backend/src/routes/ - Implement service in
backend/src/services/ - Create React component in
frontend/src/components/ - Add API call to
frontend/src/services/api.ts - Create hook in
frontend/src/hooks/(optional)
- Linting: ESLint with TypeScript rules
- Formatting: Prettier (auto-format on save)
- Pre-commit hooks: Husky + lint-staged
- Type checking: TypeScript strict mode
Pre-commit hooks will automatically:
- Lint and fix TypeScript files
- Format all code with Prettier
- Check for type errors
# Run all tests
yarn test
# Backend tests
yarn workspace @feature-analyst/backend test
# Frontend tests
yarn workspace @feature-analyst/frontend testBackend will be deployed to AWS ECS (containerized Express app).
Frontend will be deployed to S3 + CloudFront (static site).
PostgreSQL database will be managed separately (existing data warehouse).
- Yarn Workspaces: Share dependencies, simplify versioning
- Shared package: Single source of truth for types
- Independent deployments: Backend and frontend deploy separately
- RESTful endpoints: Standard HTTP methods and status codes
- Relative paths (
/api/*): Works in both dev (proxy) and prod (CloudFront) - Validation: Shared validation logic from
@shared/types
- Repository pattern: Encapsulate database queries
- Service layer: Business logic separate from HTTP routing
- Deduplication: Handle units appearing in multiple data sources
- Create a feature branch
- Make changes following code style guidelines
- Ensure all tests pass:
yarn test - Ensure types are correct:
yarn type-check - Commit (pre-commit hooks will run automatically)
- Create pull request
Internal tool - proprietary.
For issues or questions, contact the Investment & Acquisition Analytics Team.