A modern quote generator built with microservices architecture, demonstrating best practices in web development. Built with Node.js, ASP.NET Core, TypeScript, React, Nodejs, MongoDB, PostgreSQL, RabbitMQ, Docker, Prometheus, Grafana and Kubernetes. Features include: Clean Architecture, DDD, Event-Driven Architecture, CQRS, automated testing, and comprehensive API documentation.
Built with a focus on scalability, reliability and performance, this application demonstrates modern backend development best practices including:
- Clean Architecture principles
- Domain-Driven Design
- Event-Driven Architecture
- SOLID principles
- Comprehensive testing
- Docker containerization
- Auth Service: Node.js + TypeScript + Fastify + MongoDB
- Quote Service: Node.js + TypeScript + Fastify + MongoDB
- User Service: ASP.NET Core 8.0 + PostgreSQL
- API Gateway: Node.js + TypeScript + Fastify
- Framework: React 18
- State Management: Redux Toolkit
- Styling: CSS Modules
- Build Tool: Vite
- Message Broker: RabbitMQ
- Databases:
- MongoDB (Auth & Quotes)
- PostgreSQL (Users)
- Containerization: Docker + Docker Compose
- API Documentation: Swagger/OpenAPI
- Domain Layer (Entities, Value Objects)
- Application Layer (Use Cases, DTOs)
- Infrastructure Layer (Repositories, External Services)
- Interface Layer (Controllers, Presenters)
- Bounded Contexts
- Aggregates
- Value Objects
- Domain Events
- Repository Pattern
- Asynchronous Communication
- Message Queues
- Event Publishing/Subscription
- Event Sourcing
- Separate Command and Query Models
- Optimized Read/Write Operations
- Repository Pattern
- Factory Pattern
- Strategy Pattern
- Observer Pattern
- Circuit Breaker
- Retry Pattern
- Decorator Pattern
- GitHub Actions
- Docker Containerization
- Infrastructure as Code
- Automated Testing
- Continuous Integration
- Continuous Deployment
- Unit Tests (Jest, xUnit)
- Integration Tests
- E2E Tests
- Test Coverage Reports
- Mocking & Stubbing
- JWT Authentication
- Role-Based Access Control
- API Gateway Security
- Input Validation
- Rate Limiting
- CORS Configuration
- TypeScript for Type Safety
- ESLint & Prettier
- SOLID Principles
- Clean Code Practices
- Code Reviews
- Documentation
The application consists of several independent microservices:
- API Gateway: Single entry point for clients
- Auth Service: Authentication and JWT management
- Quote Service: Quote management and retrieval
- User Service: User profiles and preferences management
- Frontend: React user interface
- Synchronous communication via HTTP/REST between services
- Asynchronous communication via RabbitMQ for events
- JWT for inter-service security
sequenceDiagram
participant Client
participant Gateway
participant AuthService
participant QuoteService
participant UserService
participant RabbitMQ
Client->>Gateway: POST /auth/login
Gateway->>AuthService: Forward login request
AuthService->>AuthService: Validate credentials
AuthService-->>Gateway: Return JWT token
Gateway-->>Client: Return JWT token
Client->>Gateway: GET /quotes/random (with JWT)
Gateway->>Gateway: Validate JWT
Gateway->>QuoteService: Forward request
QuoteService->>QuoteService: Generate random quote
QuoteService->>RabbitMQ: Publish quote.viewed event
QuoteService-->>Gateway: Return quote
Gateway-->>Client: Return quote
RabbitMQ->>UserService: Consume quote.viewed event
UserService->>UserService: Update user history
sequenceDiagram
participant Client
participant Gateway
participant QuoteService
participant UserService
participant RabbitMQ
Client->>Gateway: POST /quotes/:id/favorite
Gateway->>Gateway: Validate JWT
Gateway->>QuoteService: Forward favorite request
QuoteService->>RabbitMQ: Publish quote.favorited event
QuoteService-->>Gateway: Return success
Gateway-->>Client: Return success
RabbitMQ->>UserService: Consume quote.favorited event
UserService->>UserService: Add to favorites
UserService->>UserService: Update user stats
sequenceDiagram
participant Client
participant Gateway
participant AuthService
participant UserService
participant RabbitMQ
Client->>Gateway: POST /auth/register
Gateway->>AuthService: Forward register request
AuthService->>AuthService: Validate input
AuthService->>AuthService: Hash password
AuthService->>AuthService: Create user
AuthService->>RabbitMQ: Publish user.created event
AuthService-->>Gateway: Return success + JWT
Gateway-->>Client: Return success + JWT
RabbitMQ->>UserService: Consume user.created event
UserService->>UserService: Create user profile
UserService->>UserService: Initialize preferences
- Node.js >= 20.x
- Docker & Docker Compose
- Clone the repository:
git clone https://github.com/your-username/quote-generator.git
cd quote-generator- Install dependencies:
npm install- Configuration:
- Copy
.env.exampleto.env - Adjust environment variables
- Start services:
# Development mode
npm run dev
# Production mode
npm run prod- Single entry point
- Request routing
- JWT validation
- CORS configuration
- User registration/login
- JWT generation/validation
- User event publishing
- Quote CRUD operations
- Search and filtering
- Random quote generation
- Tags and categories
- User profiles
- Reading preferences
- Favorite quotes
- Usage statistics
- Modern React interface
- Redux state management
- Offline support
- Responsive design
The application leverages RabbitMQ for asynchronous service communication:
- USER_CREATED
- USER_UPDATED
- USER_DELETED
- QUOTE_VIEWED
- QUOTE_FAVORITED
- QUOTE_UNFAVORITED
# Unit tests
npm run test
# Coverage report
npm run test:coverage Swagger documentation is available at:
- Gateway:
/documentation - Auth:
/documentation - Quote:
/documentation - User:
/documentation
Key environment variables needed:
# JWT Configuration
JWT_SECRET=your_jwt_secret
JWT_EXPIRES_IN=1h
# Services URLs
AUTH_SERVICE_URL=http://localhost:3001
QUOTE_SERVICE_URL=http://localhost:3002
USER_SERVICE_URL=http://localhost:3003
# MongoDB Configuration
MONGO_URL=mongodb://localhost:27017/quote_generator
# RabbitMQ
MESSAGE_BROKER_URL=amqp://guest:guest@localhost:5672Build and run with Docker Compose:
# Build services
docker-compose build
# Start services
docker-compose up
# Start services with build
docker-compose up --build
# Stop services
docker-compose downOnce all services are running, you can access the application through your web browser:
- ESLint for linting
- Prettier for code formatting
- Husky for pre-commit hooks
- JWT authentication
- Rate limiting
- CORS protection
- Input validation
- Security headers
Distributed under the MIT License. See LICENSE for more information.

