Skip to content

๐Ÿ› ๏ธ Development Setup

Purpose: Complete development environment setup guide for the Property Management System - get your development environment ready to build and run the system.

๐ŸŽฏ Prerequisites

Required Software

  • .NET 8 SDK: Latest stable version
  • Node.js 18+: For frontend development
  • PostgreSQL 15+: Database server
  • Redis 7+: Caching and session storage
  • Docker Desktop: Container management
  • Git: Version control
  • IDE: Visual Studio 2022, VS Code, or Rider

System Requirements

  • Operating System: Windows 10/11, macOS 12+, or Ubuntu 20.04+
  • Memory: Minimum 8GB RAM, recommended 16GB+
  • Storage: Minimum 20GB free space
  • Network: Internet connection for package downloads

๐Ÿš€ Quick Start

1. Clone the Repository

git clone https://github.com/nitin27may/property-management.git
cd property-management

2. Install Dependencies

# Install .NET dependencies
dotnet restore

# Install frontend dependencies
cd frontend/web
npm install
cd ../..

3. Start Infrastructure Services

# Start PostgreSQL and Redis using Docker
docker-compose up -d postgres redis

4. Run the Application

# Start the AppHost (orchestrates all services)
dotnet run --project src/AppHost/PropertyManagement.AppHost

๐Ÿ—๏ธ Detailed Setup Guide

1. .NET Development Environment

Install .NET 8 SDK

# Windows (using winget)
winget install Microsoft.DotNet.SDK.8

# macOS (using Homebrew)
brew install dotnet

# Ubuntu/Debian
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-8.0

Verify Installation

dotnet --version
dotnet --list-sdks
dotnet --list-runtimes

Install .NET Tools

# Entity Framework CLI
dotnet tool install --global dotnet-ef

# ASP.NET Core code generator
dotnet tool install --global dotnet-aspnet-codegenerator

# User secrets manager
dotnet tool install --global dotnet-user-secrets

2. Database Setup

PostgreSQL Installation

Option 1: Docker (Recommended)

# Pull PostgreSQL image
docker pull postgres:15

# Run PostgreSQL container
docker run --name property-management-postgres \
  -e POSTGRES_PASSWORD=postgres123 \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_DB=PropertyManagementDB \
  -p 5432:5432 \
  -d postgres:15

Option 2: Local Installation - Windows: Download from PostgreSQL Downloads - macOS: brew install postgresql - Ubuntu: sudo apt-get install postgresql postgresql-contrib

Database Configuration

# Connect to PostgreSQL
psql -U postgres -h localhost

# Create database and schemas
CREATE DATABASE "PropertyManagementDB";

\c PropertyManagementDB

-- Create schemas for microservices
CREATE SCHEMA identity;
CREATE SCHEMA core;
CREATE SCHEMA financial;
CREATE SCHEMA operations;
CREATE SCHEMA communication;
CREATE SCHEMA shared;

-- Grant permissions
GRANT ALL ON SCHEMA identity TO postgres;
GRANT ALL ON SCHEMA core TO postgres;
GRANT ALL ON SCHEMA financial TO postgres;
GRANT ALL ON SCHEMA operations TO postgres;
GRANT ALL ON SCHEMA communication TO postgres;
GRANT ALL ON SCHEMA shared TO postgres;

Redis Installation

Option 1: Docker (Recommended)

# Pull Redis image
docker pull redis:7

# Run Redis container
docker run --name property-management-redis \
  -p 6379:6379 \
  -d redis:7

Option 2: Local Installation - Windows: Download from Redis Downloads - macOS: brew install redis - Ubuntu: sudo apt-get install redis-server

3. Frontend Development Environment

Node.js Installation

# Windows: Download from https://nodejs.org/
# macOS
brew install node

# Ubuntu
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs

Verify Node.js Installation

node --version
npm --version

Install Frontend Dependencies

cd frontend/web
npm install
npm run build
cd ../..

4. Docker Environment

Install Docker Desktop

Verify Docker Installation

docker --version
docker-compose --version

Docker Compose Configuration

Create docker-compose.yml in the root directory:

version: '3.8'

services:
  postgres:
    image: postgres:15
    container_name: property-management-postgres
    environment:
      POSTGRES_PASSWORD: postgres123
      POSTGRES_USER: postgres
      POSTGRES_DB: PropertyManagementDB
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - property-management-network

  redis:
    image: redis:7
    container_name: property-management-redis
    ports:
      - "6379:6379"
    networks:
      - property-management-network

  pgadmin:
    image: dpage/pgadmin4:latest
    container_name: property-management-pgadmin
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@propertymanagement.com
      PGADMIN_DEFAULT_PASSWORD: admin123
      PGADMIN_CONFIG_SERVER_MODE: "False"
      PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False"
    ports:
      - "8080:80"
    depends_on:
      - postgres
    networks:
      - property-management-network

volumes:
  postgres_data:

networks:
  property-management-network:
    driver: bridge

๐Ÿ”ง Configuration

1. Connection Strings

Development Configuration

Create appsettings.Development.json in each service:

