- User can upload texts or books
- User can view the texts or books
- User should be able to search texts or books
Backend Architecture with AWS
-
Entry point for client
- API Gateway
-
Scalable Microservices
- Load Balencer
- ECS (or EKS)
- SQS
- Lambda
-
Main Database
- RDS (or Aurora)
-
Full-text Search Engine
- Elastic Search
-
File Storage
- S3 private bucket
-
Cache
- Cloud Front
- Elastic Cache
User upload flow
- The client sends GET /pre-signed-url request and uploads original files.
- The client sends POST /texts or POST /books request.
- Upload service validate metadata and uploaded files.
- Upload service store metadata to DB and enqueue for content parser.
- Content parser get files from S3 and metadata from DB then stores texts to Elastic Search.
User view flow
- The client sends GET /texts, GET /books or GET /texts/<:id>, GET /books/<:id> request.
- View & Search service check if metadata cache exist
- exist: Get metadata from cache
- not exist: Get metadata from DB then store to cache
- Generate pre-signed url to accsee files (cached by CDN) and return result to client
User search flow
- The client sends GET /search?q=word request.
- View & Search service check if search cache exist
- exist: get search result from cache
- not exist: search contents from Elastic Search and get metadata from DB then store result to cache.
- Return search result to client.