How johnny890122/house-rent-591 works
Project Type and Purpose
• This is a full-stack, serverless web application for aggregating and displaying house-rent listings (house-rent-591).
• It includes a React single-page frontend, AWS Lambda–based backend/API functions, a crawler service to scrape or ingest data, and MongoDB as the primary datastore.
Main Components
a. Frontend (frontend/)
• A React SPA (public/index.html + src/*) served as static assets (static.json).
• Interacts over HTTPS with the backend API (via AWS API Gateway or similar).
b. Backend/API Functions (functions/)
• AWS Lambda functions defined in functions/ and configured via package.json & requirements.txt.
• Expose a RESTful interface for CRUD operations on listings, user actions, etc.
c. Data Store (services/mongo.py + data_sources/ + auth/)
• MongoDB Atlas clusters (data_sources/Cluster0/config.json).
• Custom user metadata (auth/custom_user_data.json) and auth providers (auth/providers.json).
d. Crawler Service (services/crawler/)
• A SAM-defined Lambda (app.py + template.yaml + samconfig.toml) that periodically scrapes or ingests listings.
• Reads data_sources configs and writes to MongoDB.
e. Eventing and Scheduling (triggers/ + sync/)
• AWS EventBridge rules (triggers/aws_event_bus.json) or CloudWatch Events to kick off Lambdas (crawler, sync).
• sync/ for one-off or bulk sync tasks.
f. Configuration and Secrets (functions/config.json + services/secrets_manager.py + root_config.json + environments/)
• Environment-specific settings (development.json, production.json, etc.).
• AWS Secrets Manager integration for credentials.
g. Deployment (Procfile, package.json)
• Procfile suggests possible Heroku deployment or AWS EB; package.json scripts orchestrate build and deploy.
Component Relationships and Data Flow
• User’s browser retrieves static React assets (frontend/public) from the CDN or S3.
• React app calls API Gateway endpoints.
• API Gateway routes requests to Lambda functions (functions/).
• Lambdas use services/secrets_manager.py to fetch credentials, then read/write to MongoDB (services/mongo.py).
• On a schedule or event bus trigger, the crawler Lambda runs, scrapes data according to data_sources configs, and writes new listings to MongoDB.
• A separate sync Lambda may aggregate or normalize data on demand.
• Auth flows either use Cognito or a custom solution reading auth/providers.json and custom_user_data.json.
Architectural Patterns and Principles
• Serverless microservices: each Lambda is a focused service (API, crawler, sync).
• Event-driven design: EventBridge (or CloudWatch Events) to decouple crawler/sync triggers from processing logic.
• Clear separation of concerns: Frontend vs. API vs. data ingestion vs. storage.
• Environment-based configuration and secrets management.