Power Apps Code Apps — Google-Style Search Demo
A complete, production-ready example of a Power Apps code app with a Google-style search UI. Built with React, TypeScript, and Vite — deployed inside Power Platform while maintaining full code-first developer experience.
What Are Power Apps Code Apps?
Code apps let you build custom web applications using your own frontend stack (React, Vue, Svelte, etc.), develop locally with standard tooling, and run them on Power Platform's managed runtime. You get:
- ✅ True code-first development (VS Code, npm, ESLint, tests)
- ✅ Platform identity, connectors, and governance controls built-in
- ✅ Environment strategy, DLP policies, and ALM discipline from day one
- ✅ No need to build your own hosting or authentication infrastructure
Official docs: Power Apps Code Apps Overview
When Does This Model Make Sense?
- You need a custom UI that goes beyond what Canvas or Model-Driven apps offer
- Your team wants source control and CI/CD from the start
- You need to combine developer velocity with enterprise governance
- You want a single deployment model across Dev → Test → Prod instead of ad-hoc hosting
Trade-offs to Consider
| Consideration | Detail |
|---|---|
| Not zero-process | Without ALM discipline, deployments become fragile fast |
| Feature maturity | Some scenarios still require design workarounds |
| Security is your job | CSP, connector scopes, and identity boundaries must be explicitly planned |
| Licensing | Validate cost and access model before broad rollout |
Prerequisites
Before you start, make sure you have:
- Power Platform environment with code apps enabled
- Node.js LTS (18.x or later)
- Power Apps CLI (PAC) — install via:
dotnet tool install --global Microsoft.PowerApps_CLI - A non-default solution strategy for ALM (avoid the default solution)
Step-by-Step Setup
1. Clone the Repository
git clone https://git.lago.dev/Lago/power-apps-codeapps-blog.git
cd power-apps-codeapps-blog
2. Install Dependencies
npm install
This installs React 19, TypeScript, Vite 7, and the @microsoft/power-apps package.
3. Authenticate with Power Platform
pac auth create
Follow the prompts to sign in to your Microsoft 365 / Power Platform tenant.
4. Select Your Target Environment
pac env select --environment <your-environment-id>
⚠️ Important: Always use the exact environment you plan to deploy into. Many issues come from pushing to the wrong one.
Find your environment ID in the Power Platform Admin Center.
5. Initialize the Code App Metadata
pac code init --displayname "Google Search Demo"
This creates the power.config.json file that links your local project to Power Platform.
6. Run Local Development
npm run dev
Opens at http://localhost:5173 by default. The app hot-reloads as you edit.
💡 Tip: Keep your browser profile aligned with your tenant authentication context to avoid confusing auth behavior during local runs.
7. Build and Push to Power Platform
npm run build
pac code push
After deployment:
- Open your target environment in make.powerapps.com
- Find your app under Apps
- Share it with users and assign security roles
8. Test with Non-Admin Users
Before rolling out broadly, validate that regular users (non-admin) can access and use the app correctly.
Project Structure
power-apps-codeapps-blog/
├── public/
│ └── vite.svg
├── src/
│ ├── assets/
│ │ └── react.svg
│ ├── App.css ← All styles (Google dark theme)
│ ├── App.tsx ← Main search UI component
│ ├── index.css ← Global reset styles
│ └── main.tsx ← React entry point
├── index.html
├── package.json
├── tsconfig.json
└── vite.config.ts
The UI: What You're Getting
The demo implements a Google-style search interface with:
- 🔍 Search box with focus ring animation
- 📄 Search results list with title, URL, and description
- 🌙 Dark mode by default
- 📱 Responsive layout
- 🦎 "CrotolamoSearch" branding as a demo logo
The component is entirely dummy data — no real search engine. Replace dummyResults in App.tsx with your actual Dataverse queries, Power Automate calls, or custom API integrations.
Connecting to Real Data
The @microsoft/power-apps package provides the runtime SDK. Example pattern:
import { powerPlatform } from "@microsoft/power-apps";
const client = powerPlatform.getClient();
// Use client to call Dataverse APIs, connectors, etc.
For authentication patterns using Entra ID (Azure AD) client credentials, see:
Best Practices for Production
- Use solution-based ALM from day one — avoid default solution chaos
- Pin toolchain versions in CI — Node, PAC, and package versions should be explicit in
package.jsonandpackage-lock.json - Treat CSP as production configuration — every source allow-list entry needs a clear reason
- Adopt read-first, write-later rollout — safer adoption and easier troubleshooting
- Instrument early — track failures, latency, and usage before scaling
Common Mistakes to Avoid
- ❌ Deploying "wherever it works" instead of following environment discipline
- ❌ Treating security headers and CSP as optional
- ❌ Introducing write operations before observability is in place
- ❌ Mixing identity assumptions between local dev and production
Official References
| Resource | URL |
|---|---|
| Code Apps Overview | https://learn.microsoft.com/en-us/power-apps/developer/code-apps/overview |
| Create from Scratch | https://learn.microsoft.com/en-us/power-apps/developer/code-apps/how-to/create-an-app-from-scratch |
| Architecture | https://learn.microsoft.com/en-us/power-apps/developer/code-apps/architecture |
| ALM Guide | https://learn.microsoft.com/en-us/power-apps/developer/code-apps/how-to/alm |
| Content Security Policy | https://learn.microsoft.com/en-us/power-apps/developer/code-apps/how-to/content-security-policy |
| Power Platform CLI (PAC) | https://learn.microsoft.com/en-us/power-apps/developer/cli/introduction |
Related Articles on That's A Good Question
- CVE-2026-20960: What Microsoft Power Apps Admins Need to Do Now
- Azure Functions + Dataverse: Architecture, Value, and Trade-offs
- Power Automate Error Handling: Patterns That Survive Production
- Dataverse MCP Server Setup Guide for Power Platform Teams
License
MIT — use freely for learning and building.