A lightweight GraphQLAPI built with ASP.NET Core and Entity Framework Core.
MiniBlogAPI allows users to create profiles, publish posts, like posts, search for other users, subscribe to real-time updates and much more.
- 🔐 User management (create, query by ID, list users)
- 📰 Post creation and listing
- ❤️ Like system
- ⚡ Real-time subscriptions (GraphQL subscriptions for new posts)
- 🧠 Built with:
- ASP.NET Core / EF Core
- HotChocolate GraphQL
- SQL Sever
git clone https://github.com/artemshii/MiniBlogAPI.git
cd MiniBlogAPICreate and edit your appsettings.json file:
"ConnectionStrings": {
"DefaultConnection": "Your connection link"
}dotnet ef database updatedotnet runBy default, the GraphQL Playground will be available at:
👉 https://localhost:5001/graphql
Below are example GraphQL queries, mutations, and subscriptions you can test directly in the Nitro Playground.
query {
allUsers(offset: 1, limit: 11) {
id
userName
}
}query {
allUsers(limit: 11) {
id
userName
}
}query {
usersById(id: 2) {
id
userName
}
}mutation {
createUser(_UserName: "John1092") {
userName
}
}mutation {
like(_UserId: 1, _PostId: 1) {
id
dataStamp
userId
user {
id
userName
}
postId
post {
id
dataStamp
text
publisherId
publisher {
userName
}
}
}
}subscription {
onPostCreated(userId: 1) {
id
dataStamp
text
}
}When a user with
id = 1creates a new post, subscribers will automatically receive it in real-time.
MiniBlogAPI/
├── ApplicationDbContext.cs # EF Core DB context
├── Controllers/ # GraphQL queries, mutations, and subscriptions
├── Models/ # Entity models (User, Post, Like)
├── Migrations/ # EF Core migrations
├── Program.cs # App entry point
└── appsettings.json # Configuration
- **C# / .NET **
- Entity Framework Core
- HotChocolate GraphQL
- SQL Server
- Nitro Playground