Skip to content

Commit

Permalink
timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton committed Oct 24, 2024
1 parent 83dff86 commit c941802
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 33 deletions.
3 changes: 2 additions & 1 deletion documentation/arc42/05_building_block_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Maintain an overview of your source code by making its structure understandable


Contained Building Blocks::
include::./building_blocks/users_api/users_api_short_description.adoc[]
include::./building_blocks/users_api/timelines_api_short.adoc[]
include::./building_blocks/users_api/users_api_short.adoc[]



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include::../diagrams/TimelinesAPIContainer.puml[]
include::../diagrams/TimelinesAPIContainer-key.puml[]

include::users_api_short_description.adoc[]

===== Fulfilled Requirements
The API implements rate limiting to prevent abuse and ensure fair usage.

===== Risks
* Risk of slow response times or degraded performance during peak usage periods.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
==== Timelines API

The Timelines API microservice is responsible for managing user timelines in the image-sharing system.
It retrieves posts from users that the specified user follows, ensuring that they are ordered by recency.

===== Interface(s)
link:https://editor.swagger.io/?url=https://raw.githubusercontent.com/shcherby/system-design-arc42/refs/heads/main/documentation/arc42/building_blocks/users_api/timelines_api_swagger.yaml[REST API]
link:https://github.com[Messages]

===== Locations
link:https://github.com[users-api details]
link:https://github.com[users-api repository]
link:https://github.com[users-api CI/CD]
link:https://github.com[users-api database]
link:https://github.com[users-api releases]
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
openapi: 3.0.0
info:
title: Timelines API
description: API for retrieving timelines of posts from followed users.
version: 1.0.0
servers:
- url: http://api.example.com/v1
description: Main API server
paths:
/users/{userId}/timeline:
get:
summary: Get user timeline
description: Retrieve the latest posts from the users that the specified user follows.
parameters:
- name: userId
in: path
required: true
description: The ID of the user whose timeline to retrieve.
schema:
type: string
example: "12345"
- name: limit
in: query
required: false
description: The number of posts to retrieve (default is 20).
schema:
type: integer
example: 20
- name: page
in: query
required: false
description: The page number for pagination.
schema:
type: integer
example: 1
responses:
'200':
description: A list of posts for the user's timeline.
content:
application/json:
schema:
type: object
properties:
posts:
type: array
items:
type: object
properties:
postId:
type: string
example: "67890"
author:
type: string
example: "user123"
imageUrl:
type: string
example: "http://cdn.example.com/image.jpg"
caption:
type: string
example: "Enjoying the view!"
timestamp:
type: string
format: date-time
example: "2024-10-24T14:34:00Z"
'400':
description: Invalid request parameters (e.g., missing userId).
'404':
description: User not found or no posts available.
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@



include::users_api_short_description.adoc[]

===== Quality/Performance Characteristics
====== Performance
* **Response Time**: Aim for responses within 200 milliseconds.
* **Throughput**: Support several thousand requests per second (RPS) during peak times.
* **Latency**: Minimize network latency with efficient API calls and lightweight data formats.
* Aim for responses within 200 milliseconds.
* Support several thousand requests per second (RPS) during peak times.
* Minimize network latency with efficient API calls and lightweight data formats.

====== Scalability
* **Horizontal Scalability**: Design to add more instances as user demand increases.
* **Load Balancing**: Distribute requests evenly across multiple API instances.
* Design to add more instances as user demand increases.
* Distribute requests evenly across multiple API instances.

====== Reliability
* **High Availability**: Target 99.9% uptime with redundancy and failover strategies.
* **Graceful Degradation**: Ensure limited functionality in case of partial failures.

* Target 99.9% uptime with redundancy and failover strategies.
* Ensure limited functionality in case of partial failures.

===== Fulfilled Requirements
* **User Registration**: Users can create accounts by providing necessary details (username, email, password).
* **User Authentication**: Users can log in using their credentials, receiving an access token for subsequent requests.
* **Profile Management**: Users can view and update their profile information (e.g., username, bio).
* **Password Recovery**: Users can initiate a password reset process via email.
* **User Data Security**: All sensitive user data is encrypted in transit and at rest.
* **Rate Limiting**: The API implements rate limiting to prevent abuse and ensure fair usage.
* **Versioning**: The API supports versioning to maintain backward compatibility.
* **Comprehensive Documentation**: Clear and detailed API documentation is provided for developers.

===== Open Issues/Problems/Risks
* **Data Privacy Concerns**: Ensuring compliance with data protection regulations (e.g., GDPR) regarding user data handling and storage.
* **Scalability Challenges**: Potential difficulties in scaling the API efficiently to handle sudden increases in user demand.
* **Security Vulnerabilities**: Risks of unauthorized access or data breaches if security measures are not adequately implemented.
* **Dependency Management**: Reliance on third-party authentication providers could lead to outages or service interruptions.
* **User Experience Issues**: Complexity in the registration or authentication process may lead to user drop-off.
* **Performance Bottlenecks**: Risk of slow response times or degraded performance during peak usage periods.
* **Integration Challenges**: Difficulties in integrating with existing systems or services that rely on user data.
* **Documentation Gaps**: Incomplete or unclear API documentation may hinder developer adoption and usage.

* Users can create accounts by providing necessary details (username, email, password).
* Users can log in using their credentials, receiving an access token for subsequent requests.
* Users can view and update their profile information (e.g., username, bio).
* All sensitive user data is encrypted in transit and at rest.

===== Risks
* Ensuring compliance with data protection regulations (e.g., GDPR) regarding user data handling and storage.
* Risks of unauthorized access or data breaches if security measures are not adequately implemented.
* Reliance on third-party authentication providers could lead to outages or service interruptions.
* Complexity in the registration or authentication process may lead to user drop-off.


=== Level 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ It also manages user data, including personal information, preferences, and secu

===== Interface(s)
link:https://editor.swagger.io/?url=https://raw.githubusercontent.com/shcherby/system-design-arc42/refs/heads/main/documentation/arc42/building_blocks/users_api/users_api_swagger.yaml[REST API]
link:https://messages.com[Messages]
link:https://github.com[Messages]

===== Locations
link:https://details.com[users-api full description]
link:https://github.com[users-api git hub location]
link:https://github.com[users-api build pipelines]
link:https://github.com[users-api artifacts]
link:https://github.com[users-api details]
link:https://github.com[users-api repository]
link:https://github.com[users-api CI/CD]
link:https://github.com[users-api database]
link:https://github.com[users-api releases]
6 changes: 6 additions & 0 deletions documentation/diagrams-as-code/main.dsl
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ workspace "highly-scalable-image-sharing-platform" "This is an example workspace
autoLayout
}

dynamic imageSharingPlatform "TimelinesAPIContainer"{
title "Timelines API"
timelinesApiApp -> timelinesDatabase
autoLayout lr
}

styles {
element "Person" {
color #ffffff
Expand Down

0 comments on commit c941802

Please sign in to comment.