api/
├── app/
│ ├── __init__.py
│ ├── main.py # FastAPI app, CORS, lifespan, routers
│ ├── config.py # Pydantic BaseSettings (.env)
│ ├── database.py # SQLAlchemy async engine + session + auto-migrate
│ │
│ ├── models/ # SQLAlchemy ORM models
│ │ ├── user.py # User (perfil, plan, password hash)
│ │ ├── organization.py # Organization + Members con roles
│ │ ├── project.py # Project (slug, descripción, repo)
│ │ ├── skill.py # SkillDefinition + SkillConfiguration
│ │ ├── environment.py # EnvironmentProfile (CLI profiles + hooks)
│ │ ├── audit.py # AuditLog (inmutable)
│ │ ├── subscription.py # Subscription (Stripe)
│ │ └── api_key.py # APIKey (para CLI auth)
│ │
│ ├── schemas/ # Pydantic v2 request/response
│ │ ├── auth.py # Register, Login, Token, UserResponse
│ │ ├── project.py # Project, Environment, CLIProfile, Skill, ScriptHook
│ │ └── dashboard.py # DashboardStats, ActivityPoint, AuditEntry
│ │
│ ├── services/ # Lógica de negocio
│ │ ├── auth_service.py # JWT + bcrypt + register/login
│ │ ├── project_service.py # CRUD + freemium enforcement
│ │ ├── stats_service.py # Dashboard aggregations
│ │ ├── plan_enforcement.py # Límites Free/Premium/Enterprise
│ │ ├── seed_skills.py # Seed 12 skills al startup
│ │ └── admin_bootstrap.py # Bootstrap admin enterprise
│ │
│ ├── routers/ # Endpoints REST
│ │ ├── auth.py # /auth (6 endpoints)
│ │ ├── projects.py # /projects (9 endpoints)
│ │ ├── skills.py # /skills (3 endpoints)
│ │ ├── teams.py # /teams (4 endpoints)
│ │ ├── billing.py # /billing (5 endpoints)
│ │ ├── audit.py # /audit (1 endpoint filtrable)
│ │ └── dashboard.py # /dashboard (3 endpoints)
│ │
│ └── middleware/
│ └── auth.py # JWT dependency (get_current_user)
│
├── seed.py # Script de datos de demo
├── requirements.txt
├── .env.example
└── nexus.db # SQLite (auto-generada, solo desarrollo)