Skip to content

thomassandsor/CommunityPortal

Repository files navigation

🌐 Community Portal - Dataverse Starter

A production-ready starter template for building community portals with Microsoft Dataverse integration. Copy this project and have your own portal running in 30-45 minutes!

πŸ“š Documentation

Setup & Configuration

Architecture & Development

Project Status

οΏ½ License

MIT License - see LICENSE file for details.

πŸ’¬ Support

πŸ‘‰ Complete Setup Guide - HOW-TO-GUIDE.md πŸ‘ˆ

The comprehensive guide walks you through every step from start to finish.

🎯 What You Get

  • Modern React App hosted on Netlify (free tier)
  • Secure Authentication via Clerk.dev (work + personal accounts)
  • Microsoft Dataverse Integration for contact management
  • Production-Ready Security with rate limiting, input validation, CORS
  • Easy Customization - Add your own tables, fields, and business logic
  • AI-Friendly Architecture - Clean patterns for AI-assisted development

οΏ½ Prerequisites

  • Microsoft 365 admin access (for Azure App Registration)
  • Power Platform environment (Dataverse access)
  • GitHub account
  • Netlify account (free tier)
  • Clerk account (authentication service)

⚑ Quick Setup Summary

  1. HOW-TO-GUIDE.md - Complete step-by-step instructions
  2. Fork this repository
  3. Set up Azure App Registration (Service Principal)
  4. Create Dataverse Application User
  5. Configure Clerk authentication
  6. Deploy to Netlify with environment variables
  7. Test your portal

⏱️ Setup Time: 30-45 minutes

πŸ›  Tech Stack

  • Frontend: React 18 + Vite + Tailwind CSS
  • Authentication: Clerk.dev (supports Microsoft Entra ID, Google, Outlook, etc.)
  • Backend: Netlify Functions (serverless)
  • Database: Microsoft Dataverse
  • Hosting: Netlify (free tier)

πŸ— Project Structure

CommunityPortal/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ ContactChecker.jsx  # Auto contact management
β”‚   β”‚   β”œβ”€β”€ ContactForm.jsx     # Contact data form
β”‚   β”‚   └── Sidebar.jsx         # Navigation component
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ Landing.jsx         # Public landing page
β”‚   β”‚   β”œβ”€β”€ Welcome.jsx         # Post-login welcome
β”‚   β”‚   β”œβ”€β”€ MyPage.jsx          # User profile/dashboard
β”‚   β”‚   └── Success.jsx         # Confirmation page
β”‚   β”œβ”€β”€ App.jsx                 # Main app with routing
β”‚   β”œβ”€β”€ main.jsx                # Vite entrypoint with ClerkProvider
β”‚   └── index.css               # Tailwind CSS imports
β”œβ”€β”€ functions/
β”‚   β”œβ”€β”€ auth.js                 # Service Principal authentication
β”‚   └── contact.js              # Contact CRUD operations
β”œβ”€β”€ HOW-TO-GUIDE.md             # Complete setup instructions
β”œβ”€β”€ CHAT_MODE_INSTRUCTIONS.md   # AI assistant guide
β”œβ”€β”€ netlify.toml                # Netlify configuration
└── package.json                # Dependencies and scripts

πŸ” Security Features

  • Service Principal Authentication - Secure server-to-server Dataverse access
  • Input Validation & Sanitization - All user input is validated and sanitized
  • Rate Limiting - Prevents API abuse (30 requests/minute per IP)
  • CORS Protection - Proper cross-origin request handling
  • Environment Variable Security - No secrets in frontend code
  • Request Size Limits - Prevents payload overflow attacks

πŸ”§ Development Workflow

Daily Development

# Clone your fork
git clone https://github.com/yourusername/CommunityPortal.git
cd CommunityPortal

# Install dependencies
npm install

# Set up Netlify CLI (one-time)
npm install -g netlify-cli
netlify login
netlify link

