Modern applications are usually composed of multiple services (in addition to frontend, backend and database), where each service focuses on a specific responsibility.
Core Idea
A simple web application may start with:
Frontend
│
│ HTTP API
▼
Backend
│
│ Database Protocol
▼
Database
As applications become more complex, additional services are introduced:
User
|
v
Frontend
|
HTTP
|
v
Backend API
|
+------------------+------------------+
| | |
v v v
Database Cache Queue
|
v
Worker
|
v
AI / Jobs
+------------------+
|
v
Object Storage
Each service solves a different problem.
Cache
A cache is a fast temporary storage layer used to reduce repeated computation and database access. Instead of retrieving frequently accessed data from the database every time:
User
│
▼
Backend
│
▼
Cache
│
▼
Database (if cache miss)
Common use cases
- User sessions
- Frequently accessed data
- API response caching
Examples
- Redis
Queue
A message queue allows services to communicate asynchronously. Instead of waiting for a long-running task to complete:
User
│
▼
Backend
│enqueue job
▼
Queue
│
▼
Worker
│
▼
Long-running Task
Common use cases:
- Sending emails
- Data processing
- Model training
- Background jobs
Examples:
- RabbitMQ
- Kafka
- Redis Queue
Worker
A worker is a service responsible for executing background tasks. The backend usually does not directly perform expensive operations. Instead, it submits tasks to a queue, and workers process them separately.
Examples:
- Machine learning inference
- Data analysis
- File processing
- Report generation
Object Storage
Object storage is designed for storing large files rather than structured application data. A database usually stores metadata, while large objects are stored separately.
Backend
│
▼
Database
(metadata)
│
▼
Object Storage
(files)
Common use cases:
- Images
- Videos
- Machine learning models
- Large datasets
Examples:
- Amazon S3
- Garage
Authentication Service
Authentication services manage user identity and access control. Instead of every application implementing authentication independently:
User
│
▼
Authentication Service
│
▼
Backend
Common responsibilities:
- Login
- Identity verification
- Token management
- Permission control
Examples:
- OAuth
- Auth0
Scheduler
A scheduler automatically triggers tasks at predefined times. Example:
Every day at 02:00
│
▼
Backup Database
│
▼
Generate Report
│
▼
Clean Logs
Common use cases:
- Periodic backups
- Data synchronization
- Scheduled reports
Examples:
- Cron
- Celery Beat
- CrobJob (k8s)
Search Service
Search services provide efficient retrieval of large amounts of information. Unlike a database, which focuses on storing and managing data, search services optimize indexing and retrieval.
Database
│indexing
▼
Search Engine
│
▼
User Query
Common use cases:
- Full-text search
- Fuzzy search
- Document retrieval
Examples:
- Elasticsearch
- OpenSearch
Summary
A modern application can be viewed as a collection of specialized services:
| Service | Main Purpose |
|---|---|
| Frontend | User interaction and interface |
| Backend | Application logic and API services |
| Database | Persistent structured data storage |
| Cache | Fast temporary data access |
| Queue | Asynchronous communication |
| Worker | Background task execution |
| Object Storage | Large file storage |
| Authentication Service | Identity and access management |
| Scheduler | Automatic task triggering |
| Search Service | Efficient information retrieval |
Each service communicates through well-defined interfaces and protocols, allowing applications to become more scalable, maintainable, and extensible.