How bariskisir/onionnet works
OnionNet is a .NET API for JWT authentication and user-scoped notes, exposing the same domain operations through REST, gRPC, and JSON WebSocket messages. The main flow is client request → protocol handler → application service → repositories/unit of work → SQLite, with a response returned through the originating protocol. The graph includes the documented database-backed logging and startup migration capabilities. WebSocket message-processing internals and several infrastructure details were not sampled, so those links are limited to documented behavior.
Main entry points: UnitOfWork.cs Unit of work · AuthService.cs Auth service · NoteService.cs Notes service · Repository.cs Generic repository
Components 22
Protocol entry points
- Auth REST
src/OnionNet.API/Controllers/AuthController.cs - Notes REST
src/OnionNet.API/Controllers/NotesController.cs - Auth gRPC
src/OnionNet.API/GrpcServices/AuthGrpcService.cs - Notes gRPC
src/OnionNet.API/GrpcServices/NotesGrpcService.cs - WebSocket handler
src/OnionNet.API/WebSockets/NotificationWebSocketHandler.cs - Message processor
src/OnionNet.API/WebSockets/Services/WebSocketMessageProcessor.cs
Application services
- Auth service
src/OnionNet.Application/Services/AuthService.cs - Notes service
src/OnionNet.Application/Services/NoteService.cs - Auth state
src/OnionNet.Domain/Entities/User.cs - Refresh tokens
src/OnionNet.Domain/Entities/RefreshToken.cs - Notes
src/OnionNet.Domain/Entities/Note.cs
Persistence and logging
- Unit of work
src/OnionNet.Infrastructure/Repositories/UnitOfWork.cs - User repository
src/OnionNet.Infrastructure/Repositories/UserRepository.cs - Token repository
src/OnionNet.Infrastructure/Repositories/RefreshTokenRepository.cs - Note repository
src/OnionNet.Infrastructure/Repositories/NoteRepository.cs - Generic repository
src/OnionNet.Infrastructure/Repositories/Repository.cs - EF context
src/OnionNet.Infrastructure/Data/AppDbContext.cs - SQLite logger
src/OnionNet.Infrastructure/Logging/SqliteLoggerProvider.cs
Runtime setup
- API startup
src/OnionNet.API/Program.cs
Other components
- API clients
- SQLite database
- Database file
Connections 26
- API clients → Auth REST: sends REST
- API clients → Notes REST: sends REST
- API clients → Auth gRPC: calls gRPC
- API clients → Notes gRPC: calls gRPC
- API clients → WebSocket handler: opens socket
- WebSocket handler → Message processor: processes messages
- Auth REST → Auth service: calls
- Auth gRPC → Auth service: calls
- Message processor → Auth service: dispatches auth
- Notes REST → Notes service: calls
- Notes gRPC → Notes service: calls
- Message processor → Notes service: dispatches notes
- Auth service → Unit of work: reads and saves
- Notes service → Unit of work: reads and saves
- Unit of work → User repository: coordinates
- Unit of work → Token repository: coordinates
- Unit of work → Note repository: coordinates
- User repository → Generic repository: inherits
- Token repository → Generic repository: inherits
- Note repository → Generic repository: inherits
- Generic repository → EF context: queries
- EF context → Database file: reads and writes
- API startup → EF context: runs migrations
- API startup → WebSocket handler: maps socket route
- API startup → SQLite logger: configures logging
- SQLite logger → Database file: writes logs