UserService is a microservice responsible for all user-related operations within the flow OverStack platform. It provides user authentication with Keycloak for identity management and roles management.
- .NET 9 & C# — Core framework and language
- ASP.NET Core — HTTP API.
- Entity Framework Core with PostgreSQL — Data access (Repository & Unit of Work patterns) to PostgreSQL database
- Clean Architecture — Layered separation (Domain, Application, Infrastructure, Presentation)
- Decorator Pattern — allows behavior to be added to individual objects dynamically without affecting others. In this project, it is used to implement caching.
- Keycloak — OAuth2/OpenID Connect identity provider
- Hangfire — Hosted services for background jobs
- Redis — Caching layer
- Kafka — Message queue that listens to main events
- Hot Chocolate — GraphQL endpoint with built-in support for pagination, filtering, and sorting
- gRPC — High-performance RPC interface
- Observability — Traces, logs, and metrics collected via OpenTelemetry and Logstash, exported to Aspire dashboard, Jaeger, ElasticSearch, and Prometheus
- Monitoring & Visualization — Dashboards in Grafana, Kibana and Aspire
- Health Checks — Status endpoints to monitor service availability and dependencies
- xUnit & Coverlet — Automated unit and integration testing with code coverage
- SonarQube & Qodana — Code quality and coverage analysis
This service follows the principles of Clean Architecture. The solution is split into multiple projects that correspond to each architectural layer.
Layer | Project |
---|---|
Presentation | UserService.Grpc, UserService.GraphQl, UserService.Api |
Application | UserService.Application |
Domain | UserService.Domain |
Infrastructure | UserService.BackgroundJobs, UserService.Cache, UserService.DAL, UserService.Keycloak, UserService.Messaging |
Full system design on Miro: Application Structure Board
- .NET 9 SDK
- Docker Desktop
- Running service dependencies
-
Clone the repo
-
Configure
appsettings.json
and.NET User Secrets
inUserService.Api
with your database, Redis, and Keycloak settings. Example:{ "ConnectionStrings": { "PostgresSQL": "Server=localhost;Port=5433; Database=user-service-db; User Id=<YOUR-USER-ID>; Password=<YOUR-PASSWORD>" }, "KeycloakSettings": { "AdminToken": "<YOUR-TOKEN>" }, "RedisSettings": { "Password": "<YOUR-PASSWORD>" } }
-
Start supporting services:
docker-compose -p flowoverstack -f docker-compose.common.yml up -d docker-compose -p userservice -f docker-compose.yml up -d
-
Run the API:
cd UserService.Api dotnet run
The following endpoints are available by default:
UseHttpsForRestApi |
REST API & Swagger | GraphQL Endpoint | gRPC Endpoint |
---|---|---|---|
true |
https://localhost:7163/swagger | https://localhost:7163/graphql | https://localhost:7163 http://localhost:5044 |
false |
http://localhost:7163/swagger | http://localhost:7163/graphql | http://localhost:5044 |
Run unit and functional tests:
cd UserService.Tests
dotnet test --filter Category=Functional
dotnet test --filter Category=Unit
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to your branch
- Open a Pull Request
Please follow the existing code conventions and include tests for new functionality. You are also welcome to open issues for bug reports, feature requests, or to discuss improvements.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or suggestions open an issue.