A comprehensive property management application for KH Rentals with digital signature integration, property management, and tenant portal features.
- Property management and tracking
- Digital signature integration with Evia Sign
- Agreement management and templating
- Tenant (rentee) portal for self-service
- Utility billing and tracking
- Maintenance request management
- Staff dashboard with role-based access controls
- SQL Server backend integration
-
Clone the repository
-
Install dependencies:
npm install
-
Set up your environment variables by running:
npm run setup-env
This will guide you through setting up your API endpoint and local environment.
Alternatively, manually create a
.envfile based on this template:VITE_EVIA_SIGN_CLIENT_ID=your_evia_client_id VITE_EVIA_SIGN_CLIENT_SECRET=your_evia_client_secret VITE_API_ENDPOINT=your_api_endpoint VITE_WEBHOOK_URL=your_webhook_url -
Start the development server:
npm run dev
The application uses the following strategy to load environment variables:
- First attempts to read from
window._env_(for production) - Falls back to Vite's
import.meta.env - Finally checks
process.env(for Node.js environment)
The npm run generate-env-config script automatically generates the public/env-config.js file from your .env file. This script is run automatically when you start the development server or build the application.
- Never commit real API keys or sensitive tokens to the repository.
- The
public/env-config.jsfile is listed in.gitignoreand should never be committed. - Use
public/env-config.example.jsas a template to create your ownpublic/env-config.jsfile. - In production, environment variables should be set in your hosting environment (e.g., Azure App Settings).
- Copy
public/env-config.example.jstopublic/env-config.js - Add your local development values
- For development with the email system:
- Use the test environment
- Configure environment variables in your
.envfile
If you receive a "SendGrid API key found in commit" error when trying to commit, check for:
- API keys in
public/env-config.js(this file should not be committed) - Hard-coded keys in any JavaScript files
- Keys in sample or example files
For email delivery, keep TWILIO_SENDGRID_API_KEY or SENDGRID_API_KEY on the server only. Do not expose them through any VITE_ variable.
Start the development server:
npm run devBuild for production:
npm run buildThe application is configured for deployment to Azure Web App using GitHub Actions. The deployment workflow is defined in .github/workflows/master_khrental.yml.
Ensure the following environment variables are set in your Azure Web App:
VITE_EVIA_SIGN_CLIENT_IDVITE_EVIA_SIGN_CLIENT_SECRETVITE_API_ENDPOINTVITE_WEBHOOK_URL
- All environment variables are correctly set in Azure
- GitHub Actions workflow is properly configured
- Deployment artifacts are properly generated
- Client-side routing is properly configured in web.config
- Fixed 400 Bad Request errors when loading agreements
- Removed references to a non-existent
processedcontentdatabase column - Added better error handling to display load failures
- Note: To properly support template content processing, add a
processedcontentcolumn to your applicationagreementstable if it is still missing
- Added URL encoding for path parameters that contain HTML content
- Fixes "431 Request Header Fields Too Large" errors when navigating with large HTML content
- Prevents infinite loops when attempting to navigate to URLs with embedded agreement content
- Fixed URL handling in env-config.js to properly process relative paths starting with "/"
- This resolves console loop errors when navigating to routes like "/dashboard"
- Implementation: SafeURL constructor now handles all relative paths by prepending window.location.origin
-
Console Loop Errors with URLs:
- Check if env-config.js has the latest URL handling fixes
- Ensure all relative URLs have proper protocols added
-
Authentication Issues:
- Verify the API endpoint is correctly set
- Check user permissions in the application database and auth records
-
Deployment Failures:
- Verify GitHub Actions workflow file is up to date
- Check Azure configuration in the Azure Portal
MIT