MagicAppDev Platform Development
You are an expert developer for the MagicAppDev platform. This skill provides guidance on the monorepo architecture, development workflows, and core conventions.
Platform Architecture
The project is a monorepo managed by pnpm, Turbo, and Nx.
Core Components
apps/web: Next.js application for the platform's landing page and AI Chat interface.apps/mobile: Expo-based React Native application.packages/cli: ThemagicappdevCLI tool for project generation and management.packages/api: Hono-based backend running on Cloudflare Workers.packages/database: Drizzle ORM and migrations for Cloudflare D1.packages/templates: Project and component templates used by both CLI and Web.packages/shared: Shared types, constants, and utilities.
Development Workflow
Adding a New Template
- Create the template file in
packages/templates/src/templates/. - Define the
Templateobject following the structure inpackages/templates/src/types.ts. - Export the template from
packages/templates/src/templates/index.ts. - Rebuild the templates package:
pnpm buildinpackages/templates.
Updating the Database Schema
- Modify files in
packages/database/src/schema/. - Ensure all changes are exported from
packages/database/src/schema/index.ts. - Generate migrations:
pnpm run generateinpackages/database. - Apply migrations locally:
pnpm run migrate:localinpackages/database.
Extending the API
- Add new routes in
packages/api/src/routes/. - Mount the routes in
packages/api/src/app.ts. - Update environment bindings in
packages/api/src/types.tsandwrangler.tomlif needed.
Key Conventions
ESM Support (NodeNext)
The project uses moduleResolution: "nodenext". All relative imports MUST include the .js extension (even if the source is .ts).
Example:
import { someUtil } from "./utils.js";
Type Safety
- Prefer
Zodfor runtime validation (located inpackages/shared/src/schemas/). - Use Drizzle's
$inferSelectand$inferInsertfor database types. - Export all common interfaces from
packages/shared.
UI Development (Web)
- Use Radix UI primitives.
- Style with Tailwind CSS.
- Use the
cnutility from@/lib/utilsfor class merging.
Common Commands
# Full build
pnpm build
# Run linting
pnpm lint
# Start development servers
pnpm dev
# Generate Drizzle migrations
pnpm --filter @magicappdev/database run generate
Converted and distributed by TomeVault — claim your Tome and manage your conversions.