{
  "ConnectionStrings": {
    "DefaultConnection": "Host=localhost;Database=PropertyManagementDB;Username=postgres;Password=postgres123;",
    "Redis": "localhost:6379"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  }
}

User Secrets (Development)

# Set user secrets for development
dotnet user-secrets set "ConnectionStrings:DefaultConnection" "Host=localhost;Database=PropertyManagementDB;Username=postgres;Password=postgres123;"
dotnet user-secrets set "ConnectionStrings:Redis" "localhost:6379"

2. Environment Variables

Required Environment Variables

# Database
DATABASE_URL=Host=localhost;Database=PropertyManagementDB;Username=postgres;Password=postgres123;

# Redis
REDIS_URL=localhost:6379

# JWT Settings
JWT_SECRET=your-super-secret-jwt-key-here
JWT_ISSUER=PropertyManagement
JWT_AUDIENCE=PropertyManagementUsers

# External Services
SMTP_HOST=smtp-mail.outlook.com
SMTP_PORT=587
SMTP_USERNAME=your-email@outlook.com
SMTP_PASSWORD=your-password

3. IDE Configuration

Visual Studio 2022

  1. Open the solution file PropertyManagement.sln
  2. Set PropertyManagement.AppHost as the startup project
  3. Configure multiple startup projects if needed

VS Code

  1. Install C# extension
  2. Install .NET Core Tools extension
  3. Open the root folder
  4. Use the integrated terminal for commands

Rider

  1. Open the solution file PropertyManagement.sln
  2. Configure run configurations for AppHost
  3. Set up debugging configurations

๐Ÿš€ Running the Application

1. Start Infrastructure

# Start all infrastructure services
docker-compose up -d

# Verify services are running
docker-compose ps

2. Run the Application

# Navigate to AppHost directory
cd src/AppHost/PropertyManagement.AppHost

# Run the application
dotnet run

3. Access Services

๐Ÿ” Troubleshooting

Common Issues

Port Conflicts

# Check what's using a port
# Windows
netstat -ano | findstr :5000

# macOS/Linux
lsof -i :5000

# Kill process using port
# Windows
taskkill /PID <PID> /F

# macOS/Linux
kill -9 <PID>

Database Connection Issues

# Test PostgreSQL connection
psql -U postgres -h localhost -d PropertyManagementDB

# Check PostgreSQL logs
docker logs property-management-postgres

# Restart PostgreSQL
docker restart property-management-postgres

Redis Connection Issues

# Test Redis connection
redis-cli ping

# Check Redis logs
docker logs property-management-redis

# Restart Redis
docker restart property-management-redis

Development Tips

Hot Reload

# Enable hot reload for development
dotnet watch run --project src/AppHost/PropertyManagement.AppHost

Debugging

  1. Set breakpoints in your code
  2. Use dotnet run with debugging enabled
  3. Attach debugger to running process if needed

Logging

# View application logs
# Check console output for detailed logging
# Use structured logging for better debugging

๐Ÿ“ฑ Frontend Development

1. Start Frontend Development Server

cd frontend/web
npm run dev

2. Frontend Build

# Development build
npm run build

# Production build
npm run build:prod

# Type checking
npm run type-check

# Linting
npm run lint

3. Frontend Testing

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Run E2E tests
npm run test:e2e

๐Ÿงช Testing Environment

1. Unit Testing

# Run all tests
dotnet test

# Run specific test project
dotnet test src/Services/Property/PropertyManagement.Property.Tests

# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage"

2. Integration Testing

# Run integration tests
dotnet test --filter Category=Integration

# Run with test database
dotnet test --environment Testing

3. API Testing

# Use tools like Postman or Insomnia
# Import API collection from docs/api/postman-collection.json
# Set up environment variables for different stages

๐Ÿ“Š Monitoring & Debugging

1. Application Insights

# Enable application insights in development
# Add instrumentation key to configuration
# Monitor performance and errors

2. Health Checks

# Check service health
curl http://localhost:5000/health

# Check individual service health
curl http://localhost:5001/health
curl http://localhost:5002/health

3. Performance Monitoring

# Use dotnet-counters for performance metrics
dotnet-counters monitor --process-id <PID>

# Use dotnet-trace for tracing
dotnet-trace collect --process-id <PID>

๐Ÿ”’ Security Configuration

1. Development Certificates

# Trust development certificates
dotnet dev-certs https --trust

# Check certificate status
dotnet dev-certs https --check

2. JWT Configuration

# Generate secure JWT secret
openssl rand -base64 32

# Set JWT configuration
dotnet user-secrets set "JWT:Secret" "your-generated-secret"
dotnet user-secrets set "JWT:Issuer" "PropertyManagement"
dotnet user-secrets set "JWT:Audience" "PropertyManagementUsers"

๐Ÿ“š Next Steps

1. Explore the Codebase

2. Run Sample Data

# Seed database with sample data
dotnet run --project src/Database/PropertyManagement.Database.Seed

3. Start Development


Environment Ready!

Your development environment is now configured and ready for development. Start with the Architecture Overview to understand the system design, then begin building features!

Need Help?

If you encounter issues during setup, check the troubleshooting section above or refer to the Development Standards for best practices.