This is a Power Platform Code App built with React and TypeScript that provides full CRUD functionality for managing contacts in Dataverse.
.
├── src/ # Source code
│ ├── components/ # React components
│ │ └── Contacts/ # Contact management components
│ │ ├── ContactsList.tsx # Table view of contacts
│ │ ├── ContactForm.tsx # Add/Edit contact form
│ │ ├── ContactDetail.tsx # Detail view modal
│ │ ├── SearchBar.tsx # Search and filter functionality
│ │ ├── ContactsList.css # Contacts list styling
│ │ ├── ContactForm.css # Contact form styling
│ │ ├── ContactDetail.css # Detail view styling
│ │ └── SearchBar.css # Search bar styling
│ ├── pages/ # Page-level components
│ │ ├── ContactsPage.tsx # Main page orchestrator
│ │ └── ContactsPage.css # Main page styling
│ ├── hooks/ # Custom React hooks
│ │ └── useContacts.ts # Contacts management hook
│ ├── Models/ # TypeScript interfaces and types
│ │ └── Contact.ts # Contact data models
│ ├── Services/ # API services
│ │ └── ContactService.ts # Dataverse API service
│ ├── utils/ # Utility functions
│ │ ├── powerPlatformInit.ts # Power Platform initialization
│ │ └── mockData.ts # Mock data for development
│ ├── styles/ # Global stylesheets
│ │ ├── App.css # App styling
│ │ └── index.css # Global styles
│ ├── App.tsx # Root component
│ └── main.tsx # React entry point
├── public/ # Static assets
├── .power/ # Power Platform configuration
│ └── schemas/ # Generated schemas
├── dist/ # Production build output (generated)
├── node_modules/ # Dependencies (generated)
├── index.html # HTML template
├── vite.config.ts # Vite build configuration
├── tsconfig.json # TypeScript configuration
├── tsconfig.node.json # TypeScript config for Vite
├── package.json # Project dependencies and scripts
├── .env.local # Environment variables (local)
├── .eslintrc.json # ESLint configuration
├── .gitignore # Git ignore rules
├── power.config.json # Power Platform project config
├── README.md # This file
└── LICENSE # MIT License
- src/components: Reusable React UI components
- src/Services: API layer for Dataverse communication
- src/hooks: Custom React hooks for shared logic
- src/utils: Helper functions and mock data
- .power: Power Platform-generated metadata
- dist: Production-ready build (created by
npm run build)
- View Contacts - Display all contacts in a table format
- Create Contacts - Add new contacts with form validation
- Edit Contacts - Update existing contact information
- Delete Contacts - Remove contact records
- Search Contacts - Real-time search by name or email
- Detail View - Modal with full contact information
- Responsive Design - Works on desktop, tablet, and mobile
- Node.js 16+
- npm or yarn
- Power Platform CLI installed:
npm install -g pac - Power Platform environment with Dataverse
# Navigate to the app directory
cd solutions/apps
# Install dependencies
npm install# Start development server (runs on http://localhost:3000)
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewThe app reads configuration from power.config.json:
{
"environmentId": "0f5282a0-f08f-edf1-b174-449fed9eec06",
"connectionReferences": {
"shared_commondataserviceforapps": {
"apiId": "shared_commondataserviceforapps",
"displayName": "Dataverse"
}
}
}Create a .env.local file for development:
VITE_API_URL=http://localhost:8080
VITE_ENVIRONMENT_URL=https://your-environment.crm.dynamics.comCause: The dev server cannot connect to the Power Platform backend.
Solutions:
-
Running in Power Apps (Recommended):
- Push the app to Power Platform using PAC CLI:
pac code push - The app will automatically use the Power Platform authentication context
- Push the app to Power Platform using PAC CLI:
-
Local Development:
- Start the PAC connection proxy:
pac code run(in another terminal) - This starts the proxy at
http://localhost:8080 - The Vite dev server will forward API requests through this proxy
- Start the PAC connection proxy:
-
Error: util._extend deprecated:
- This is a deprecation warning from the http-proxy library
- It's not critical and can be safely ignored
- The app will still function properly
- Check that contacts exist in your Dataverse environment
- Verify you have read access to the contacts table
- Check browser console for error messages
- Ensure the environment URL is correct in power.config.json
- If getting 401 errors, the Power Platform authentication context is not available
- Make sure the app is running within the Power Apps environment
- Check that your user has appropriate permissions in Dataverse
// Get all contacts
ContactService.getContacts({ orderby: 'lastname asc' })
// Get single contact
ContactService.getContact(contactId)
// Create contact
ContactService.createContact({ firstname, lastname, email })
// Update contact
ContactService.updateContact({ contactid, ...data })
// Delete contact
ContactService.deleteContact(contactId)
// Search contacts
ContactService.searchContacts('john')npm run buildThis creates a production-optimized build in the dist/ folder.
# Build the app
npm run build
# Push to Power Platform
pac code pushThe app will be deployed to your Power Platform environment and can be accessed through the Power Apps portal.
- Hot Module Replacement: Changes to components automatically reload without losing state
- TypeScript: Full type safety for models and services
- ESLint: Code quality checks with
npm run lint - Path Aliases: Use
@components,@services, etc. for cleaner imports
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
- Mobile browsers (iOS Safari, Chrome Mobile)
- Contacts are paginated (top 100 by default)
- Search is performed client-side after fetching
- Consider adding server-side pagination for large datasets
- CSS is optimized with minimal dependencies
We welcome contributions! Here's how to get involved:
-
Fork the repository on GitHub
- Click the "Fork" button in the top-right corner of the repository
- This creates a copy of the repo under your GitHub account
-
Clone your fork
git clone https://github.com/<your-username>/powerplatform-codeapps.git cd powerplatform-codeapps
-
Add upstream remote (to sync with original repo)
git remote add upstream https://github.com/nipaul/powerplatform-codeapps.git
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Follow TypeScript strict mode rules
- Add proper types for all variables and function parameters
- No
anytypes unless absolutely necessary
-
Code Quality
- Run
npm run lintto check code quality - Follow existing code patterns and conventions
- Keep functions small and focused
- Run
-
Component Development
- Create reusable functional components
- Use React Hooks for state management
- Include proper JSDoc comments for complex logic
- Add prop types/interfaces
-
Testing
- Test with both mock data and real Dataverse
- Verify responsive design on mobile/tablet
- Test error scenarios
-
Commit Messages
- Use clear, descriptive commit messages
- Reference issues when relevant:
Fix: #123 description - Examples:
feat: Add contact export functionalityfix: Correct email validation regexdocs: Update README with new featuresrefactor: Simplify ContactService methods
-
Keep your branch updated
git fetch upstream git rebase upstream/main
-
Push your changes
git push origin feature/your-feature-name
-
Create a Pull Request
- Go to your fork on GitHub
- Click "New Pull Request"
- Select
mainas the base branch - Fill in the PR title and description:
- What changes you made
- Why the changes are needed
- How to test the changes
- Any relevant issue numbers
-
Code Review
- Respond to feedback from maintainers
- Make requested changes by pushing to the same branch
- Keep discussions respectful and constructive
- The PR will be merged once approved
- Features: New contact properties, bulk operations, export to Excel
- UI/UX: Improved styling, accessibility improvements, responsive design
- Documentation: Guides, troubleshooting, code examples
- Performance: Optimization, caching, data loading improvements
- Bug Fixes: Found a bug? Create an issue and submit a fix
Found a bug? Create an issue with:
- Clear description of the problem
- Steps to reproduce
- Expected behavior vs actual behavior
- Your environment (OS, Node version, browser)
- Screenshots if applicable
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License Summary:
- ✅ You can use this for commercial and private purposes
- ✅ You can modify and distribute the code
- ✅ You must include the original license and copyright notice
- ❌ The authors are not liable for any issues or damages
For the complete license text, see LICENSE
For issues with:
- Power Platform: Check Power Platform documentation
- React: Visit React documentation
- TypeScript: Check TypeScript handbook