@polymorphism-tech/morph-spec 4.7.0 → 4.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.morph/.morphversion +5 -0
- package/.morph/analytics/threads-log.jsonl +5 -0
- package/.morph/config/config.json +8 -0
- package/.morph/framework/agents.json +1815 -0
- package/.morph/framework/hooks/README.md +205 -0
- package/.morph/framework/hooks/claude-code/notification/approval-reminder.js +54 -0
- package/.morph/framework/hooks/claude-code/post-tool-use/dispatch.js +83 -0
- package/.morph/framework/hooks/claude-code/post-tool-use/handle-tool-failure.js +42 -0
- package/.morph/framework/hooks/claude-code/pre-compact/save-morph-context.js +61 -0
- package/.morph/framework/hooks/claude-code/pre-tool-use/enforce-phase-writes.js +71 -0
- package/.morph/framework/hooks/claude-code/pre-tool-use/protect-readonly-files.js +58 -0
- package/.morph/framework/hooks/claude-code/pre-tool-use/protect-spec-files.js +64 -0
- package/.morph/framework/hooks/claude-code/session-start/inject-morph-context.js +94 -0
- package/.morph/framework/hooks/claude-code/statusline.py +538 -0
- package/.morph/framework/hooks/claude-code/statusline.sh +7 -0
- package/.morph/framework/hooks/claude-code/stop/validate-completion.js +88 -0
- package/.morph/framework/hooks/claude-code/user-prompt/enrich-prompt.js +91 -0
- package/.morph/framework/hooks/git/commit-msg/conventional-commits.sh +33 -0
- package/.morph/framework/hooks/git/pre-commit/agents.sh +25 -0
- package/.morph/framework/hooks/git/pre-commit/orchestrator.sh +64 -0
- package/.morph/framework/hooks/git/pre-commit/specs.sh +50 -0
- package/.morph/framework/hooks/git/pre-push/run-tests.sh +44 -0
- package/.morph/framework/hooks/shared/hook-response.js +45 -0
- package/.morph/framework/hooks/shared/phase-utils.js +129 -0
- package/.morph/framework/hooks/shared/state-reader.js +138 -0
- package/.morph/framework/hooks/shared/stdin-reader.js +26 -0
- package/.morph/framework/standards/STANDARDS.json +933 -0
- package/.morph/framework/standards/ai-agents/blazor-ui.md +364 -0
- package/.morph/framework/standards/ai-agents/production.md +415 -0
- package/.morph/framework/standards/ai-agents/setup.md +418 -0
- package/.morph/framework/standards/ai-agents/team-orchestration.md +479 -0
- package/.morph/framework/standards/ai-agents/workflows.md +354 -0
- package/.morph/framework/standards/architecture/ddd/aggregates.md +120 -0
- package/.morph/framework/standards/architecture/ddd/bounded-contexts.md +105 -0
- package/.morph/framework/standards/architecture/ddd/complexity-levels.md +108 -0
- package/.morph/framework/standards/architecture/ddd/entities.md +99 -0
- package/.morph/framework/standards/architecture/ddd/ubiquitous-language.md +58 -0
- package/.morph/framework/standards/architecture/ddd/value-objects.md +124 -0
- package/.morph/framework/standards/backend/api/minimal-api.md +494 -0
- package/.morph/framework/standards/backend/api/rest.md +492 -0
- package/.morph/framework/standards/backend/api/validation.md +88 -0
- package/.morph/framework/standards/backend/authentication/passkeys.md +428 -0
- package/.morph/framework/standards/backend/database/ef-core.md +199 -0
- package/.morph/framework/standards/backend/database/migrations.md +393 -0
- package/.morph/framework/standards/backend/database/postgresql/database.md +352 -0
- package/.morph/framework/standards/backend/database/repository-patterns.md +528 -0
- package/.morph/framework/standards/backend/database/vector-search-rag.md +541 -0
- package/.morph/framework/standards/backend/dotnet/async.md +366 -0
- package/.morph/framework/standards/backend/dotnet/core.md +117 -0
- package/.morph/framework/standards/backend/dotnet/di.md +439 -0
- package/.morph/framework/standards/backend/dotnet/program-cs-checklist.md +92 -0
- package/.morph/framework/standards/backend/integrations/asaas/asaas-api.md +216 -0
- package/.morph/framework/standards/backend/integrations/clerk/clerk-auth.md +290 -0
- package/.morph/framework/standards/backend/integrations/hangfire/hangfire-jobs.md +350 -0
- package/.morph/framework/standards/backend/integrations/resend/resend-email.md +385 -0
- package/.morph/framework/standards/context/analytics.md +96 -0
- package/.morph/framework/standards/context/bundles.md +110 -0
- package/.morph/framework/standards/context/priming.md +78 -0
- package/.morph/framework/standards/core/architecture.md +185 -0
- package/.morph/framework/standards/core/coding.md +214 -0
- package/.morph/framework/standards/core/git-branching-strategy.md +403 -0
- package/.morph/framework/standards/core/git.md +185 -0
- package/.morph/framework/standards/core/testing.md +295 -0
- package/.morph/framework/standards/data/nosql/blob-storage.md +102 -0
- package/.morph/framework/standards/data/nosql/cache/redis.md +97 -0
- package/.morph/framework/standards/data/nosql/cosmos-db.md +118 -0
- package/.morph/framework/standards/data/vector-search/azure-ai-search.md +121 -0
- package/.morph/framework/standards/data/vector-search/rag-chunking.md +104 -0
- package/.morph/framework/standards/frontend/blazor/design-checklist.md +222 -0
- package/.morph/framework/standards/frontend/blazor/fluent-ui-setup.md +595 -0
- package/.morph/framework/standards/frontend/blazor/fluent-ui.md +137 -0
- package/.morph/framework/standards/frontend/blazor/html-conversion.md +184 -0
- package/.morph/framework/standards/frontend/blazor/lifecycle.md +195 -0
- package/.morph/framework/standards/frontend/blazor/pitfalls.md +198 -0
- package/.morph/framework/standards/frontend/blazor/state.md +191 -0
- package/.morph/framework/standards/frontend/design-system/animations.md +151 -0
- package/.morph/framework/standards/frontend/design-system/naming.md +64 -0
- package/.morph/framework/standards/frontend/nextjs/app-router.md +123 -0
- package/.morph/framework/standards/frontend/nextjs/components.md +132 -0
- package/.morph/framework/standards/frontend/nextjs/data-fetching.md +126 -0
- package/.morph/framework/standards/frontend/nextjs/forms.md +128 -0
- package/.morph/framework/standards/frontend/nextjs/naming-conventions.md +67 -0
- package/.morph/framework/standards/frontend/nextjs/nextjs-patterns.md +215 -0
- package/.morph/framework/standards/frontend/nextjs/project-structure.md +102 -0
- package/.morph/framework/standards/frontend/nextjs/state-management.md +72 -0
- package/.morph/framework/standards/frontend/nextjs/testing.md +111 -0
- package/.morph/framework/standards/infrastructure/azure/azure.md +624 -0
- package/.morph/framework/standards/infrastructure/azure/bicep/bicep-patterns.md +422 -0
- package/.morph/framework/standards/infrastructure/azure/devops/azure-devops-setup.md +516 -0
- package/.morph/framework/standards/infrastructure/azure/devops/local-development.md +520 -0
- package/.morph/framework/standards/infrastructure/azure/services/functions.md +486 -0
- package/.morph/framework/standards/infrastructure/azure/services/service-bus.md +459 -0
- package/.morph/framework/standards/infrastructure/azure/services/storage.md +407 -0
- package/.morph/framework/standards/infrastructure/docker/easypanel-deploy.md +196 -0
- package/.morph/framework/standards/infrastructure/supabase/mcp-setup.md +252 -0
- package/.morph/framework/standards/infrastructure/supabase/supabase-auth.md +176 -0
- package/.morph/framework/standards/infrastructure/supabase/supabase-pgvector.md +169 -0
- package/.morph/framework/standards/infrastructure/supabase/supabase-rls.md +184 -0
- package/.morph/framework/standards/infrastructure/supabase/supabase-storage.md +153 -0
- package/.morph/framework/standards/integration/api/graphql.md +91 -0
- package/.morph/framework/standards/integration/api/grpc.md +114 -0
- package/.morph/framework/standards/integration/api/rest-design.md +95 -0
- package/.morph/framework/standards/integration/event-driven/cqrs.md +101 -0
- package/.morph/framework/standards/integration/event-driven/event-sourcing.md +124 -0
- package/.morph/framework/standards/integration/event-driven/service-bus.md +95 -0
- package/.morph/framework/standards/integration/mcp/mcp-tools.md +384 -0
- package/.morph/framework/standards/observability/logging.md +131 -0
- package/.morph/framework/standards/observability/metrics.md +121 -0
- package/.morph/framework/standards/observability/monitoring.md +114 -0
- package/.morph/framework/standards/observability/tracing.md +132 -0
- package/.morph/framework/standards/workflows/parallel-execution.md +112 -0
- package/.morph/framework/standards/workflows/thread-management.md +113 -0
- package/.morph/framework/templates/.idea/morph-templates.xml +92 -0
- package/.morph/framework/templates/.vscode/morph-templates.code-snippets +186 -0
- package/.morph/framework/templates/IDE-SNIPPETS.md +266 -0
- package/.morph/framework/templates/README.md +814 -0
- package/.morph/framework/templates/REGISTRY.json +1888 -0
- package/.morph/framework/templates/code/dotnet/backend/repository.cs +141 -0
- package/.morph/framework/templates/code/dotnet/backend/service.cs +139 -0
- package/.morph/framework/templates/code/dotnet/contracts/Commands.cs +74 -0
- package/.morph/framework/templates/code/dotnet/contracts/Entities.cs +25 -0
- package/.morph/framework/templates/code/dotnet/contracts/Queries.cs +74 -0
- package/.morph/framework/templates/code/dotnet/contracts/README.md +74 -0
- package/.morph/framework/templates/code/dotnet/contracts/api-contracts.cs +173 -0
- package/.morph/framework/templates/code/dotnet/contracts/contracts-level1.cs +69 -0
- package/.morph/framework/templates/code/dotnet/contracts/contracts-level2.cs +86 -0
- package/.morph/framework/templates/code/dotnet/contracts/contracts-level3.cs +41 -0
- package/.morph/framework/templates/code/dotnet/database/migration.cs +83 -0
- package/.morph/framework/templates/code/dotnet/frontend/component.razor +239 -0
- package/.morph/framework/templates/code/dotnet/jobs/agent.cs +163 -0
- package/.morph/framework/templates/code/dotnet/jobs/job.cs +171 -0
- package/.morph/framework/templates/code/dotnet/test.cs +239 -0
- package/.morph/framework/templates/code/sql/rls-policy.sql +57 -0
- package/.morph/framework/templates/code/sql/supabase-migration.sql +100 -0
- package/.morph/framework/templates/code/sql/supabase-migration.template.sql +113 -0
- package/.morph/framework/templates/code/typescript/contracts.ts +168 -0
- package/.morph/framework/templates/context/CONTEXT-FEATURE.md +276 -0
- package/.morph/framework/templates/context/CONTEXT.md +181 -0
- package/.morph/framework/templates/docs/clarifications.md +253 -0
- package/.morph/framework/templates/docs/onboarding.md +123 -0
- package/.morph/framework/templates/docs/proposal.md +182 -0
- package/.morph/framework/templates/docs/schema-analysis.md +119 -0
- package/.morph/framework/templates/docs/spec.md +198 -0
- package/.morph/framework/templates/docs/ui-components.md +124 -0
- package/.morph/framework/templates/docs/ui-design-system.md +76 -0
- package/.morph/framework/templates/docs/ui-flows.md +167 -0
- package/.morph/framework/templates/docs/ui-mockups.md +98 -0
- package/.morph/framework/templates/docs/user-stories.md +34 -0
- package/.morph/framework/templates/examples/design-system-examples.md +357 -0
- package/.morph/framework/templates/examples/spec-examples.md +90 -0
- package/.morph/framework/templates/feature/decisions.md +187 -0
- package/.morph/framework/templates/feature/recap.md +146 -0
- package/.morph/framework/templates/feature/tasks.md +199 -0
- package/.morph/framework/templates/frontend/nextjs/Dockerfile.nextjs.hbs +43 -0
- package/.morph/framework/templates/frontend/nextjs/client-component.tsx.hbs +26 -0
- package/.morph/framework/templates/frontend/nextjs/env.mjs.hbs +32 -0
- package/.morph/framework/templates/frontend/nextjs/feature-form.tsx.hbs +56 -0
- package/.morph/framework/templates/frontend/nextjs/page.tsx.hbs +22 -0
- package/.morph/framework/templates/frontend/nextjs/tsconfig.json.hbs +26 -0
- package/.morph/framework/templates/frontend/nextjs/use-feature.ts.hbs +54 -0
- package/.morph/framework/templates/infrastructure/azure/Dockerfile.example +82 -0
- package/.morph/framework/templates/infrastructure/azure/README.md +286 -0
- package/.morph/framework/templates/infrastructure/azure/app-insights.bicep +63 -0
- package/.morph/framework/templates/infrastructure/azure/app-service.bicep +164 -0
- package/.morph/framework/templates/infrastructure/azure/container-app-env.bicep +49 -0
- package/.morph/framework/templates/infrastructure/azure/container-app.bicep +156 -0
- package/.morph/framework/templates/infrastructure/azure/deploy-checklist.md +426 -0
- package/.morph/framework/templates/infrastructure/azure/deploy.ps1 +229 -0
- package/.morph/framework/templates/infrastructure/azure/deploy.sh +208 -0
- package/.morph/framework/templates/infrastructure/azure/key-vault.bicep +91 -0
- package/.morph/framework/templates/infrastructure/azure/main.bicep +189 -0
- package/.morph/framework/templates/infrastructure/azure/parameters.dev.json +29 -0
- package/.morph/framework/templates/infrastructure/azure/parameters.prod.json +29 -0
- package/.morph/framework/templates/infrastructure/azure/parameters.staging.json +29 -0
- package/.morph/framework/templates/infrastructure/azure/sql-database.bicep +103 -0
- package/.morph/framework/templates/infrastructure/azure/storage.bicep +106 -0
- package/.morph/framework/templates/infrastructure/docker/Dockerfile.template +58 -0
- package/.morph/framework/templates/infrastructure/docker/docker-compose.template.yml +67 -0
- package/.morph/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -0
- package/.morph/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -0
- package/.morph/framework/templates/infrastructure/docker/easypanel.template.json +54 -0
- package/.morph/framework/templates/infrastructure/github/README.md +593 -0
- package/.morph/framework/templates/infrastructure/github/actions/azure-auth/action.yml.hbs +22 -0
- package/.morph/framework/templates/infrastructure/github/actions/docker-build-push/action.yml.hbs +45 -0
- package/.morph/framework/templates/infrastructure/github/actions/health-check/action.yml.hbs +27 -0
- package/.morph/framework/templates/infrastructure/github/workflows/deploy-azure-app-service.yml.hbs +61 -0
- package/.morph/framework/templates/infrastructure/github/workflows/deploy-easypanel.yml.hbs +31 -0
- package/.morph/framework/templates/infrastructure/github/workflows/docker-build-push.yml.hbs +59 -0
- package/.morph/framework/templates/infrastructure/github/workflows/dotnet-build.yml.hbs +39 -0
- package/.morph/framework/templates/integrations/asaas-client.cs +387 -0
- package/.morph/framework/templates/integrations/asaas-webhook.cs +351 -0
- package/.morph/framework/templates/integrations/azure-identity-config.cs +288 -0
- package/.morph/framework/templates/integrations/clerk-config.cs +258 -0
- package/.morph/framework/templates/meta-prompts/fusion/fusion-agent.md +76 -0
- package/.morph/framework/templates/meta-prompts/fusion/fusion-aggregator.md +100 -0
- package/.morph/framework/templates/meta-prompts/hops/hop-retry.md +78 -0
- package/.morph/framework/templates/meta-prompts/hops/hop-validation.md +97 -0
- package/.morph/framework/templates/meta-prompts/hops/hop-wrapper.md +36 -0
- package/.morph/framework/templates/meta-prompts/parallel-workers/parallel-coordinator.md +113 -0
- package/.morph/framework/templates/meta-prompts/parallel-workers/parallel-worker.md +80 -0
- package/.morph/framework/templates/meta-prompts/squad-leaders/backend-squad.md +90 -0
- package/.morph/framework/templates/meta-prompts/squad-leaders/frontend-squad.md +126 -0
- package/.morph/framework/templates/meta-prompts/squad-leaders/squad-leader.md +43 -0
- package/.morph/framework/templates/meta-prompts/validators/checkpoint-validator.md +107 -0
- package/.morph/framework/templates/meta-prompts/validators/pre-commit-validator.md +95 -0
- package/.morph/framework/templates/project-structure/dotnet-ddd.md +70 -0
- package/.morph/framework/templates/saas/subscription.cs +347 -0
- package/.morph/framework/templates/saas/tenant.cs +338 -0
- package/.morph/framework/templates/state.template.json +17 -0
- package/.morph/framework/templates/ui/FluentDesignTheme.cs +149 -0
- package/.morph/framework/templates/ui/MudTheme.cs +281 -0
- package/.morph/framework/templates/ui/design-system.css +226 -0
- package/.morph/logs/tool-failures.log +17 -0
- package/.morph/memory/pre-compact-2026-02-24T17-43-30-049Z.json +16 -0
- package/.morph/plans/eager-watching-bunny.md +105 -0
- package/.morph/plans/temporal-seeking-nebula.md +45 -0
- package/.morph/state.json +48 -0
- package/CLAUDE.md +1 -1
- package/README.md +119 -99
- package/bin/morph-spec.js +0 -9
- package/framework/CLAUDE.md +1 -1
- package/framework/hooks/README.md +10 -6
- package/framework/hooks/claude-code/notification/approval-reminder.js +2 -0
- package/framework/hooks/claude-code/post-tool-use/dispatch.js +1 -1
- package/framework/hooks/claude-code/stop/validate-completion.js +1 -1
- package/framework/hooks/claude-code/user-prompt/enrich-prompt.js +1 -1
- package/package.json +1 -1
- package/src/commands/project/init.js +15 -42
- package/src/commands/project/update.js +22 -37
- package/src/lib/installers/mcp-installer.js +18 -3
- package/src/utils/hooks-installer.js +5 -15
- package/src/commands/project/detect.js +0 -114
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// env.mjs — Zod-validated environment variables
|
|
2
|
+
// Crashes at startup if required vars are missing — no silent undefined
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
const serverSchema = z.object({
|
|
6
|
+
API_URL: z.string().url('API_URL must be a valid URL'),
|
|
7
|
+
NODE_ENV: z.enum(['development', 'test', 'production']).default('development'),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const clientSchema = z.object({
|
|
11
|
+
NEXT_PUBLIC_APP_URL: z.string().url().optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Validate server-side env (only available on server)
|
|
15
|
+
const serverEnv = serverSchema.safeParse(process.env);
|
|
16
|
+
if (!serverEnv.success) {
|
|
17
|
+
console.error('❌ Invalid server environment variables:');
|
|
18
|
+
console.error(serverEnv.error.flatten().fieldErrors);
|
|
19
|
+
throw new Error('Invalid environment variables');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Validate client-side env
|
|
23
|
+
const clientEnv = clientSchema.safeParse({
|
|
24
|
+
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
|
|
25
|
+
});
|
|
26
|
+
if (!clientEnv.success) {
|
|
27
|
+
console.error('❌ Invalid client environment variables:');
|
|
28
|
+
console.error(clientEnv.error.flatten().fieldErrors);
|
|
29
|
+
throw new Error('Invalid client environment variables');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const env = { ...serverEnv.data, ...clientEnv.data };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// features/{{kebabCase featureName}}/components/create-{{kebabCase featureName}}-form.tsx
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
import { useForm } from 'react-hook-form';
|
|
5
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
6
|
+
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form';
|
|
7
|
+
import { Input } from '@/components/ui/input';
|
|
8
|
+
import { Button } from '@/components/ui/button';
|
|
9
|
+
import { useCreate{{pascalCase featureName}} } from '@/features/{{kebabCase featureName}}/hooks/use-create-{{kebabCase featureName}}';
|
|
10
|
+
import { create{{pascalCase featureName}}Schema, type Create{{pascalCase featureName}}Input } from '@/features/{{kebabCase featureName}}/types/{{kebabCase featureName}}.schemas';
|
|
11
|
+
|
|
12
|
+
interface Create{{pascalCase featureName}}FormProps {
|
|
13
|
+
onSuccess?: () => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function Create{{pascalCase featureName}}Form({ onSuccess }: Create{{pascalCase featureName}}FormProps) {
|
|
17
|
+
const form = useForm<Create{{pascalCase featureName}}Input>({
|
|
18
|
+
resolver: zodResolver(create{{pascalCase featureName}}Schema),
|
|
19
|
+
defaultValues: { name: '' },
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const { mutate: create{{pascalCase featureName}}, isPending } = useCreate{{pascalCase featureName}}();
|
|
23
|
+
|
|
24
|
+
function onSubmit(values: Create{{pascalCase featureName}}Input) {
|
|
25
|
+
create{{pascalCase featureName}}(values, {
|
|
26
|
+
onSuccess: () => { form.reset(); onSuccess?.(); },
|
|
27
|
+
onError: (error) => { form.setError('root', { message: error.message }); },
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Form {...form}>
|
|
33
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
|
34
|
+
<FormField
|
|
35
|
+
control={form.control}
|
|
36
|
+
name="name"
|
|
37
|
+
render={({ field }) => (
|
|
38
|
+
<FormItem>
|
|
39
|
+
<FormLabel>Name</FormLabel>
|
|
40
|
+
<FormControl>
|
|
41
|
+
<Input placeholder="Enter name" {...field} />
|
|
42
|
+
</FormControl>
|
|
43
|
+
<FormMessage />
|
|
44
|
+
</FormItem>
|
|
45
|
+
)}
|
|
46
|
+
/>
|
|
47
|
+
{form.formState.errors.root && (
|
|
48
|
+
<p className="text-sm text-destructive">{form.formState.errors.root.message}</p>
|
|
49
|
+
)}
|
|
50
|
+
<Button type="submit" disabled={isPending}>
|
|
51
|
+
{isPending ? 'Creating...' : 'Create {{pascalCase featureName}}'}
|
|
52
|
+
</Button>
|
|
53
|
+
</form>
|
|
54
|
+
</Form>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// app/(dashboard)/{{kebabCase featureName}}/page.tsx
|
|
2
|
+
// Server Component — fetches initial data, renders feature component
|
|
3
|
+
import { {{pascalCase featureName}}List } from '@/features/{{kebabCase featureName}}';
|
|
4
|
+
|
|
5
|
+
async function get{{pascalCase featureName}}List() {
|
|
6
|
+
const res = await fetch(`${process.env.API_URL}/api/{{kebabCase featureName}}`, {
|
|
7
|
+
next: { revalidate: 30 },
|
|
8
|
+
headers: { 'Content-Type': 'application/json' },
|
|
9
|
+
});
|
|
10
|
+
if (!res.ok) throw new Error('Failed to fetch {{featureName}}');
|
|
11
|
+
return res.json();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default async function {{pascalCase featureName}}Page() {
|
|
15
|
+
const data = await get{{pascalCase featureName}}List();
|
|
16
|
+
return (
|
|
17
|
+
<div className="container py-6">
|
|
18
|
+
<h1 className="text-2xl font-bold mb-6">{{pascalCase featureName}}</h1>
|
|
19
|
+
<{{pascalCase featureName}}List initialData={data} />
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": false,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noUncheckedIndexedAccess": true,
|
|
9
|
+
"noImplicitOverride": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"module": "esnext",
|
|
14
|
+
"moduleResolution": "bundler",
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"isolatedModules": true,
|
|
17
|
+
"jsx": "preserve",
|
|
18
|
+
"incremental": true,
|
|
19
|
+
"plugins": [{ "name": "next" }],
|
|
20
|
+
"paths": {
|
|
21
|
+
"@/*": ["./src/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
25
|
+
"exclude": ["node_modules"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// features/{{kebabCase featureName}}/hooks/use-{{kebabCase featureName}}s.ts
|
|
2
|
+
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { {{camelCase featureName}}Schema } from '@/features/{{kebabCase featureName}}/types/{{kebabCase featureName}}.schemas';
|
|
5
|
+
import type { Create{{pascalCase featureName}}Input } from '@/features/{{kebabCase featureName}}/types/{{kebabCase featureName}}.types';
|
|
6
|
+
|
|
7
|
+
// ============================================
|
|
8
|
+
// Query Key Factory
|
|
9
|
+
// ============================================
|
|
10
|
+
|
|
11
|
+
export const {{camelCase featureName}}Keys = {
|
|
12
|
+
all: ['{{kebabCase featureName}}'] as const,
|
|
13
|
+
lists: () => [...{{camelCase featureName}}Keys.all, 'list'] as const,
|
|
14
|
+
detail: (id: string) => [...{{camelCase featureName}}Keys.all, 'detail', id] as const,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// ============================================
|
|
18
|
+
// List Hook (TanStack Query v5 syntax)
|
|
19
|
+
// ============================================
|
|
20
|
+
|
|
21
|
+
const {{camelCase featureName}}ListSchema = z.array({{camelCase featureName}}Schema);
|
|
22
|
+
|
|
23
|
+
export function use{{pascalCase featureName}}s() {
|
|
24
|
+
return useQuery({
|
|
25
|
+
queryKey: {{camelCase featureName}}Keys.lists(),
|
|
26
|
+
queryFn: async () => {
|
|
27
|
+
const res = await fetch('/api/{{kebabCase featureName}}');
|
|
28
|
+
if (!res.ok) throw new Error('Failed to fetch {{featureName}}');
|
|
29
|
+
return {{camelCase featureName}}ListSchema.parse(await res.json());
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ============================================
|
|
35
|
+
// Create Mutation
|
|
36
|
+
// ============================================
|
|
37
|
+
|
|
38
|
+
export function useCreate{{pascalCase featureName}}() {
|
|
39
|
+
const queryClient = useQueryClient();
|
|
40
|
+
return useMutation({
|
|
41
|
+
mutationFn: async (input: Create{{pascalCase featureName}}Input) => {
|
|
42
|
+
const res = await fetch('/api/{{kebabCase featureName}}', {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
headers: { 'Content-Type': 'application/json' },
|
|
45
|
+
body: JSON.stringify(input),
|
|
46
|
+
});
|
|
47
|
+
if (!res.ok) throw new Error('Failed to create {{featureName}}');
|
|
48
|
+
return res.json();
|
|
49
|
+
},
|
|
50
|
+
onSuccess: () => {
|
|
51
|
+
queryClient.invalidateQueries({ queryKey: {{camelCase featureName}}Keys.lists() });
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# MORPH-SPEC - .NET 8 Blazor Server Dockerfile
|
|
3
|
+
# Multi-stage build for production-ready container
|
|
4
|
+
# ==============================================================================
|
|
5
|
+
|
|
6
|
+
# ==============================================================================
|
|
7
|
+
# Stage 1: Base Runtime
|
|
8
|
+
# ==============================================================================
|
|
9
|
+
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
10
|
+
|
|
11
|
+
# Set working directory
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
|
|
14
|
+
# Expose ports
|
|
15
|
+
EXPOSE 8080
|
|
16
|
+
EXPOSE 8081
|
|
17
|
+
|
|
18
|
+
# Create non-root user for security
|
|
19
|
+
RUN adduser --disabled-password --gecos '' appuser && chown -R appuser /app
|
|
20
|
+
USER appuser
|
|
21
|
+
|
|
22
|
+
# ==============================================================================
|
|
23
|
+
# Stage 2: Build
|
|
24
|
+
# ==============================================================================
|
|
25
|
+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
26
|
+
|
|
27
|
+
# Set working directory
|
|
28
|
+
WORKDIR /src
|
|
29
|
+
|
|
30
|
+
# Copy project files
|
|
31
|
+
# Adjust paths according to your solution structure
|
|
32
|
+
COPY ["src/YourApp/YourApp.csproj", "src/YourApp/"]
|
|
33
|
+
COPY ["src/YourApp.Core/YourApp.Core.csproj", "src/YourApp.Core/"]
|
|
34
|
+
COPY ["src/YourApp.Infrastructure/YourApp.Infrastructure.csproj", "src/YourApp.Infrastructure/"]
|
|
35
|
+
|
|
36
|
+
# Restore dependencies
|
|
37
|
+
RUN dotnet restore "src/YourApp/YourApp.csproj"
|
|
38
|
+
|
|
39
|
+
# Copy all source code
|
|
40
|
+
COPY . .
|
|
41
|
+
|
|
42
|
+
# Build project
|
|
43
|
+
WORKDIR "/src/src/YourApp"
|
|
44
|
+
RUN dotnet build "YourApp.csproj" -c Release -o /app/build
|
|
45
|
+
|
|
46
|
+
# ==============================================================================
|
|
47
|
+
# Stage 3: Publish
|
|
48
|
+
# ==============================================================================
|
|
49
|
+
FROM build AS publish
|
|
50
|
+
|
|
51
|
+
# Publish application
|
|
52
|
+
RUN dotnet publish "YourApp.csproj" \
|
|
53
|
+
-c Release \
|
|
54
|
+
-o /app/publish \
|
|
55
|
+
/p:UseAppHost=false \
|
|
56
|
+
/p:PublishTrimmed=false \
|
|
57
|
+
/p:PublishSingleFile=false
|
|
58
|
+
|
|
59
|
+
# ==============================================================================
|
|
60
|
+
# Stage 4: Final
|
|
61
|
+
# ==============================================================================
|
|
62
|
+
FROM base AS final
|
|
63
|
+
|
|
64
|
+
# Set working directory
|
|
65
|
+
WORKDIR /app
|
|
66
|
+
|
|
67
|
+
# Copy published files from publish stage
|
|
68
|
+
COPY --from=publish /app/publish .
|
|
69
|
+
|
|
70
|
+
# Set environment variables
|
|
71
|
+
ENV ASPNETCORE_URLS=http://+:8080
|
|
72
|
+
ENV ASPNETCORE_ENVIRONMENT=Production
|
|
73
|
+
ENV DOTNET_RUNNING_IN_CONTAINER=true
|
|
74
|
+
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
|
|
75
|
+
|
|
76
|
+
# Health check endpoint
|
|
77
|
+
# Adjust path to match your health check endpoint
|
|
78
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
79
|
+
CMD curl -f http://localhost:8080/health || exit 1
|
|
80
|
+
|
|
81
|
+
# Set entry point
|
|
82
|
+
ENTRYPOINT ["dotnet", "YourApp.dll"]
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# MORPH-SPEC - Templates Bicep
|
|
2
|
+
|
|
3
|
+
Templates de infraestrutura para Azure com suporte a App Service e Container Apps.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🚀 Quick Start
|
|
8
|
+
|
|
9
|
+
### 1. App Service Free (Desenvolvimento - $0/mês)
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Deploy infraestrutura com App Service Free
|
|
13
|
+
az deployment group create \
|
|
14
|
+
--resource-group rg-myapp-dev \
|
|
15
|
+
--template-file main.bicep \
|
|
16
|
+
--parameters @parameters.dev.json \
|
|
17
|
+
--parameters appName=myapp
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2. Container Apps (Produção - $5-15/mês)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Build e push imagem para ACR
|
|
24
|
+
az acr build \
|
|
25
|
+
--registry acrXXXX \
|
|
26
|
+
--image myapp:v1.0.0 \
|
|
27
|
+
--file Dockerfile \
|
|
28
|
+
.
|
|
29
|
+
|
|
30
|
+
# Deploy infraestrutura com Container Apps
|
|
31
|
+
az deployment group create \
|
|
32
|
+
--resource-group rg-myapp-prod \
|
|
33
|
+
--template-file main.bicep \
|
|
34
|
+
--parameters @parameters.prod.json \
|
|
35
|
+
--parameters appName=myapp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 📁 Estrutura de Arquivos
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
infra/
|
|
44
|
+
├── main.bicep # Entry point com lógica condicional
|
|
45
|
+
├── parameters.dev.json # Params dev (App Service Free)
|
|
46
|
+
├── parameters.prod.json # Params prod (Container Apps)
|
|
47
|
+
├── app-service.bicep # Template App Service
|
|
48
|
+
├── container-app.bicep # Template Container App
|
|
49
|
+
├── container-app-env.bicep # Container Apps Environment
|
|
50
|
+
├── sql-database.bicep # Azure SQL Database
|
|
51
|
+
├── storage.bicep # Storage Account
|
|
52
|
+
├── key-vault.bicep # Key Vault
|
|
53
|
+
└── app-insights.bicep # Application Insights
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## ⚙️ Parâmetros Principais
|
|
59
|
+
|
|
60
|
+
### main.bicep
|
|
61
|
+
|
|
62
|
+
| Parâmetro | Tipo | Default | Descrição |
|
|
63
|
+
|-----------|------|---------|-----------|
|
|
64
|
+
| `environment` | string | `dev` | Ambiente (dev, staging, prod) |
|
|
65
|
+
| `appName` | string | **required** | Nome da aplicação (3-15 chars) |
|
|
66
|
+
| `location` | string | `resourceGroup().location` | Região Azure |
|
|
67
|
+
| `hostingType` | string | `appservice` | Tipo de hosting (`appservice` ou `containerapp`) |
|
|
68
|
+
| `appServiceSku` | string | `F1` | SKU do App Service (F1, B1, S1, P1v2) |
|
|
69
|
+
| `containerImage` | string | `mcr.microsoft.com/hello-world:latest` | Imagem Docker (apenas Container Apps) |
|
|
70
|
+
| `sqlAdminPassword` | securestring | **required** | Senha do SQL Server |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 🌐 Escolhendo o Hosting Type
|
|
75
|
+
|
|
76
|
+
### App Service (`hostingType: appservice`)
|
|
77
|
+
|
|
78
|
+
**Usar quando:**
|
|
79
|
+
- ✅ Orçamento zero (Free F1)
|
|
80
|
+
- ✅ MVP ou protótipo
|
|
81
|
+
- ✅ Tráfego baixo (<100 req/dia)
|
|
82
|
+
- ✅ App tolerante a cold starts (20 min sleep)
|
|
83
|
+
- ✅ Deploy simplificado (sem Docker)
|
|
84
|
+
|
|
85
|
+
**SKUs disponíveis:**
|
|
86
|
+
- `F1` (Free): $0/mês - 1GB RAM, 60 min CPU/dia, sleep após 20min
|
|
87
|
+
- `B1` (Basic): $13/mês - 1.75GB RAM, always-on
|
|
88
|
+
- `S1` (Standard): $70/mês - 1.75GB RAM, auto-scale, slots
|
|
89
|
+
- `P1v2` (Premium): $85/mês - 3.5GB RAM, melhor performance
|
|
90
|
+
|
|
91
|
+
### Container Apps (`hostingType: containerapp`)
|
|
92
|
+
|
|
93
|
+
**Usar quando:**
|
|
94
|
+
- ✅ Produção com SLA 24/7
|
|
95
|
+
- ✅ Auto-scaling baseado em demanda
|
|
96
|
+
- ✅ SSL customizado necessário
|
|
97
|
+
- ✅ Background jobs (Hangfire)
|
|
98
|
+
- ✅ Arquitetura microserviços
|
|
99
|
+
|
|
100
|
+
**Custo:** $0-15/mês (scale-to-zero + consumo)
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 📝 Configuração por Ambiente
|
|
105
|
+
|
|
106
|
+
### Development (parameters.dev.json)
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"environment": { "value": "dev" },
|
|
111
|
+
"hostingType": { "value": "appservice" },
|
|
112
|
+
"appServiceSku": { "value": "F1" }
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Infraestrutura:**
|
|
117
|
+
- App Service Free F1
|
|
118
|
+
- Azure SQL Free (32GB)
|
|
119
|
+
- App Insights Free (5GB)
|
|
120
|
+
|
|
121
|
+
**Custo total:** $0/mês
|
|
122
|
+
|
|
123
|
+
### Staging (parameters.staging.json)
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"environment": { "value": "staging" },
|
|
128
|
+
"hostingType": { "value": "containerapp" },
|
|
129
|
+
"minReplicas": { "value": 0 } // scale-to-zero
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Infraestrutura:**
|
|
134
|
+
- Container Apps (scale-to-zero)
|
|
135
|
+
- Azure SQL Free (32GB)
|
|
136
|
+
- ACR Basic
|
|
137
|
+
- App Insights Free
|
|
138
|
+
|
|
139
|
+
**Custo total:** $5-10/mês
|
|
140
|
+
|
|
141
|
+
### Production (parameters.prod.json)
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"environment": { "value": "prod" },
|
|
146
|
+
"hostingType": { "value": "containerapp" },
|
|
147
|
+
"minReplicas": { "value": 1 } // always-on
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Infraestrutura:**
|
|
152
|
+
- Container Apps (min 1 replica)
|
|
153
|
+
- Azure SQL Free (ou pago se necessário)
|
|
154
|
+
- ACR Basic
|
|
155
|
+
- App Insights (pode ultrapassar free tier)
|
|
156
|
+
|
|
157
|
+
**Custo total:** $10-20/mês
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## 🔧 Customização
|
|
162
|
+
|
|
163
|
+
### Adicionar variáveis de ambiente
|
|
164
|
+
|
|
165
|
+
**App Service:**
|
|
166
|
+
```bicep
|
|
167
|
+
module appService 'app-service.bicep' = {
|
|
168
|
+
params: {
|
|
169
|
+
envVars: {
|
|
170
|
+
MY_CUSTOM_VAR: 'value'
|
|
171
|
+
ANOTHER_VAR: 'another-value'
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Container Apps:**
|
|
178
|
+
```bicep
|
|
179
|
+
module containerApp 'container-app.bicep' = {
|
|
180
|
+
params: {
|
|
181
|
+
envVars: [
|
|
182
|
+
{
|
|
183
|
+
name: 'MY_CUSTOM_VAR'
|
|
184
|
+
value: 'value'
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Usar secrets do Key Vault
|
|
192
|
+
|
|
193
|
+
```bicep
|
|
194
|
+
param sqlAdminPassword string {
|
|
195
|
+
reference: {
|
|
196
|
+
keyVault: {
|
|
197
|
+
id: '/subscriptions/.../providers/Microsoft.KeyVault/vaults/kv-myapp'
|
|
198
|
+
}
|
|
199
|
+
secretName: 'sql-admin-password'
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## 🔄 Migração App Service → Container Apps
|
|
207
|
+
|
|
208
|
+
Ver guia completo em: `../../standards/migration-guide.md`
|
|
209
|
+
|
|
210
|
+
**Resumo:**
|
|
211
|
+
1. Criar Dockerfile
|
|
212
|
+
2. Implementar health checks
|
|
213
|
+
3. Build e push para ACR
|
|
214
|
+
4. Atualizar `parameters.json` → `hostingType: containerapp`
|
|
215
|
+
5. Redeploy
|
|
216
|
+
6. Testar
|
|
217
|
+
7. Cutover DNS
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 📊 Outputs Gerados
|
|
222
|
+
|
|
223
|
+
Após deploy, os seguintes outputs são gerados:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
# Obter URL da aplicação
|
|
227
|
+
az deployment group show \
|
|
228
|
+
-g rg-myapp-dev \
|
|
229
|
+
-n deployment-name \
|
|
230
|
+
--query properties.outputs.appUrl.value
|
|
231
|
+
|
|
232
|
+
# Obter connection string SQL
|
|
233
|
+
az deployment group show \
|
|
234
|
+
-g rg-myapp-dev \
|
|
235
|
+
-n deployment-name \
|
|
236
|
+
--query properties.outputs.sqlConnectionString.value
|
|
237
|
+
|
|
238
|
+
# Obter App Insights connection string
|
|
239
|
+
az deployment group show \
|
|
240
|
+
-g rg-myapp-dev \
|
|
241
|
+
-n deployment-name \
|
|
242
|
+
--query properties.outputs.appInsightsConnectionString.value
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## 🆘 Troubleshooting
|
|
248
|
+
|
|
249
|
+
### Erro: "The template deployment 'X' is not valid"
|
|
250
|
+
|
|
251
|
+
Validar template:
|
|
252
|
+
```bash
|
|
253
|
+
az deployment group validate \
|
|
254
|
+
--resource-group rg-myapp-dev \
|
|
255
|
+
--template-file main.bicep \
|
|
256
|
+
--parameters @parameters.dev.json
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Erro: "SKU not available in this location"
|
|
260
|
+
|
|
261
|
+
Verificar SKUs disponíveis:
|
|
262
|
+
```bash
|
|
263
|
+
az appservice list-locations --sku F1
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Deploy muito lento
|
|
267
|
+
|
|
268
|
+
Container Apps pode levar 5-10 minutos no primeiro deploy. Use `--no-wait` para não bloquear:
|
|
269
|
+
```bash
|
|
270
|
+
az deployment group create \
|
|
271
|
+
... \
|
|
272
|
+
--no-wait
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 📚 Referências
|
|
278
|
+
|
|
279
|
+
- [Bicep Documentation](https://learn.microsoft.com/azure/azure-resource-manager/bicep/)
|
|
280
|
+
- [App Service Bicep Reference](https://learn.microsoft.com/azure/templates/microsoft.web/sites)
|
|
281
|
+
- [Container Apps Bicep Reference](https://learn.microsoft.com/azure/templates/microsoft.app/containerapps)
|
|
282
|
+
- [Azure CLI Reference](https://learn.microsoft.com/cli/azure/)
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
*MORPH-SPEC by Polymorphism Tech*
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// ==============================================================================
|
|
2
|
+
// MORPH-SPEC - Application Insights
|
|
3
|
+
// Azure Application Insights for monitoring and telemetry
|
|
4
|
+
// ==============================================================================
|
|
5
|
+
|
|
6
|
+
@description('Application Insights name')
|
|
7
|
+
param name string
|
|
8
|
+
|
|
9
|
+
@description('Location')
|
|
10
|
+
param location string
|
|
11
|
+
|
|
12
|
+
@description('Tags')
|
|
13
|
+
param tags object = {}
|
|
14
|
+
|
|
15
|
+
@description('Log Analytics Workspace ID')
|
|
16
|
+
param logAnalyticsWorkspaceId string
|
|
17
|
+
|
|
18
|
+
@description('Application type')
|
|
19
|
+
@allowed(['web', 'other'])
|
|
20
|
+
param applicationType string = 'web'
|
|
21
|
+
|
|
22
|
+
@description('Retention in days')
|
|
23
|
+
@minValue(30)
|
|
24
|
+
@maxValue(730)
|
|
25
|
+
param retentionInDays int = 90
|
|
26
|
+
|
|
27
|
+
// ==============================================================================
|
|
28
|
+
// APPLICATION INSIGHTS
|
|
29
|
+
// ==============================================================================
|
|
30
|
+
|
|
31
|
+
resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
|
|
32
|
+
name: name
|
|
33
|
+
location: location
|
|
34
|
+
tags: tags
|
|
35
|
+
kind: applicationType
|
|
36
|
+
properties: {
|
|
37
|
+
Application_Type: applicationType
|
|
38
|
+
WorkspaceResourceId: logAnalyticsWorkspaceId
|
|
39
|
+
IngestionMode: 'LogAnalytics'
|
|
40
|
+
publicNetworkAccessForIngestion: 'Enabled'
|
|
41
|
+
publicNetworkAccessForQuery: 'Enabled'
|
|
42
|
+
RetentionInDays: retentionInDays
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ==============================================================================
|
|
47
|
+
// OUTPUTS
|
|
48
|
+
// ==============================================================================
|
|
49
|
+
|
|
50
|
+
@description('Application Insights ID')
|
|
51
|
+
output id string = appInsights.id
|
|
52
|
+
|
|
53
|
+
@description('Application Insights name')
|
|
54
|
+
output name string = appInsights.name
|
|
55
|
+
|
|
56
|
+
@description('Instrumentation Key')
|
|
57
|
+
output instrumentationKey string = appInsights.properties.InstrumentationKey
|
|
58
|
+
|
|
59
|
+
@description('Connection String')
|
|
60
|
+
output connectionString string = appInsights.properties.ConnectionString
|
|
61
|
+
|
|
62
|
+
@description('App ID')
|
|
63
|
+
output appId string = appInsights.properties.AppId
|