## Assignment - API Design
This doc is a part of assignment from the Intership Opportunity for Truexam
________________________________________
### API design

This particular design has different parts
- `Clients` : They can be web browsers and mobile applications
- `Clients` send `HTTP/HTTPS` requests to server through an `API gateway`
- `API Gateway` handles the authentcation, authorization, security, traffic management and caching
- If `isAuthorised` is true with proper authentication, the request reaches the `server` or if false, the `gateway` responds with an `401 - Not Authorised` error
- `Server` handles all the requests thrown by clients
- if scalabilty is a concern, then there needs to be a `load balancer` that would separate the requests to different servers present accross cloud.
- another feasible way is to use the `serverless` approach where in the whole service would be hosted in cloud like the `AWS lamba`
- `server` sends the images to `AWS S3` to get stored and in return `AWS S3` provides public links of the images which could be used to be stored in `database`
- Data is being handled by a database system , preferable MongoDB Atlas because of its `database as-a-service, DaaS` architecture where the whole data is secured in cloud
- `NoSql` `AWS DynamoDB` also is a good option for scalability
- As a whole `NoSQL` is prefered because of its flexibility in data as documents and easy to maintain. Moreover `MongoDb` now provides `ACID` properties
- After the DB operations are complete, the server sends an response (either success or error) to the client in the form of `HTTP/HTTPS response`
--------------------------------
### Notes
- `AWS` is a good option but using its services means there is issues of costing. On the plus they are `PaaS`, so as the clientele grows we can scale accordingly.
- `Security` can be done with `JWT (JSON Web Token)`
__________________________________
For the API doc, please click the [link](https://hackmd.io/@webdevback/intern)
----------------------------------
Name : Pratyay Saha
Resume : [https://resume.smll.in](https://resume.smll.in)