๐ ๏ธ 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¶
2. Install Dependencies¶
# Install .NET dependencies
dotnet restore
# Install frontend dependencies
cd frontend/web
npm install
cd ../..
3. Start Infrastructure Services¶
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¶
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¶
Install Frontend Dependencies¶
4. Docker Environment¶
Install Docker Desktop¶
- Windows/macOS: Download from Docker Desktop
- Ubuntu: Follow Docker Installation Guide
Verify Docker Installation¶
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¶
- Open the solution file
PropertyManagement.sln - Set
PropertyManagement.AppHostas the startup project - Configure multiple startup projects if needed
VS Code¶
- Install C# extension
- Install .NET Core Tools extension
- Open the root folder
- Use the integrated terminal for commands
Rider¶
- Open the solution file
PropertyManagement.sln - Configure run configurations for AppHost
- 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¶
- Aspire Dashboard: http://localhost:17167
- API Gateway: http://localhost:5000
- Frontend: http://localhost:3000
- pgAdmin: http://localhost:8080
- PostgreSQL: localhost:5432
- Redis: localhost:6379
๐ 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¶
- Set breakpoints in your code
- Use
dotnet runwith debugging enabled - 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¶
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¶
- Review Architecture Overview
- Understand Database Design
- Explore API Reference
2. Run Sample Data¶
3. Start Development¶
- Pick a service to work on
- Review existing code and patterns
- Follow Development Standards
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.