Property Management Network

🏠 Property Management Network

The all-in-one property-management platform for independent landlords.
Properties, tenants, rent, maintenance, leases, expenses, AI insights, and integrations β€” in one clean dashboard.

Next.js TypeScript PostgreSQL License

--- ## ✨ Overview Property Management Network replaces the spreadsheet-and-WhatsApp chaos that most small landlords live with. It gives a solo landlord or a small team a single source of truth for their whole portfolio β€” and the automation, AI, and integrations to run it hands-off. Everything is **multi-tenant and team-aware**: each landlord operates on their own isolated portfolio, and Landlord/Lifetime accounts can invite teammates with scoped roles. ### 🧰 What you can do **Core operations** - 🏒 **Properties & units** β€” manage your whole portfolio with live occupancy tracking and a map view (addresses are auto-geocoded). - πŸ‘₯ **Tenants** β€” profiles, lease history, payment records, and a private **tenant portal** (token-based, no login required). - πŸ’΅ **Rent tracking** β€” log payments, send **Stripe** payment links, and auto-mark balances overdue with automatic late fees. - πŸ”§ **Maintenance** β€” full status workflow (Open β†’ In Progress β†’ Resolved), with tenant-submitted requests from the portal. - πŸ“„ **Leases** β€” expiry countdowns, automated 60/30/7-day email alerts, and **e-signature** (DocuSign / Dropbox Sign). - 🧾 **Expenses** β€” categorized logging with recurring-expense support. - πŸ—‚οΈ **Documents** β€” a per-property file vault stored in object storage and served through an auth-gated route. - πŸ”Ž **Inspections & vendors** β€” move-in/out/routine inspection checklists and a vendor directory. - πŸ“Š **Reports & exports** β€” portfolio analytics with CSV export. - πŸ“… **Calendar** β€” an in-app calendar plus a read-only **iCal (ICS) feed** you can subscribe to. **Automation & AI** - πŸ€– **AI features** β€” recommendations, predictions, impact tracking, and a portfolio assistant (OpenAI). *(Pro and up.)* - βœ‰οΈ **Automated email** β€” rent reminders, overdue notices, and lease-expiry alerts, plus a configurable **follow-up engine**. - 🎨 **White-label branding** β€” put your own brand on the tenant portal. *(Landlord / Lifetime.)* - πŸ›‘οΈ **Admin dashboard** β€” superadmin tools with a full audit log. --- ## πŸ”Œ Integrations & developer platform | Capability | Details | |---|---| | 🌐 **Public REST API** | Versioned `/api/v1` endpoints (properties, tenants, payments, maintenance, webhooks) authenticated with Bearer **API keys**. See `/api-docs`. | | πŸͺ **Outbound webhooks / Zapier** | Subscribe to events (`tenant.created`, `payment.paid`, `maintenance.updated`, …). Deliveries are **HMAC-signed**, retried with backoff, and Zapier-compatible via the REST-hook subscribe/unsubscribe pattern. | | πŸ’³ **Payments** | Stripe (subscriptions + rent payment links). | | πŸ“š **Accounting sync** | One-way push of income & expenses to **QuickBooks Online** or **Xero** (OAuth). | | ✍️ **E-signature** | Send leases for signature via **DocuSign** or **Dropbox Sign**. | | πŸ”‘ **Auth** | Email/password and Google OAuth (Better Auth). | Every integration is env-gated: unconfigured providers show a clean β€œnot configured” state instead of a broken button. --- ## πŸ’³ Plans & pricing | Plan | Price | Highlights | |------|-------|------------| | πŸ†“ **Starter** | Free | 1 property, 3 tenants, no AI | | πŸš€ **Pro** | $29/mo | 10 properties, unlimited tenants, AI (50 calls/mo) | | πŸ† **Landlord** | $59/mo | Unlimited properties, team access, white-label, AI (200/mo) | | ♾️ **Lifetime** | $199 once | Everything in Landlord, forever | Billing runs through **Stripe**. Products/prices are resolved by stable lookup keys and auto-created on first checkout, so going live is just an API-key swap β€” no price IDs to wire up. --- ## 🧱 Tech stack | Layer | Technology | |-------|------------| | Framework | Next.js 16.2 (App Router, TypeScript, React 19) | | Styling | Tailwind CSS + Geist | | Database | PostgreSQL via **Drizzle ORM** | | Auth | Better Auth (email/password + Google OAuth) | | Object storage | DigitalOcean Spaces (S3-compatible, CDN, auth-gated) | | Payments | Stripe | | AI | OpenAI (`gpt-4o-mini`) | | Email | SMTP (SMTP2GO) | | Maps | Leaflet + OpenStreetMap / Nominatim geocoding | | Cron | DigitalOcean Functions (scheduled triggers) | | Deploy | DigitalOcean App Platform (Docker image via DOCR) | --- ## πŸš€ Getting started ### 1. Clone & install ```bash git clone cd property-management-network npm install ``` ### 2. βš™οΈ Configure environment Copy the template and fill in your own values: ```bash cp .env.example .env.local ``` `.env.local` holds your database URL, auth secret, and credentials for Stripe, OpenAI, SMTP, and object storage. **Every variable is documented inline in `.env.example`**, and the full production reference lives in **[DIGITALOCEAN.md](DIGITALOCEAN.md)**. Never commit real secrets. ### 3. πŸ—„οΈ Run migrations The schema is managed by Drizzle (see `drizzle.config.ts`). Point `DATABASE_URL` at your PostgreSQL instance, then: ```bash npm run db:migrate # apply migrations npm run db:generate # regenerate after schema changes npm run db:push # push schema directly (quick local prototyping) ``` ### 4. πŸ”Œ Wire up services (as needed) - **Stripe** β€” set the API keys, then add a webhook at `https://yourdomain.com/api/stripe/webhook` for `checkout.session.completed`, the `customer.subscription.*` events, `invoice.payment_failed`, and `payment_intent.succeeded`. - **Email** β€” verify a sending domain with your SMTP provider (e.g. SMTP2GO) and set the `SMTP_*` + `EMAIL_FROM` vars. - **Google / OpenAI / accounting / e-sign** β€” each is optional and activates once its env vars are present. ### 5. ▢️ Run locally ```bash npm run dev ``` Open **[http://localhost:3000](http://localhost:3000)**. ### 6. 🚒 Deploy The repo ships a production `Dockerfile` (Next.js standalone), an App Platform spec at [`.do/app.yaml`](.do/app.yaml), DO Functions cron under [`functions/`](functions/), and a `/api/health` probe. Follow **[DIGITALOCEAN.md](DIGITALOCEAN.md)** for the full walkthrough. --- ## πŸ—‚οΈ Project structure ``` app/ β”œβ”€β”€ (marketing)/ # Landing page, pricing, legal, API docs β”œβ”€β”€ (auth)/ # Login, signup, password reset β”œβ”€β”€ (dashboard)/ # Auth-gated app (properties, tenants, rent, maintenance, β”‚ # leases, expenses, inspections, vendors, reports, β”‚ # calendar, AI, onboarding, settings) β”œβ”€β”€ (admin)/ # Superadmin dashboard β”œβ”€β”€ api/ β”‚ β”œβ”€β”€ v1/ # 🌐 Public REST API (Bearer API keys) β”‚ β”œβ”€β”€ webhooks + cron/ # πŸͺ Outbound webhook delivery + scheduled jobs β”‚ β”œβ”€β”€ stripe/ # πŸ’³ Billing + payment links + provider webhooks β”‚ β”œβ”€β”€ integrations/ # πŸ“š QuickBooks / Xero OAuth β”‚ β”œβ”€β”€ esign/ # ✍️ DocuSign / Dropbox Sign β”‚ └── … # Properties, tenants, rent, maintenance, documents, AI └── tenant-portal/[token]/ # Public tenant portal (no login) lib/ β”œβ”€β”€ db/ # Drizzle schema, queries, migrations β”œβ”€β”€ auth.ts account.ts # Better Auth + team/account scoping β”œβ”€β”€ storage.ts # Object storage (Spaces) with local-disk dev fallback β”œβ”€β”€ webhooks/ # Event catalog, HMAC signing, SSRF guard, delivery β”œβ”€β”€ stripe/ # Billing clients & plans β”œβ”€β”€ accounting/ esign/ # QuickBooks/Xero & DocuSign/Dropbox Sign β”œβ”€β”€ ai/ # OpenAI client + prompts β”œβ”€β”€ email/ # SMTP (SMTP2GO) client + HTML templates └── validations/ # Zod schemas for all entities ``` --- ## πŸ—„οΈ Data model & isolation The schema spans **~30 tables** managed via Drizzle ORM, grouped roughly as: - **Core** β€” `profiles`, `properties`, `units`, `tenants`, `rent_payments`, `maintenance_requests`, `leases`, `expenses`, `documents`, `inspections`, `vendors` - **Automation & AI** β€” `notifications`, `follow_up_rules`, `follow_up_log`, `ai_recommendations`, `ai_predictions`, `activity_log`, `usage_events` - **Accounts & platform** β€” `account_members`, `api_keys`, `app_settings`, `admin_audit_log`, `accounting_connections`, `signature_requests`, `webhook_endpoints`, `webhook_deliveries` - **Auth (Better Auth)** β€” `user`, `session`, `account`, `verification` > πŸ” **Tenancy is enforced in the application layer.** Every query scopes by the resolved **account owner id** (team-aware), never the raw session user. There is no database RLS, so this scoping must be preserved on every new route β€” see `lib/account.ts` (`getEffectiveOwnerId`). --- ## ⏰ Scheduled jobs Cron is driven by DigitalOcean Functions hitting `CRON_SECRET`-protected endpoints (`functions/project.yml`): | Job | Schedule (UTC) | What it does | |-----|----------------|--------------| | `daily` | 09:00 | Rent reminders, overdue marking, 60/30/7-day lease-expiry alerts | | `late-fees` | 08:00 | Applies late fees past the grace period | | `follow-ups` | 10:00 | Runs each account's active follow-up rules | | `webhooks` | every 5 min | Retries pending outbound webhook deliveries | --- ## πŸ”’ Security highlights - πŸ”‘ API keys are stored as SHA-256 hashes; the plaintext is shown once. - πŸͺ Webhook payloads are **HMAC-SHA256 signed** (`X-PMN-Signature`); endpoint URLs are **SSRF-guarded** (private/loopback/metadata ranges blocked). - πŸ“ Uploaded files are served only through an auth-gated route; object storage is required in production (uploads **fail loud** rather than silently hit ephemeral disk). - πŸ›’οΈ Verified TLS to Postgres in production (`DATABASE_SSL=require` + CA). - ⏱️ Cron endpoints use a constant-time bearer check and fail closed. --- ## πŸ“œ License **Proprietary β€” Β© 2026 Property Management Network. All rights reserved.** This source code is proprietary and confidential. No license or permission is granted to use, copy, modify, merge, publish, distribute, sublicense, or sell any part of it without the prior written consent of the copyright holder. See [LICENSE](LICENSE).