## Initialisation de projet SmartStack SmartStack Project Initialization

La commande `smartstack init` permet de creer rapidement un nouveau projet SmartStack avec une architecture Clean Architecture (.NET) et un frontend React pre-configure.

The `smartstack init` command allows you to quickly create a new SmartStack project with Clean Architecture (.NET) and a pre-configured React frontend.

💡

`smartstack init MyProject`

## Prerequis Prerequisites

🛠 .NET SDK >= 10.0
📗 Node.js >= 18.0
📦 npm >= 9.0

## Serveurs MCP requis Required MCP Servers

SmartStack utilise des serveurs MCP pour ameliorer l'experience de developpement. La commande `init` verifie automatiquement leur presence.

SmartStack uses MCP servers to enhance the development experience. The `init` command automatically checks for their presence.

Serveur | Fonction Function | Installation
--- | --- | ---
SmartStack MCP | Validation conventions, scaffolding, API docs Conventions validation, scaffolding, API docs | `claude mcp add smartstack`
Context7 MCP | Documentation libraries, exemples de code Library documentation, code examples | `claude mcp add context7 -- npx @upstash/context7-mcp -- --api-key YOUR_API_KEY`

⚠

##### MCP manquants

##### Missing MCP

Si les serveurs MCP ne sont pas installes, vous pouvez continuer avec l'option `--skip-mcp-check`, mais certaines fonctionnalites seront limitees.

If MCP servers are not installed, you can continue with the `--skip-mcp-check` option, but some features will be limited.

## Utilisation Usage

    smartstack init <project-name> [options]

### Options

Option | Description Description
--- | ---
`--full-stack` | Creer un projet Full Stack (Backend .NET + Frontend React) - par defaut Create Full Stack project (Backend .NET + Frontend React) - default
`--backend` | Creer uniquement le backend .NET Create backend .NET only
`--frontend` | Creer uniquement le frontend React Create frontend React only
`--db <type>` | Base de donnees: `sqlserver` (defaut), `postgresql`, `sqlite` Database: `sqlserver` (default), `postgresql`, `sqlite`
`--dry-run` | Simulation - affiche ce qui serait cree sans rien creer Simulation - shows what would be created without creating anything
`-y, --yes` | Mode non-interactif - utilise les valeurs par defaut Non-interactive mode - uses default values
`--skip-mcp-check` | Ignorer la verification des serveurs MCP Skip MCP servers verification

## Exemples Examples

    # Projet Full Stack avec wizard interactif
    smartstack init MyApp

    # Projet Full Stack avec SQL Server (mode rapide)
    smartstack init MyApp -y

    # Backend .NET uniquement avec PostgreSQL
    smartstack init MyApi --backend --db postgresql

    # Frontend React uniquement
    smartstack init MyWebApp --frontend

    # Simulation (dry-run)
    smartstack init MyApp --dry-run

## Structure du projet Project Structure

La commande cree la structure suivante (Clean Architecture) :

The command creates the following structure (Clean Architecture):

    {ProjectName}/
    ├── src/
    │   ├── {ProjectName}.Domain/           # Entites, Interfaces
    │   │   ├── Entities/
    │   │   ├── Interfaces/
    │   │   └── {ProjectName}.Domain.csproj
    │   ├── {ProjectName}.Application/      # Services, DTOs
    │   │   ├── Services/
    │   │   ├── DTOs/
    │   │   └── {ProjectName}.Application.csproj
    │   ├── {ProjectName}.Infrastructure/   # Data, Repositories
    │   │   ├── Data/
    │   │   │   └── {ProjectName}DbContext.cs
    │   │   ├── Repositories/
    │   │   └── {ProjectName}.Infrastructure.csproj
    │   └── {ProjectName}.Api/              # Controllers, Program.cs
    │       ├── Controllers/
    │       ├── Program.cs
    │       └── {ProjectName}.Api.csproj
    ├── tests/
    │   └── {ProjectName}.Tests/
    ├── web/
    │   └── {projectname}-web/              # Frontend React
    │       ├── src/
    │       ├── package.json
    │       └── vite.config.ts
    ├── {ProjectName}.sln
    ├── Directory.Build.props
    └── README.md

## Packages installes Installed Packages

### NuGet (Backend)

- `Microsoft.EntityFrameworkCore`
- `Microsoft.EntityFrameworkCore.Design`
- `Microsoft.EntityFrameworkCore.SqlServer` (ou PostgreSQL/SQLite)
- `Microsoft.AspNetCore.Authentication.JwtBearer`
- `Swashbuckle.AspNetCore`

### npm (Frontend)

- `@atlashub/smartstack-react`
- `react-router-dom`
- `axios`
- `i18next` / `react-i18next`
- `tailwindcss`

## Prochaines etapes Next Steps

1. ##### Configurer la connection string

   ##### Configure connection string

   Editez `appsettings.json` pour configurer votre base de donnees.

   Edit `appsettings.json` to configure your database.

2. ##### Creer la migration initiale

   ##### Create initial migration

       dotnet ef migrations add InitialCreate \
         -p src/{ProjectName}.Infrastructure \
         -s src/{ProjectName}.Api

3. ##### Appliquer la migration

   ##### Apply migration

       dotnet ef database update \
         -p src/{ProjectName}.Infrastructure \
         -s src/{ProjectName}.Api

4. ##### Lancer le backend

   ##### Start backend

       dotnet run --project src/{ProjectName}.Api

5. ##### Lancer le frontend

   ##### Start frontend

       cd web/{projectname}-web && npm run dev

## Fonctionnalites MCP MCP Features

### SmartStack MCP

Tool | Description Description
--- | ---
`validate_conventions` | Valide les conventions SQL, migrations, services, namespaces Validates SQL conventions, migrations, services, namespaces
`check_migrations` | Analyse les conflits EF Core entre branches Analyzes EF Core conflicts between branches
`scaffold_extension` | Genere du code (services, entites, controllers, components) Generates code (services, entities, controllers, components)
`api_docs` | Documentation API Swagger/OpenAPI Swagger/OpenAPI API documentation

### Context7 MCP

Tool | Description Description
--- | ---
`resolve-library-id` | Trouve l'ID Context7 d'une bibliotheque Finds the Context7 ID of a library
`query-docs` | Recupere la documentation et exemples de code a jour Retrieves up-to-date documentation and code examples