# jairojair/featuren architecture

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

- Interactive diagram: https://gitdiagram.com/jairojair/featuren
- Repository: https://github.com/jairojair/featuren

## Overview

##### Project type and purpose
- Featuren is an open-source, backend-focused application for managing feature flags (toggles) in production.
- It exposes a REST API (auth, users, services, features) and includes a CLI helper for project onboarding or batch operations.
- The README, docs/, and featuren/api/* modules confirm this is primarily a service-oriented tool rather than a full GUI web app.

##### File structure
- Top-level:
- cli.py – command-line entrypoint
- featuren/app.py – the main Flask (or similar) application bootstrap
- featuren/api/… – REST endpoint handlers (auth, users, services, features, status)
- featuren/models/… – ORM models (User, Service, Feature, FeaturesService)
- featuren/migrations/… – database migration scripts
- featuren/settings.py – configuration (DB URI, auth, etc.)
- Dockerfile, docker-compose.yml, Procfile – containerization and deployment configs
- docs/ and mkdocs.yml – project documentation
- tests/ – pytest suite for all API endpoints
- This suggests a classic three-layered backend service: HTTP layer, business/data layer (models + migrations), persistence layer (database), plus a CLI tool and documentation.

##### README for additional insights
- Confirms core purpose: “managing your features in production.”
- No built-in GUI, but API docs cover all operations.
- CI/CD integrations (Travis CI, Coveralls) indicate automated testing & coverage reporting.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        RESTClient["REST Client"]:::frontend
        CLITool["CLI Tool"]:::frontend
    end

    %% API Service Layer
    subgraph "API Service Layer"
        direction TB
        AppBootstrap["API Service Bootstrap"]:::service
        subgraph "Controllers"
            direction TB
            AuthCtrl["Authentication Controller"]:::service
            UsersCtrl["Users Controller"]:::service
            ServicesCtrl["Services Controller"]:::service
            FeaturesCtrl["Features Controller"]:::service
            StatusCtrl["Status Controller"]:::service
        end
        Middleware["Middleware Layer"]:::service
        AuthComp["Auth Component"]:::service
        subgraph "Models"
            direction TB
            UserModel["User Model"]:::service
            ServiceModel["Service Model"]:::service
            FeatureModel["Feature Model"]:::service
            FSModel["Feature-Service Association Model"]:::service
        end
        Settings["Configuration (settings.py)"]:::service
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        direction TB
        DB["Relational Database"]:::infra
        Migrations["DB Migrations"]:::devops
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        direction TB
        DockerfileNode["Dockerfile"]:::infra
        DockerCompose["docker-compose.yml"]:::infra
        ProcfileNode["Procfile"]:::infra
    end

    %% DevOps Layer
    subgraph "DevOps / CI-CD"
        direction TB
        Travis[".travis.yml"]:::devops
        Coverage[".coveragerc"]:::devops
        Tests["Test Suite"]:::devops
    end

    %% Documentation Layer
    subgraph "Documentation"
        direction TB
        DocsSrc["docs/"]:::docs
        Mkdocs["mkdocs.yml"]:::docs
    end

    %% Connections
    RESTClient -->|"HTTP REST"| AppBootstrap
    CLITool -->|"HTTP REST or DB"| AppBootstrap
    AppBootstrap -->|boots| AuthCtrl
    AppBootstrap -->|boots| UsersCtrl
    AppBootstrap -->|boots| ServicesCtrl
    AppBootstrap -->|boots| FeaturesCtrl
    AppBootstrap -->|boots| StatusCtrl
    AppBootstrap -->|loads| Middleware
    AppBootstrap -->|reads| Settings
    AuthCtrl -->|"calls"| Middleware
    UsersCtrl -->|"calls"| Middleware
    ServicesCtrl -->|"calls"| Middleware
    FeaturesCtrl -->|"calls"| Middleware
    StatusCtrl -->|"calls"| Middleware
    Middleware -->|"uses"| AuthComp
    AuthComp -->|"validates"| UserModel
    AuthComp -->|"validates"| ServiceModel
    AuthComp -->|"validates"| FeatureModel
    AuthComp -->|"validates"| FSModel
    AuthCtrl -->|"CRUD"| UserModel
    UsersCtrl -->|"CRUD"| UserModel
    ServicesCtrl -->|"CRUD"| ServiceModel
    FeaturesCtrl -->|"CRUD"| FeatureModel
    FeaturesCtrl -->|"CRUD"| FSModel
    ModelsDB[Models] -.->|maps to| DB
    Migrations -->|"migrates schema"| DB
    DockerCompose -->|orchestrates| AppBootstrap
    DockerCompose -->|orchestrates| DB
    DockerfileNode -->|builds image| AppBootstrap
    ProcfileNode -->|deploys| AppBootstrap
    Travis -->|runs| Tests
    Travis -->|builds| DockerfileNode
    Tests -->|covers| AuthCtrl
    Tests -->|covers| UsersCtrl
    Tests -->|covers| ServicesCtrl
    Tests -->|covers| FeaturesCtrl
    DocsSrc -->|built by| Mkdocs

    %% Click Events
    click CLITool "https://github.com/jairojair/featuren/blob/master/cli.py"
    click AppBootstrap "https://github.com/jairojair/featuren/blob/master/featuren/app.py"
    click AuthCtrl "https://github.com/jairojair/featuren/blob/master/featuren/api/auth.py"
    click UsersCtrl "https://github.com/jairojair/featuren/blob/master/featuren/api/users.py"
    click ServicesCtrl "https://github.com/jairojair/featuren/blob/master/featuren/api/services.py"
    click FeaturesCtrl "https://github.com/jairojair/featuren/blob/master/featuren/api/features.py"
    click StatusCtrl "https://github.com/jairojair/featuren/blob/master/featuren/api/status.py"
    click Middleware "https://github.com/jairojair/featuren/blob/master/featuren/middlewares.py"
    click AuthComp "https://github.com/jairojair/featuren/blob/master/featuren/components/auth.py"
    click UserModel "https://github.com/jairojair/featuren/blob/master/featuren/models/user.py"
    click ServiceModel "https://github.com/jairojair/featuren/blob/master/featuren/models/service.py"
    click FeatureModel "https://github.com/jairojair/featuren/blob/master/featuren/models/feature.py"
    click FSModel "https://github.com/jairojair/featuren/blob/master/featuren/models/features_service.py"
    click Migrations "https://github.com/jairojair/featuren/tree/master/featuren/migrations/"
    click DocsSrc "https://github.com/jairojair/featuren/tree/master/docs/"
    click Mkdocs "https://github.com/jairojair/featuren/blob/master/mkdocs.yml"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#1E90FF,color:#000;
    classDef service fill:#90EE90,stroke:#228B22,color:#000;
    classDef infra fill:#FFA500,stroke:#FF8C00,color:#000;
    classDef devops fill:#D3D3D3,stroke:#696969,color:#000;
    classDef docs fill:#E6E6FA,stroke:#9370DB,color:#000;
```