# Start development with real environment variables
netlify dev

Build and Deploy

# Test production build locally
npm run build
npm run preview

# Commit and push to trigger Netlify deployment
git add .
git commit -m "Your changes"
git push origin main

🎨 Customization

Add New Contact Fields

  1. Update src/components/ContactForm.jsx with new input fields
  2. Modify functions/contact.js to handle new fields in database operations
  3. Ensure your Dataverse Contact entity has the required fields

Add New Tables

  1. Create new function following functions/contact.js pattern
  2. Create new React components following existing patterns
  3. Add new routes in src/App.jsx
  4. Update navigation components

Styling

  • Uses Tailwind CSS exclusively
  • Customize tailwind.config.js for brand colors
  • All components use consistent utility classes
  • Responsive design with mobile-first approach

⚠️ Environment Variables

Variable Description Example
TENANT_ID Azure AD tenant ID 12345678-1234-1234-1234-123456789abc
CLIENT_ID App registration client ID 87654321-4321-4321-4321-cba987654321
CLIENT_SECRET App registration secret ABC123~XYZ789.secretvalue
DATAVERSE_URL Dataverse environment URL https://yourorg.crm.dynamics.com
VITE_CLERK_PUBLISHABLE_KEY Clerk frontend key pk_live_Y29tbXVuaXR5cG9ydGFs...
CLERK_SECRET_KEY Clerk backend key sk_live_abcdef123456...

⚠️ Security: Never commit secrets to Git. Use Netlify environment variables for production.

🚨 Troubleshooting

Quick Fixes

Authentication Issues:

  • Verify all environment variables are set correctly in Netlify
  • Check Azure App Registration permissions include "Dynamics CRM β†’ user_impersonation"
  • Ensure Application User exists in Dataverse with proper security roles

Build/Deploy Issues:

  • Confirm build command is npm run build and publish directory is dist
  • Check Netlify function logs for specific error messages
  • Redeploy after adding environment variables

Local Development Issues:

  • Use netlify dev instead of npm run dev for full functionality
  • Ensure you're linked to the correct Netlify site with netlify link
  • Verify Netlify CLI is authenticated with netlify status

For detailed troubleshooting: See HOW-TO-GUIDE.md

🎯 Reusability Assessment

βœ… EXCELLENT for Reuse

  • Complete Documentation - Step-by-step setup guide
  • Production Ready - Security, error handling, rate limiting included
  • Free Tier Compatible - Works on free service tiers
  • Modern Architecture - Current best practices
  • AI-Friendly - Clean patterns for AI-assisted development

⚠️ Considerations

  • Microsoft Admin Access Required - Need organizational Azure/O365 admin rights
  • Multiple Service Setup - 4-5 platforms to configure
  • Learning Curve - Moderate technical complexity

Difficulty Level: MODERATE (30-45 minutes for technical users)

πŸ€– AI-Assisted Development

This project is optimized for AI-assisted development:

  1. Reference CHAT_MODE_INSTRUCTIONS.md for AI context
  2. Follow established patterns when adding features
  3. Use semantic search for finding relevant code examples
  4. Extend using the documented patterns and conventions

Example AI Prompts

"Add a new Case table following the Contact pattern"
"Create a search component using existing styling"
"Add phone validation to ContactForm"

οΏ½ Success Stories

After setup, your Community Portal provides:

  • βœ… Secure authentication for work and personal accounts
  • βœ… Automatic contact management with Dataverse
  • βœ… Production-ready security and error handling
  • βœ… Scalable architecture for additional features
  • βœ… Cost-effective deployment on free tiers

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Follow existing code patterns and conventions
  4. Test thoroughly with netlify dev
  5. Update documentation if needed
  6. Submit a Pull Request

πŸ“„ License

MIT License - see LICENSE file for details.

οΏ½ Support


πŸš€ Ready to build your community portal? Start with HOW-TO-GUIDE.md

About

No description, website, or topics provided.

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages