Skip to content

Developer Overview

MTL Rent is a pnpm monorepo with the following structure:

mtl-rent/
├── packages/
│   └── database/          # @mtl-rent/database — Drizzle ORM + PostgreSQL
├── services/
│   ├── api/               # @mtl-rent/api — Fastify 5 REST API (port 3001)
│   ├── web/               # @mtl-rent/web — Next.js 16 frontend (port 3000)
│   ├── admin/             # @mtl-rent/admin — Fastify API + React SPA admin (port 3002)
│   └── scraper/           # @mtl-rent/scraper — Kijiji scraper + BullMQ pipeline
└── docs/                  # @mtl-rent/docs — VitePress (port 5174)

Services

ServicePackagePortTech
Database@mtl-rent/databaseDrizzle ORM, PostgreSQL
API@mtl-rent/api3001Fastify 5, JWT, Swagger
Web@mtl-rent/web3000Next.js 16, React 19, TailwindCSS 4, shadcn/ui, next-intl (FR/EN)
Admin@mtl-rent/admin3002Fastify 5 JSON API + React SPA (Vite, Tailwind 3, shadcn)
Scraper@mtl-rent/scraperBullMQ, Playwright, Node.js
Docs@mtl-rent/docs5174VitePress

Infrastructure

  • PostgreSQL — Homebrew, mtl_rent database
  • Redis — Docker Compose (docker compose up -d), used by BullMQ job queue
  • Cloudflare tunnel — exposes all services to public URLs

Key Patterns

  • Shared database package — schema and connection logic shared between API, admin, and scraper
  • Drizzle ORM — TypeScript-first, schema in code, migration-based
  • Fastify routes — one file per resource in services/api/src/routes/
  • JWT auth — httpOnly cookies, requireAuth / requireLandlord middleware
  • Central API clientservices/web/lib/api.ts with typed methods
  • TanStack Query — all data fetching on the frontend
  • Feature-grouped componentscomponents/listings/, components/map/, etc.
  • Bilingual (FR/EN) — next-intl with [locale] route prefix, messages/en.json + messages/fr.json
  • pm2 — all services run via pm2, not pnpm dev directly

Cloudflare Tunnel

The dev script starts a Cloudflare tunnel exposing all services:

Public URLLocal Service
https://mtl-rent.fesenko.netlocalhost:3000 (Web)
https://mtl-rent-api.fesenko.netlocalhost:3001 (API)
https://mtl-rent-admin.fesenko.netlocalhost:3002 (Admin)
https://mtl-rent-docs.fesenko.netlocalhost:5174 (Docs)

Tunnel config: ~/.cloudflared/config-mtl-rent.yml