Week-12 @ 100xdevs cohort : CDN and FE deoployment on AWS, advanced TypeScript APIs, SQL & Prisma relations and transactions and connection pooling.

Aviral VardiyaAviral Vardiya
3 min read

Week-12 of the 100xdevs cohort consisted of discussions on various topics such as CDNs and deploying Frontend to AWS, advanced TypeScript APIs, SQL joins and relationships, Prisma relations, and connection pooling. Details are as follows:

CDN and Deploying FE to AWS: We delved into the intricacies of optimizing user experience for content delivery, especially for non-user-specific content like video streams, public images, audios, and client-side rendered applications. A Content Delivery Network (CDN) emerged as the go-to solution, featuring a centralized content store and multiple Points of Presence (POPs) strategically positioned worldwide. When a user requests content, the CDN directs the request to the nearest POP, which then retrieves the content from the central store and delivers it to the user. Additionally, the POP caches the content, ensuring swift delivery to subsequent users. We adapted this architecture to serve a React build, leveraging AWS S3 as the central storage hub and AWS CloudFront as the distribution network. By configuring CloudFront to connect to S3 with the necessary permissions and enabling client-side route handling, we swiftly readied our application for deployment.

Advanced TypeScript APIs: TypeScript utility types such as Pick, Partial, Readonly, Record, Exclude, and the Map type were covered. These utility types offer practical solutions for enhancing type safety and developer productivity in TypeScript projects. The Pick utility type allows you to select a subset of properties from an existing type, improving code readability and type safety. Partial, on the other hand, makes all properties of a type optional, which is useful for updating object properties selectively. Readonly was introduced as a utility type for making all properties of a type read-only, ensuring immutability and enhancing code clarity. Additionally, the lecture covered the Record utility type and the Map object, offering different approaches to working with collections of key-value pairs. Exclude, another utility type, allows the creation of a type by excluding certain members from a union type, offering enhanced type safety and clarity.

SQL Relationships and Joins: We gained insights into the concepts of structuring and querying relational data in SQL databases. The session emphasized the importance of understanding database relationships and transactions, particularly in scenarios where data integrity is crucial. I learned about the various types of relationships, including one-to-one and one-to-many, and how these are defined in SQL databases through foreign keys and constraints. Moreover, I discovered the significance of transactions in ensuring the consistency of database operations, especially when dealing with multiple related operations that need to be treated as a single unit.

Prisma Relationships: We gained a deeper understanding of how to define and manage relationships within a database schema using Prisma. We learned how Prisma offers a straightforward and expressive syntax for representing various types of relationships, including one-to-one, one-to-many, many-to-one, and many-to-many. While we worked on building relations in the database, the importance of Prisma migrations became evident, which kept a record of how the database changed over time.

Connection Pooling: We delved into the intricacies of managing database connections efficiently, particularly in platforms like Cloudflare Workers. The session highlighted the significance of connection pooling in optimizing database access for serverless applications, which often experience a surge in concurrent requests. I learned that connection pooling involves maintaining a cache of database connections, allowing them to be shared among multiple clients instead of opening and closing new connections for each request. This approach not only conserves resources but also enhances performance by reducing connection setup time and controlling concurrency. By integrating Prisma with connection pooling using Prisma Accelerate, I gained insights into the steps involved in setting up Prisma for serverless deployments, ensuring scalable and stable database access.

0
Subscribe to my newsletter

Read articles from Aviral Vardiya directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Aviral Vardiya
Aviral Vardiya