BlogCore
Powerful .NET 8 Blog API. Create your own custom front-end or explore a complete blog API. Contains Swagger, OAuth2, Clean code, Resource based authorization, Advanced search (Specification pattern) and much more.
Install / Use
/learn @VianneyDoleans/BlogCoreREADME
Live demo : https://blogcore.fly.dev/swagger
Powerful features
- Advanced search by combining criteria (filters) on all resources
- Advanced user permissions management by creating roles and permissions for users via the API at runtime (combination of Permission-Based Authorization & Resource-based Authorization)
- ex: create a role "mini-moderator" with the permissions CanEdit own Posts, CanDelete All Comments, etc.
- Default role(s) given to new users can also be defined via the API.
- Complete community features (create comments on a post, like a comment or a post, add a comment on a comment, consult profiles, etc.)
- Configurable log system that logs all user actions / events (implementation of Serilog library, can be connected to Kibana, Seq and other solutions, for monitoring)
- CRUD is provided on all resources. Everything can be manipulated via endpoints, giving the possibility out-of-the-box to develop an admin interface or a mobile app. (current Swagger interface can act as an administrator interface)
- Pagination strategy has been implemented.
- OAuth2.0 standard (access / refresh token) has been implemented for authorization.
- Email SMTP configuration : Email confirmation & password reset are provided by sending emails (can use Gmail SMTP server for example)
Clean code
- Good code coverage
- The Project was developed by relying on guidelines from DDD (Domain Driven Design) and Clean Code Book by Robert C. Martin.
- SonarCloud used to ensure code quality
- Implementation of End-to-End Testing to ensure the functioning of Blog Core API endpoints.
- Utilization of Resharper and SonarLint during the development process to enhance code quality and consistency.
- The project follows Conventional Commits and Git Feature Workflow with Develop Branch, ensuring a clean and organized git history with meaningful and clear commit messages.
- Code Quality is one of the main focuses on this project
Compatibilities
Compatible with Linux / Windows / MacOS and can be deployed with SQL Server or PostgreSQL database.
Docker is also available (Dockerfile at the root of the project).
Technologies
- .NET 8
- EntityFramework
- Microsoft Dependency Injection (DI)
- FluentValidation
- Serilog
- Swashbuckle (Swagger)
- xUnit
- Moq
- AutoMapper
Getting Started
Prerequisites
- Install Microsoft SQL Server or PostgreSQL
- Visual Studio (or Rider with Entity Framework Core UI Plugin)
Installation
- Open
appsettings.jsonfile inside BlogCoreAPI project and edit the database settings :
For Microsoft SQL Server :
"DatabaseProvider": "MsSQL",
"ConnectionStrings": {
"Default": "Server=.;Database=BlogCore;Integrated Security=True;TrustServerCertificate=True;"
}
For PostgreSQL :
"DatabaseProvider": "PostgreSQL",
"ConnectionStrings": {
"Default": "Host=localhost;Port=5432;Database=BlogCore;Username=postgres;Password=[YourPassword];"
}
Then in visual studio :
- Set BlogCoreApi as project to run
- Open the Package Manager Console (Tools -> Nuget Package Manager -> Package Manager Console).
- In the package Manager Console, select DBAccess as Default project
- Run the following commands:
- Microsoft SQL Server
Add-Migration CreateInitialDatabase -Context MsSqlDbContext
Update-Database -Context MsSqlDbContext
- PostgreSQL
Add-Migration CreateInitialDatabase -Context PostgreSqlDbContext
Update-Database -Context PostgreSqlDbContext
- Now press F5 and run the application.
- Refresh the page. The API was busy filling the default data in the database. Now it can respond.
Default Users, Roles and Permissions
Users
Default users are :
| User | Password | Role(s) | | ----------- |:----------------:| :--------------| | Sam | 0a1234A@ | User | | Frodon | 0a0000A@ | User | | Jamy | 0JamyRedactA@ | User, Redactor | | Fred | 0FredRedactA@ | User, Redactor | | AdminUser | 0adminPasswordA@ | User, Admin |
Defalt Roles and Permissions
Roles and permissions can be created / configured by API endpoints.
The default configuration is :
User :
| | CanRead | CanCreate | CanUpdate | CanDelete | | -----------|:-------:| :--------:|:---------:|:----------:| | Category | All | | | | | Comment | All | Own | Own | Own | | Like | All | Own | Own | Own | | Post | All | | | | | Tag | All | | | | | User | All | X | X | X | | Role | All | | | | | Permission | All | | X | | | Account | Own | | Own | Own |
Redactor :
| | CanRead | CanCreate | CanUpdate | CanDelete | | -----------|:-------:| :--------:|:---------:|:----------:| | Category | | All | | | | Comment | | | | | | Like | | | | | | Post | | Own | Own | Own | | Tag | | All | | | | User | | X | X | X | | Role | | | | | | Permission | | | X | | | Account | | | | |
Admin :
| | CanRead | CanCreate | CanUpdate | CanDelete | | -----------|:-------:| :--------:|:---------:|:----------:| | Category | All | All | All | All | | Comment | All | All | All | All | | Like | All | All | All | All | | Post | All | All | All | All | | Tag | All | All | All | All | | User | All | X | X | X | | Role | All | All | All | All | | Permission | All | All | X | All | | Account | All | All | All | All |
Wiki
A wiki for this project is available on github : link
The wiki give more explanations about configuration, online deployment (render, heroku) and architecture of the project.
Related Skills
gh-issues
342.0kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
oracle
342.0kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
tmux
342.0kRemote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
xurl
342.0kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
