A sample ASP.NET Core Web API project designed for Unity games. This project showcases how to build secure, scalable game backend services using .NET 8 and prepare them for deployment on Azure.
- Built with .NET 8 Web API
- Designed for integration with Unity games
- Score submission endpoint with DTO modeling
- Swagger UI enabled for easy API testing
- Clean folder structure with Models and DTOs
- Ready to integrate:
- ✅ JWT Authentication
- ✅ Rate Limiting
- ✅ Logging
- ✅ API Keys / OAuth
- ✅ Azure App Service deployment
SampleGameApiWithDotNetAzure/
├── Controllers/
│ └── ScoreController.cs
├── Models/
│ └── ScoreSubmissionDto.cs
├── Program.cs
├── SampleGameApiWithDotNetAzure.csproj
└── README.md-
Clone the repository
git clone https://github.com/sindhusingh/SampleGameApiWithDotNetAzure.git cd SampleGameApiWithDotNetAzure -
Run the API
dotnet run
-
Test the API using Swagger Open your browser at http://localhost:5063/swagger
POST /submit-score
Request Body:
{
"playerId": "player123",
"score": 1500
}✅ Get All Player Scores
GET /scores
Endpoint: GET /scores
Response:
[
{
"playerId": "player123",
"score": 100
},
...
]Option 1: Manual run
dotnet run
Rebuilds and runs the project.
Must re-run manually after each code change.
Option 2: Auto-reload with file changes
dotnet watch run
Watches files and automatically restarts the app when code is changed.
Recommended during development!
- Authentication with PlayFab tokens
- Middleware for rate limiting
- API logging with Serilog
- Deployment to Azure App Service
- Environment-specific configs
- CI/CD pipeline setup
This is a foundational backend for Unity game developers looking to:
- Learn .NET Web API with real use cases
- Secure APIs using industry standards
- Host backend on Azure for global access
- Extend backend with analytics, leaderboards, and more
MIT License. Feel free to use and extend this project in your own Unity game backend.