English | Portugues
Servico API que analisa repositorios C# via Roslyn e gera documentacao tecnica automatizada em 7 formatos.
RVM.DocForge e um servico API que analisa automaticamente repositorios C# e gera documentacao abrangente. Utiliza Roslyn para analise estatica de codigo, extrai endpoints de API, entidades de dominio e servicos, e entao gera multiplos formatos de documentacao: README, API Reference, Entity Schema, Architecture Overview, Dependency Graph, Service Catalog e Full Documentation. O sistema persiste snapshots de analise e documentos gerados em PostgreSQL para rastreamento historico.
| Camada | Tecnologia |
|---|---|
| Runtime | .NET 10 / ASP.NET Core 10 |
| Analise de codigo | Roslyn (Microsoft.CodeAnalysis) 5.0 |
| Geracao Markdown | Markdig 0.40 |
| ORM | Entity Framework Core 10 |
| Banco de dados | PostgreSQL (Npgsql 10.0) |
| Logging | Serilog (AspNetCore 10.0, Compact 3.0) |
| Autenticacao | API Key customizada |
| Testes | xUnit 2.9 + Moq 4.20 + EF Core InMemory |
| Cobertura | Coverlet 6.0 |
┌──────────────────────────────────────────────────┐
│ API Layer │
│ RVM.DocForge.API (net10.0) │
│ Controllers ─ Services ─ Generators ─ Roslyn │
│ Auth ─ Middleware ─ Health ─ DTOs │
├──────────────────────────────────────────────────┤
│ Domain Layer │
│ RVM.DocForge.Domain (net10.0) │
│ Entities ─ Enums ─ Interfaces ─ Models │
├──────────────────────────────────────────────────┤
│ Infrastructure Layer │
│ RVM.DocForge.Infrastructure (net10.0) │
│ DbContext ─ Configurations ─ Repositories │
└──────────────────────────────────────────────────┘
Patterns: Clean Architecture (3 camadas), Strategy Pattern (7 Document Generators), Visitor Pattern (CSharpSyntaxWalker), Repository Pattern, Dependency Injection
RVM.DocForge/
├── src/
│ ├── RVM.DocForge.API/
│ │ ├── Auth/
│ │ │ ├── ApiKeyAuthHandler.cs
│ │ │ └── ApiKeyAuthOptions.cs
│ │ ├── Controllers/
│ │ │ ├── AnalysisController.cs
│ │ │ ├── DocumentsController.cs
│ │ │ └── ProjectsController.cs
│ │ ├── Dtos/
│ │ │ ├── AnalysisDtos.cs
│ │ │ ├── DocumentDtos.cs
│ │ │ └── ProjectDtos.cs
│ │ ├── Health/
│ │ │ └── DatabaseHealthCheck.cs
│ │ ├── Middleware/
│ │ │ └── CorrelationIdMiddleware.cs
│ │ ├── Services/
│ │ │ ├── Generators/
│ │ │ │ ├── IDocumentGenerator.cs
│ │ │ │ ├── ReadmeGenerator.cs
│ │ │ │ ├── ApiReferenceGenerator.cs
│ │ │ │ ├── EntitySchemaGenerator.cs
│ │ │ │ ├── ArchitectureOverviewGenerator.cs
│ │ │ │ ├── DependencyGraphGenerator.cs
│ │ │ │ ├── ServiceCatalogGenerator.cs
│ │ │ │ └── FullDocumentationGenerator.cs
│ │ │ ├── Roslyn/
│ │ │ │ ├── EndpointExtractor.cs
│ │ │ │ ├── EntityExtractor.cs
│ │ │ │ └── ServiceExtractor.cs
│ │ │ ├── DocumentationOrchestrator.cs
│ │ │ └── RepositoryAnalyzerService.cs
│ │ ├── Components/
│ │ │ ├── Layout/
│ │ │ └── Pages/
│ │ ├── Program.cs
│ │ └── appsettings.json
│ ├── RVM.DocForge.Domain/
│ │ ├── Entities/
│ │ │ ├── DocumentationProject.cs
│ │ │ ├── ProjectSnapshot.cs
│ │ │ ├── GeneratedDocument.cs
│ │ │ ├── DiscoveredEndpoint.cs
│ │ │ ├── DiscoveredEntity.cs
│ │ │ └── DiscoveredService.cs
│ │ ├── Enums/
│ │ │ ├── DocumentType.cs
│ │ │ ├── DocumentationStatus.cs
│ │ │ └── OutputFormat.cs
│ │ ├── Interfaces/
│ │ │ ├── IDocumentationProjectRepository.cs
│ │ │ ├── IGeneratedDocumentRepository.cs
│ │ │ └── IProjectSnapshotRepository.cs
│ │ └── Models/
│ │ └── AnalysisModels.cs
│ └── RVM.DocForge.Infrastructure/
│ ├── Data/
│ │ ├── DocForgeDbContext.cs
│ │ └── Configurations/
│ │ ├── DiscoveredItemsConfiguration.cs
│ │ ├── DocumentationProjectConfiguration.cs
│ │ └── ProjectSnapshotConfiguration.cs
│ ├── Repositories/
│ │ ├── DocumentationProjectRepository.cs
│ │ ├── GeneratedDocumentRepository.cs
│ │ └── ProjectSnapshotRepository.cs
│ └── DependencyInjection.cs
├── test/
│ └── RVM.DocForge.Test/
│ ├── Generators/
│ │ └── GeneratorTests.cs
│ ├── Repositories/
│ │ └── RepositoryTests.cs
│ └── Roslyn/
│ ├── EndpointExtractorTests.cs
│ ├── EntityExtractorTests.cs
│ └── ServiceExtractorTests.cs
├── docker-compose.dev.yml
├── docker-compose.prod.yml
├── global.json
└── RVM.DocForge.slnx
- .NET 10 SDK (10.0.201+)
- PostgreSQL 15+
- Docker (opcional, para docker-compose)
git clone https://github.com/rvenegas5/RVM.DocForge.git
cd RVM.DocForgeEdite src/RVM.DocForge.API/appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=docforge;Username=postgres;Password=SuaSenha"
},
"ApiKeys": {
"Keys": ["sua-api-key-aqui"]
}
}Ou via Docker Compose:
docker compose -f docker-compose.dev.yml up -ddotnet build
dotnet run --project src/RVM.DocForge.APIA API estara disponivel em https://localhost:5001.
| Metodo | Rota | Descricao |
|---|---|---|
POST |
/api/analysis/{projectId} |
Analisar repositorio |
GET |
/api/analysis/snapshots/{id} |
Detalhes do snapshot |
GET |
/api/analysis/project/{projectId}/snapshots |
Listar snapshots do projeto |
GET |
/api/projects |
Listar projetos |
GET |
/api/projects/{id} |
Detalhes do projeto |
POST |
/api/projects |
Criar projeto |
PUT |
/api/projects/{id} |
Atualizar projeto |
DELETE |
/api/projects/{id} |
Excluir projeto |
POST |
/api/documents/generate |
Gerar documentacao |
GET |
/api/documents/project/{projectId} |
Listar documentos do projeto |
GET |
/api/documents/{id} |
Detalhes do documento |
GET |
/api/documents/{id}/raw |
Markdown bruto |
DELETE |
/api/documents/{id} |
Excluir documento |
DELETE |
/api/documents/project/{projectId} |
Excluir documentos do projeto |
GET |
/health |
Health check |
Todos os endpoints (exceto
/health) requerem autenticacao via API Key.
dotnet test30 testes organizados em 3 suites:
| Suite | Arquivo | Testes | Cobertura |
|---|---|---|---|
| GeneratorTests | GeneratorTests.cs |
8 | 7 geradores de documentacao + cenario vazio |
| RepositoryTests | RepositoryTests.cs |
4 | CRUD de projetos, snapshots e documentos |
| EndpointExtractorTests | EndpointExtractorTests.cs |
6 | Extracao de rotas HTTP via Roslyn |
| EntityExtractorTests | EntityExtractorTests.cs |
7 | Extracao de classes, records, enums |
| ServiceExtractorTests | ServiceExtractorTests.cs |
5 | Extracao de interfaces e lifetimes DI |
- Analise automatizada de repositorios usando Roslyn
- Geracao de documentacao em 7 formatos (README, API Reference, Entity Schema, Architecture Overview, Dependency Graph, Service Catalog, Full Documentation)
- Rastreamento de snapshots com historico
- Extracao de endpoints de API (HttpGet, HttpPost, HttpPut, HttpDelete)
- Descoberta de entidades (classes, records, enums)
- Catalogo de servicos com deteccao de lifetime (Scoped, Singleton, Transient)
- Geracao de Markdown com Markdig
- Autenticacao por API Key com rate limiting
- Health check de banco de dados
- Correlation ID por requisicao
- Migracao automatica do banco ao iniciar
- Logging estruturado com Serilog (JSON compacto)
- Suporte a reverse proxy (Forwarded Headers)
- Docker Compose para dev e prod
Desenvolvido por RVM Tech