# practicajs/practica architecture

> Architecture diagram of the GitHub repository practicajs/practica, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/practicajs/practica
- Repository: https://github.com/practicajs/practica

## Overview

##### Code Generator Core
- Entry Points Layer
- Generation Logic Layer
- Templates Layer

##### Generated Application Structure
- Service Layer
- Libraries Layer
- Infrastructure Components

##### Code Generator Core Section

**┌─ Code Generator Core ─────────────────────────┐**

- ┌─ Entry Points ──┐    ┌─ Generation Logic ─┐│
- CLI           │───>│ - Feature Chooser  ││
- Interactive   │    │ - Template Engine  ││
- ┘    └──────────────────┘ ││

- ┌─ Templates ───────────────┘              ││
- Express Templates                      ││
- Fastify Templates                      ││
- ORM Templates                          ││
- ┘ ││
- ┘

##### Generated Application Structure Section

**┌─ Generated Application ──────────────────────┐**

- ┌─ Services ────┐    ┌─ Libraries ─────────┐│
- Order Service │────│ - Error Handling    ││
- ┘    │ - Configuration     ││
- Validation        ││
- Logger            ││
- ┘│

- ┌─ Infrastructure ────────────────────────┐ │
- Docker                               │ │
- Database (PostgreSQL/Other)          │ │
- API Layer (Express/Fastify)          │ │
- ┘ │
- ┘

##### Interaction Flows

- User input → Generator
- Generator → Templates
- Templates → Generated Application
- Inter-service communication in generated app
- Service → Infrastructure dependencies

##### Additional Elements

Include:
- Version information
- Supported frameworks and ORMs
- Best practices implementation points

##### Modularity
- How the generated code is organized in a monorepo structure
- Separation between services and shared libraries
- Where custom code can be added

##### Technology Choices
- Where framework choices can be made (Express/Fastify)
- ORM integration points (Prisma/Sequelize)
- Database connectivity

##### Testing & Quality
- Test implementation points
- CI/CD integration
- Quality check implementations

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph CodeGeneratorCore["Code Generator Core"]
        direction TB
        EntryPoints["Entry Points"]
        GenLogic["Generation Logic"]
        Templates["Templates Layer"]
        
        subgraph EP["Entry Points Layer"]
            CLI["CLI Component"]
            InteractiveCLI["Interactive CLI"]
            NonInteractiveCLI["Non-Interactive CLI"]
        end
        
        subgraph GL["Generation Logic Layer"]
            FeatureChooser["Feature Chooser"]
            ServiceGen["Service Generator"]
        end
        
        subgraph TL["Templates Layer"]
            ExpressTemplates["Express Templates"]
            FastifyTemplates["Fastify Templates"]
            ORMTemplates["ORM Templates"]
        end
    end
    
    subgraph GeneratedApp["Generated Application"]
        direction TB
        subgraph Services["Services Layer"]
            OrderService["Order Service"]
            DomainLogic["Domain Logic"]
            APILayer["API Layer"]
            DataAccess["Data Access"]
        end
        
        subgraph Libraries["Libraries Layer"]
            ErrorHandling["Error Handling"]
            Configuration["Configuration"]
            Validation["Validation"]
            Logger["Logger"]
        end
        
        subgraph Infrastructure["Infrastructure Layer"]
            Docker["Docker"]
            Database["Database"]
            APIInfra["API Infrastructure"]
            Testing["Testing Infrastructure"]
        end
    end
    
    EP --> GL
    GL --> TL
    TL --> GeneratedApp
    
    OrderService --> Libraries
    OrderService --> Infrastructure
    
    %% Component Mappings
    click CLI "https://github.com/practicajs/practica/blob/main/src/code-generator/entry-points/cli-entry-point.ts"
    click InteractiveCLI "https://github.com/practicajs/practica/blob/main/src/code-generator/entry-points/interactive-cli.tsx"
    click NonInteractiveCLI "https://github.com/practicajs/practica/blob/main/src/code-generator/entry-points/non-interactive-cli.ts"
    click FeatureChooser "https://github.com/practicajs/practica/tree/main/src/code-generator/generation-logic/features/"
    click ServiceGen "https://github.com/practicajs/practica/blob/main/src/code-generator/generation-logic/generate-service.ts"
    click ExpressTemplates "https://github.com/practicajs/practica/tree/main/src/code-templates/libraries/common-express-middlewares/"
    click FastifyTemplates "https://github.com/practicajs/practica/tree/main/src/code-templates/libraries/common-fastify-plugins/"
    click OrderService "https://github.com/practicajs/practica/tree/main/src/code-templates/services/order-service/"
    click DomainLogic "https://github.com/practicajs/practica/tree/main/src/code-templates/services/order-service/domain/"
    click APILayer "https://github.com/practicajs/practica/tree/main/src/code-templates/services/order-service/entry-points-express/"
    click DataAccess "https://github.com/practicajs/practica/tree/main/src/code-templates/services/order-service/data-access/"
    click ErrorHandling "https://github.com/practicajs/practica/tree/main/src/code-templates/libraries/error-handling/"
    click Configuration "https://github.com/practicajs/practica/tree/main/src/code-templates/libraries/configuration-provider/"
    click Validation "https://github.com/practicajs/practica/tree/main/src/code-templates/libraries/validation/"
    click Logger "https://github.com/practicajs/practica/tree/main/src/code-templates/libraries/logger/"
    click Docker "https://github.com/practicajs/practica/tree/main/src/code-templates/services/order-service/Dockerfile"
    click Database "https://github.com/practicajs/practica/tree/main/src/code-templates/services/order-service/data-access/migrations/"
    click Testing "https://github.com/practicajs/practica/tree/main/src/code-templates/services/order-service/test/"
    
    %% Styling
    classDef generator fill:#2374ab
    classDef service fill:#2a9d8f
    classDef infrastructure fill:#264653
    classDef library fill:#e9c46a
    
    class CLI,InteractiveCLI,NonInteractiveCLI,FeatureChooser,ServiceGen,ExpressTemplates,FastifyTemplates,ORMTemplates generator
    class OrderService,DomainLogic,APILayer,DataAccess service
    class Docker,Database,APIInfra,Testing infrastructure
    class ErrorHandling,Configuration,Validation,Logger library
```
