How funducode/leasemitra works
Project type and purpose
• MicroRealEstate is a full-stack, microservice-based SaaS for landlords to manage properties, tenants, rent payments, document generation and collaboration.
• The README confirms a Docker-Compose setup orchestrating multiple Node.js/TypeScript services, UIs, a CLI, a backup folder, and monitoring/logging pipelines.
File structure
• Top-level “services” folder contains independent microservices: api, authenticator, gateway, emailer, pdfgenerator, resetservice, tenantapi, and a shared “common” library for Mongo/Redis clients, middlewares, utils, collections.
• “webapps” folder houses two Next.js-based frontends (landlord, tenant) plus a shared React component library (commonui).
• A “cli” subproject provides command-line utilities.
• Docker manifests: docker-compose.yml, plus per-environment microservices compose files.
• A “backup” folder for MongoDB dumps.
• Monitoring: config/logstash, docker-compose.monitoring.yml.
• E2E tests: Cypress in “e2e” folder.
README for additional insights
• The system runs behind Docker-Compose, exposing landlord and tenant apps under /landlord and /tenant.
• MongoDB is the primary datastore (“mredb”), Redis for caching/session, S3 for PDF/document storage, SMTP for email.
• Services communicate over REST (or HTTP) within a single Docker network.
Components & interactions
a. Main components
• Client UIs: Landlord Next.js, Tenant Next.js, CLI.
• API Gateway service (services/gateway).
• Microservices:
• Authenticator – handles login/registration/jwt.
• TenantAPI – tenant-specific endpoints.
• Core API – business logic: contracts, rents, tenants, properties.
• ResetService – password reset workflows.
• Emailer – templates, SMTP integration.
• PDFGenerator – headless Chrome PDF engine, S3 upload.
• Shared library (Common) – internal module used by each service for Mongo, Redis, configuration, error handling.
• Data stores & external services:
• MongoDB cluster.
• Redis cache/session.
• AWS S3 (or S3-compatible) for storing PDFs.
• SMTP server for outbound mail.
• Logstash/Elasticsearch/Kibana (ELK) for logs.
• Monitoring stack (Prometheus/Grafana – if included).
b. Relationships
• UIs → Gateway (HTTP/HTTPS).
• Gateway → each microservice (HTTP/REST).
• Services call Common library internally to connect to Mongo/Redis.
• Core API may invoke Emailer and PDFGenerator via HTTP for document/email workflows.
• ResetService invokes Emailer for reset tokens.
• Emailer sends to SMTP.
• PDFGenerator stores in S3 and returns file URLs.
• All services push logs to Logstash.
• Backup container connects to Mongo for dumps.
c. Architectural patterns & principles
• Microservices: each bounded context in its own container.
• Shared library (Common) to DRY database/connectivity code.
• API Gateway centralizes routing, CORS, authentication JWT validation.
• CI/CD flows via GitHub Actions.
• Docker-Compose for local/production deployment profiles.
• Next.js server-side rendering (SSR) for UIs.
d. Relevant technologies
• Node.js, TypeScript/JavaScript, Next.js, Yarn 3 workspaces.
• MongoDB, Redis, S3, SMTP.
• Cypress for E2E, Jest for unit tests.
• Logstash pipeline config for logging.
Detailed elements to capture
• Bounded contexts: Authentication, TenantAPI, Core API, ResetService, Emailer, PDFGenerator.
• Shared “common” library usage.
• Deployment layers: Docker-Compose base + per-environment ymls.
• Testing layer: Cypress E2E hitting Gateway → services.
• Monitoring/logging pipeline alongside services.