liara_create_app
Create and deploy a new application on the Liara cloud platform by specifying name, platform type, and plan ID.
Instructions
Create a new app
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | App name (3-32 chars, lowercase, alphanumeric with hyphens) | |
| platform | Yes | Platform type | |
| planID | Yes | Plan ID for the app | |
| region | No | Deployment region (optional) |
Implementation Reference
- src/services/apps.ts:56-67 (handler)The main handler function that implements the logic for creating a new Liara app/project. It validates inputs and calls the Liara API to create the project.export async function createApp( client: LiaraClient, request: CreateProjectRequest ): Promise<Project> { validateAppName(request.name); validateRequired(request.platform, 'Platform'); validateRequired(request.planID, 'Plan ID'); // Network is optional in schema but will be passed to API if provided // API will return error if network is required but not provided return await client.post<Project>('/v1/projects', request); }
- src/api/types.ts:84-91 (schema)Type definition for the input parameters to the createApp handler, defining the required fields like name, platform, and planID.export interface CreateProjectRequest { name: string; platform: Platform; planID: string; bundlePlanID?: string; region?: string; network?: string; }
- src/utils/errors.ts:64-103 (helper)Helper function to validate the app name format used in createApp.export function validateAppName(name: string): void { validateRequired(name, 'App name'); if (name.length < 3) { throw new LiaraMcpError( `App name "${name}" is too short (minimum 3 characters, got ${name.length})`, 'INVALID_APP_NAME', { name, length: name.length }, ['Use a name like "my-app" or "api-service"'] ); } if (name.length > 32) { throw new LiaraMcpError( `App name "${name}" is too long (maximum 32 characters, got ${name.length})`, 'INVALID_APP_NAME', { name, length: name.length }, ['Shorten the name to 32 characters or less'] ); } if (!/^[a-z0-9-]+$/.test(name)) { const invalidChars = name.match(/[^a-z0-9-]/g); throw new LiaraMcpError( `App name contains invalid characters: ${invalidChars?.join(', ') || 'unknown'}`, 'INVALID_APP_NAME', { name, invalidChars }, ['Use only lowercase letters, numbers, and hyphens', 'Example: "my-app" or "api-service"'] ); } if (name.startsWith('-') || name.endsWith('-')) { throw new LiaraMcpError( `App name cannot start or end with a hyphen: "${name}"`, 'INVALID_APP_NAME', { name }, ['Remove leading/trailing hyphens', 'Example: "my-app" instead of "-my-app"'] ); } }
- src/services/apps.ts:190-207 (helper)Helper function returning available platforms for app creation.export function getAvailablePlatforms(): Platform[] { return [ 'node', 'nextjs', 'laravel', 'php', 'django', 'flask', 'dotnet', 'static', 'react', 'angular', 'vue', 'docker', 'python', 'go', ]; }