Instruction file imported from vvasantg/RePlay (
.github/instructions/default.instructions.md). Copyright stays with the author.
Project Instructions
????????????????? (Project Structure)
/src/Api- Presentation Layer (Controllers, Middlewares)- Controller ????????????? Core Service ??????? Core ???????? ????????? Infrastructure ??????
/src/Core- Core/Application Layer (Core Services, Use Cases, DTOs, Business Logic)- Core Service ???????????????????????????? Infrastructure ???? Interface
/src/Domain- Domain Layer (Entities, Interfaces, Business Rules)/src/Infrastructure- Infrastructure Layer (Data Access, External Services)- ?????????? implement repository ???? external service ??? interface ??? Core ?????
/src/Tests- Unit & Integration Tests- ??????????????? unit test ??? controller ????
/src/Tests/Controllers/UserControllerTests.cs??????????????????????????????
- ??????????????? unit test ??? controller ????
/frontend- Front-end (UI/Client) ??????????????????? front-end ?????? back-end ????????????????????????????????????????
????????????????? (Prerequisites)
- .NET 8 SDK
- Visual Studio 2022
- (????? Front-end) Node.js, npm
- PostgreSQL (Database)
Database
- ??? PostgreSQL
- Connection:
Host=localhost;Port=5432;Username=moviehit_user;Password=MovieHit@2024;Database=RePlay - ???????? database ????????
RePlay??????????????
??????????????????????????????? (Setup & Run)
-
Clone ????????
git clone <your-repository-url> -
Restore packages
cd src/Api dotnet restore -
Build & Run
dotnet build dotnet run -
(????? Front-end)
cd frontend npm install npm run start -
?????????? Swagger UI (????? development mode)
- ???????? API ???? ????????????? Swagger UI ??????:
http://localhost:5000/swagger
(??????????????????????????????)
- ???????? API ???? ????????????? Swagger UI ??????:
??????????????? (Best Practices)
-
Clean Architecture: ?????????? Domain, Core, Infrastructure, Presentation
-
DTO: ??? Data Transfer Object ?????????/?????????
-
BaseEntity: ??????????? Entity ?? Domain ????????? BaseEntity ????????????????????
???????? BaseEntity:
namespace Domain.Entities { public abstract class BaseEntity { public int Id { get; set; } public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public string? CreatedBy { get; set; } public DateTime? UpdatedAt { get; set; } public string? UpdatedBy { get; set; } } }?????????????????:
public class User : BaseEntity { public string Name { get; set; } // ... property ???? ? } -
API Response Standardization: ??? endpoint ???????????????????????????? (Response Wrapper) ???? ?? status, message, data, error ???? ???????????????????????????? paging
-
Request/Response Logging (Sensitive Data Masking): ?????? log ??????????????? ?????????????????????? ???? password, token
-
OpenAPI/Swagger Enhancements: ??????????????? summary, description, ???????? request/response, response code ??? tag ??????? endpoint ?????????????? API ????????????????????
-
API Security Best Practices: ??????????????? ???? SQL Injection, XSS, CSRF, ??? HTTPS, ????????? request body, ?????? log ???????????
-
Localization/Globalization: ?????????????? (???????????????????????) ?????? resource file (.resx) ????????????????? ? ?????? back-end ????????????????? localization ??????? front-end ?????????????????????????????????????????????????
-
Validation: ????????????????????? DTO
-
Error Handling: ??? Exception Middleware
-
Dependency Injection: ?????? Service/Repository ???? DI Container
-
Logging: ??? ILogger ???????????? log ?????????????????????????? monitoring (???? Application Insights, ELK, Prometheus)
-
Health Check: ????? endpoint ?????? health check (???? /health) ????????????????????????
-
Authentication & Authorization: ?????? JWT, OAuth2 ????????????????????????????? ??? [Authorize] attribute
-
Caching: ??? MemoryCache, Distributed Cache ???? Redis ?????????????????????
-
Rate Limiting & Throttling: ??????????????? API ????????? ???? AspNetCoreRateLimit
-
Configuration Management: ??? config ??? environment ????????? environment variables
-
API Versioning: ???????????????????? API
-
Swagger/OpenAPI: ?????????? Swagger UI ??????????????? API ??????????????? summary, response code, ???????? request/response
-
CORS: ????? policy ?????? Cross-Origin Resource Sharing ??????????
-
Unit Test/Integration Test: ??????????????? unit test ??? controller (????
/src/Tests/Controllers/YourControllerTests.cs) ?????????????????????????????? -
Global Exception Handling: ??? Middleware ???????????? exception ?????? response ??????????
-
CI/CD: ??????? pipeline ?????? build, test, deploy ????????? (???? GitHub Actions, Azure DevOps)
-
Database Migration: ????????????? migration ???? EF Core Migrations ???? FluentMigrator ??????????? schema database
-
CONTRIBUTING.md & CHANGELOG.md: ????????? CONTRIBUTING.md ???????????????????????? ??? CHANGELOG.md ??????????????????????????????????????? ?????????????????????????????????????????????????????????????
???????? (Testing)
- ??????????????? unit test ??? controller ????
/src/Tests/Controllers/YourControllerTests.cs??????????????????????????????
cd src/Tests
dotnet test
??? deploy (Deployment)
- ?????? deploy ???? Docker, Azure, IIS ???? Platform ???? ?
- ??????????? build Docker:
docker build -t your-api-image . docker run -p 5000:80 your-api-image
???? ? (Others)
- ????????????????????????????? environment variables, CI/CD, ?????????????? ? ?????????
- ????????????????? Logging, Monitoring, Health Check, Auth, Caching, Rate Limiting, Exception Handling, Config, CI/CD, API Documentation, ??? CORS ??? Best Practices ???????????????????????????????????????
- ????????????????? Logging, Monitoring, Health Check, Auth, Caching, Rate Limiting, Exception Handling, Config, CI/CD, API Documentation, CORS, API Response Standardization, Request/Response Logging, OpenAPI/Swagger Enhancements, API Security Best Practices, Database Migration, Localization/Globalization (???????????????????????? front-end ????????), ??? CONTRIBUTING.md & CHANGELOG.md ??? Best Practices ???????????????????????????????????????