YO. THIS IS A FREAKIN’ ASP.NET Core Web API Template. It’s got layers. It’s got JWT auth. It’s got file handling. Basically, it’s BUILT DIFFERENT. 🚀
- API Layer – HTTP requests go brrrr 💨
- Application Layer – Business logic happens here, nerd
- Domain Layer – The pure, untouchable core entities
- Infrastructure Layer – Where the database magic lives
-
🔥 Authentication & Authorization 🔥
- JWTs with refresh token sorcery 🪄
- Role-based nonsense (Admin vs Peasant)
- Registration & login because DUH
- Change password so you can regret your choices
- Google Authentication for the cool kids 🔍
-
📂 File Management
- Upload stuff 📤
- Image storage 📸
- Configurable like your coffee ☕
-
🛢️ Data Access
- Entity Framework Core (EF Core) because raw SQL is pain
- Repositories for that clean, crisp data handling ✨
- Unit of Work because transactions exist
- Migrations because "Works on my machine" isn't good enough
-
🛠️ API Configuration
- DI setup because manual dependency management is suffering
- OpenAPI/Swagger docs so people actually use this
- Environment-specific configs (yes, PROD and DEV are different)
- .NET 6.0+ (stay up to date, kids)
- SQL Server (or something compatible, we don’t judge)
- Visual Studio 2022 or VS Code (pick your poison)
- Clone it.
git clone https://github.com/Ozzy-ZY/api-template.git
- Enter the void.
cd api-template
- Configure your secrets (aka database connection).
"ConnectionStrings": { "DefaultConnection": "Server=YOUR_SERVER;Database=YOUR_DB;Trusted_Connection=True;MultipleActiveResultSets=true" }
- Summon the database.
dotnet ef database update
- Summon the API overlords.
dotnet run --project API
- Swagger lives here →
https://localhost:7282/Scalar/v1
API_Template/
├── API/
│ ├── Controllers/ (Here be endpoints 🛑)
│ │ ├── AuthController.cs (Login, Register, etc.)
│ │ ├── TestController.cs (Just vibes 🤷♂️)
│ │ └── UserController.cs (User stuff 👤)
│ ├── wwwroot/
│ │ └── uploads/ (Where your cursed files go)
│ ├── appsettings.json (Configs, don’t touch if scared)
│ └── Program.cs (API bootup magic 🏎️)
│
├── Application/
│ ├── DTOs/ (Data but with ✨ structure ✨)
│ ├── Services/ (The real work happens here)
│ └── Validators/ (STOP BAD INPUTS 🚫)
│
├── Domain/
│ ├── Models/ (Entities, aka the data lords)
│ ├── ModelsConfig/ (Mapping rules because EF Core needs them)
│
└── Infrastructure/
└── DataAccess/
├── Repositories/ (Data handlers 📦)
├── Migrations/ (DB evolution, survival of the fittest)
- Register – Sign up (yay, new user!)
POST /api/auth/RegisterUser
- Login – Get a token, prove you're cool
POST /api/auth/loginUser
- Google Login – Let the big G vouch for you 🌐
GET /api/googleauth/login
- Refresh Token – Because tokens expire like milk 🥛
POST /api/auth/RefreshToken
- Change Password – When you forget your dog's birthday
POST /api/auth/Logout
- Make a new
.cs
file inAPI/Controllers
- Inherit
ControllerBase
- Add
[Route]
,[HttpGet]
, etc. - Deploy. Dominate. 🚀
- Create it in
Domain/Models/
- Config it in
Domain/ModelsConfig/
- Add it to
AppDbContext
- Migrate (
dotnet ef migrations add SomethingCool
)
- Fork it. 📌
- Make a branch. 🌿
git checkout -b feature/amazing-feature
- Commit your masterpiece. 🎨
git commit -m "Add some amazing feature"
- Push it real good. 🚀
git push origin feature/amazing-feature
- Open a Pull Request. 🛠️
🔥 Made with caffeine, sleepless nights, and questionable decisions. 🔥