Skip to main content

Overview

Chapi Assistant streamlines project creation by cloning template repositories, customizing the structure with your project name, and initializing Git version control - all in a single workflow.
Project creation uses the CreateProjectUseCase (CreateProjectUseCase.cs:30) which orchestrates cloning, renaming, and Git initialization.

How It Works

The project creation process follows these steps:
1

Clone Template Repository

Chapi clones the specified template repository to your chosen location.
2

Clean Git Metadata

Removes the original .git folder to start fresh.
3

Customize Structure

Renames all project files, folders, and namespaces to match your project name.
4

Initialize Git

Creates a new Git repository for your project.
5

Configure Remote (Optional)

Associates your remote repository if provided.
6

Register in Workspace

Adds the project to Chapi’s workspace for easy management.

Creating a Project

Create a new project from a template without remote repository:
var request = new CreateProjectRequest(
    ProjectName: "MyNewApp",
    ParentDirectory: @"C:\Projects",
    TemplateUrl: "https://github.com/myorg/wpf-template.git",
    RemoteUrl: null
);

var result = await createProjectUseCase.ExecuteAsync(request);
The ProjectName will be used to rename all template references throughout the codebase.

Request Parameters

ProjectName
string
required
The name for your new project. Used to rename template files and namespaces.
ParentDirectory
string
required
The directory where the project folder will be created.
TemplateUrl
string
required
Git URL of the template repository to clone.
RemoteUrl
string
Optional remote repository URL to associate with the new project.

Template Customization

The template service automatically renames:

Files & Folders

  • Solution files (.sln)
  • Project files (.csproj)
  • Directory names
  • File names

Code Content

  • Namespaces
  • Assembly names
  • Class references
  • Configuration values

Error Handling

Error: El directorio ya existe: C:\Projects\MyNewAppSolution: Choose a different project name or delete the existing directory.
Error: Clone operation failsPossible Causes:
  • Invalid template URL
  • Network connectivity issues
  • Authentication required
Solution: Verify the template URL and ensure you have access to the repository.
Error: Template renaming failsPossible Causes:
  • File locks from IDE or file explorer
  • Insufficient permissions
Solution: Close all open files and ensure you have write permissions.

Result Structure

if (result.IsSuccess)
{
    string projectPath = result.Value;
    // Example: "C:\\Projects\\MyNewApp"
    Console.WriteLine($"Project created at: {projectPath}");
}
else
{
    Console.WriteLine($"Error: {result.Error}");
}
Success: Returns the full path to the created project directory.

What Happens Next

After successful creation:
  1. Project is registered in Chapi’s workspace manager
  2. Git repository is initialized with no commits
  3. Remote is configured (if RemoteUrl provided)
  4. Project is ready for code generation and development
You can immediately start generating modules and code after project creation without any additional setup.

Best Practices

Template Selection

Use templates that match your architecture style (Clean Architecture, DDD, etc.)

Naming Conventions

Use PascalCase for project names to match C# conventions

Remote Repository

Create the remote repository before project creation for seamless setup

Directory Organization

Keep all projects in a consistent parent directory structure

Workspace Management

Learn how to manage multiple projects in Chapi

Git Management

Configure Git settings and manage version control

Code Generation

Generate modules and code in your new project

Build docs developers (and LLMs) love