API RESTful em ASP.NET Core para cotações de Bitcoin em USD e BRL em tempo real.
Licença: MIT — Open source, use livremente! 📜
Bitcoin Price API é uma API profissional que fornece:
✅ Cotações em tempo real de Bitcoin (USD/BRL)
✅ Endpoints RESTful bem documentados
✅ Banco de dados com Entity Framework Core
✅ Autenticação preparada para integração
✅ C# moderno (.NET 8+, nullable reference types)
✅ Testes e documentação completos
- GET /api/moedas — Listar todas as moedas
- GET /api/moedas/{id} — Obter cotação específica
- POST /api/moedas — Cadastrar nova moeda
- PUT /api/moedas/{id} — Atualizar cotação
- DELETE /api/moedas/{id} — Remover moeda
- Swagger/OpenAPI — Documentação interativa
- Entity Framework Core — ORM integrado
- CI/CD — GitHub Actions automático
- .NET SDK 8.0 ou superior (Download)
- SQL Server ou SQLite (padrão)
- Git (para versionamento)
Verificar instalação:
dotnet --versionBitcoin-API/
├── Program.cs # Entry point e configuração
├── API.csproj # Configuração do projeto
├── API.sln # Solução Visual Studio
│
├── Controllers/
│ ├── MoedasController.cs # Endpoints de moedas
│ └── WeatherForecastController.cs
│
├── Models/
│ ├── Moeda.cs # Modelo de moeda
│ └── Produto.cs # Modelo de produto
│
├── Services/
│ └── CoinService.cs # Serviço de integração
│
├── Data/
│ └── AppDbContext.cs # DbContext do EF Core
│
├── Migrations/
│ └── (migrações do banco)
│
├── Properties/
│ └── launchSettings.json # Configuração de launch
│
├── appsettings.json # Configurações gerais
├── appsettings.Development.json # Config development
├── API.http # Testes de endpoints
│
├── .github/workflows/ # CI/CD
├── .gitignore
├── .editorconfig
├── LICENSE
└── README.md
git clone https://github.com/RafaelBatistaDev/ASP.NET-Core-Web-API-Bitcoin-USD-BRL-Live.git
cd ASP.NET-Core-Web-API-Bitcoin-USD-BRL-Livedotnet restore# Aplicar migrações
dotnet ef database updatedotnet runA API estará disponível em: https://localhost:7001
Swagger UI: https://localhost:7001/swagger
dotnet publish -c Release -o ./publish| Pacote | Versão | Propósito |
|---|---|---|
Microsoft.EntityFrameworkCore |
8.0+ | ORM - Acesso a dados |
Microsoft.EntityFrameworkCore.SqlServer |
8.0+ | Provider SQL Server |
Swashbuckle.AspNetCore |
6.0+ | Swagger/OpenAPI |
GET /api/moedas HTTP/1.1
Host: localhost:7001Response:
[
{
"id": 1,
"nome": "Bitcoin",
"simbolo": "BTC",
"precoUsd": 45000.00,
"precoBrl": 225000.00,
"dataAtualizacao": "2026-04-04T10:30:00"
}
]GET /api/moedas/1 HTTP/1.1
Host: localhost:7001POST /api/moedas HTTP/1.1
Content-Type: application/json
{
"nome": "Ethereum",
"simbolo": "ETH",
"precoUsd": 2500.00,
"precoBrl": 12500.00
}Edit appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=BitcoinApiDb;Trusted_Connection=true;"
}
}# Development
ASPNETCORE_ENVIRONMENT=Development
# Production
ASPNETCORE_ENVIRONMENT=Production# Criar projeto de testes
dotnet new xunit -n API.Tests
# Rodar testes
dotnet test
# Com cobertura
dotnet test /p:CollectCoverage=truedotnet publish -c Release
# Deploy via Azure PortalFROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY . .
RUN dotnet restore && dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app .
EXPOSE 80
ENTRYPOINT ["dotnet", "API.dll"]# Build e deploy automático
dotnet publish -c Release -o ./publishContribuições são bem-vindas!
- Fork o repositório
- Crie um branch (
git checkout -b feature/NewFeature) - Commit as mudanças (
git commit -m 'Add NewFeature') - Push para o branch (
git push origin feature/NewFeature) - Abra uma Pull Request
- ✅ C# moderno (C# 12+)
- ✅ Nullable reference types habilitado
- ✅ Async/await em todas APIs
- ✅ Services bem separados
- ✅ Testes unitários
- ✅ Documentação completa
Este projeto é 100% Open Source sob a licença MIT.
- ✅ Usar em projetos pessoais e comerciais
- ✅ Modificar e adaptar livremente
- ✅ Distribuir obras derivadas
- ✅ Usar privadamente
⚠️ Incluir cópia da licença MIT⚠️ Indicar mudanças significativas
- ✅ SQL Injection prevenido (Entity Framework)
- ✅ CORS configurável
- ✅ Validação de entrada
- ✅ Sem dados sensíveis no repositório
- ✅ Code open para auditoria
- Autenticação JWT
- Rate limiting
- Cache com Redis
- Webhooks para cotações
- Integração com mais exchanges
- Testes de integração
- Docker Compose
- Documentação GraphQL
Última atualização: 4 de abril de 2026
Versão: 1.0.0
Licença: MIT
Status: Production Ready ✅
Rafael Batista
🔗 GitHub: @RafaelBatistaDev
💼 LinkedIn: Seu Perfil