<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ankit Kumar</title>
    <description>The latest articles on DEV Community by Ankit Kumar (@jinxankit).</description>
    <link>https://dev.to/jinxankit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F487547%2F0fbd72f2-6623-4524-ae7e-0185418ce0ee.png</url>
      <title>DEV Community: Ankit Kumar</title>
      <link>https://dev.to/jinxankit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jinxankit"/>
    <language>en</language>
    <item>
      <title>Go - Project Structure and Guidelines</title>
      <dc:creator>Ankit Kumar</dc:creator>
      <pubDate>Tue, 07 Sep 2021 09:06:42 +0000</pubDate>
      <link>https://dev.to/jinxankit/go-project-structure-and-guidelines-4ccm</link>
      <guid>https://dev.to/jinxankit/go-project-structure-and-guidelines-4ccm</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F89o8x1keqyd5a6py2nes.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F89o8x1keqyd5a6py2nes.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Assuming you read my post you should have the starting point for a minimal go web service. For your first project it is easier to keep all your code in one folder, in the base of your project, but at some point you want to restructure things. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Packages&lt;/strong&gt;&lt;br&gt;
All go code is organised into packages and its simply consists of several .go files. A package is the entry point to access Go code.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Best Practice to use multiple files&lt;/em&gt;&lt;br&gt;
a. Feel free to separate you code into as many files as possible.&lt;br&gt;
b. Aim to ensure it is easy to navigate your way around&lt;br&gt;
c. Loosely couple sections of the service or application&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Keep types close&lt;/em&gt;&lt;br&gt;
It is often a good practice to keep the core types grouped at the top of a file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Organise by responsibility&lt;/em&gt;&lt;br&gt;
In other languages we organise types by models or types but in go we organise code by their functional responsibilities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Start to Use Godoc&lt;/em&gt;&lt;br&gt;
Godoc extracts and generates documentation for Go programs. It runs as a web server and presents the documentation as a web page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Dont't write your business logic to main.go&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Naming Convention&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Package names should be lowercase. Don't use snake_case or camelCase. &lt;/li&gt;
&lt;li&gt;Avoid overly use terms like util, common, script etc&lt;/li&gt;
&lt;li&gt;Use singular form&lt;/li&gt;
&lt;li&gt;Rename should follow the same rules &lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 (
    gourl "net/url"
    myurl "myApp/url"
)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;*&lt;em&gt;Repository Structures examples: *&lt;/em&gt;&lt;/p&gt;

&lt;pre&gt;
```fooApp/


  circle.yml
  Dockerfile
  cmd/
    foosrv/
      main.go
    foocli/
      main.go
  pkg/
    fs/
      fs.go
      fs_test.go
      mock.go
      mock_test.go
    merge/
      merge.go
      merge_test.go
    api/
      api.go
      api_test.go


```
&lt;/pre&gt;

&lt;p&gt;As you noticed, there is func_test.go file in the same directory. In Go, you save unit tests inside separate files with a filename ending with _test.go. Go provides go test command out of the box which executes these files and runs tests. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common terms we use in package structure&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/cmd&lt;/strong&gt;&lt;br&gt;
This folder contains the main application entry point files for the project, with the directory name matching the name for the binary.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/pkg&lt;/strong&gt;&lt;br&gt;
This folder contains code which is OK for other services to consume, this may include API clients, or utility functions which may be handy for other projects but don’t justify their own project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/internal&lt;/strong&gt;&lt;br&gt;
This package holds the private library code used in your service, it is specific to the function of the service and not shared with other services.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;go.mod&lt;/strong&gt; &lt;br&gt;
The go. mod file defines the module's module path, which is also the import path used for the root directory, and its dependency requirements, which are the other modules needed for a successful build.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;go.sum&lt;/strong&gt; contains all the dependency check sums, and is managed by the go tools. The checksum present in go.sum file is used to validate the checksum of each of direct and indirect dependency to confirm that none of them has been modified.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;e.g.&lt;/p&gt;

&lt;pre&gt;
```


├── LICENSE
├── README.md
├── config.go
├── go.mod
├── go.sum
├── clientlib
│   ├── lib.go
│   └── lib_test.go
├── cmd
│   ├── modlib-client
│   │   └── main.go
│   └── modlib-server
│       └── main.go
├── internal
│   └── auth
│       ├── auth.go
│       └── auth_test.go
└── serverlib
    └── lib.go


```
&lt;/pre&gt;

&lt;p&gt;Thanks!!&lt;/p&gt;

</description>
      <category>go</category>
      <category>packages</category>
      <category>services</category>
    </item>
    <item>
      <title>Distributed System Configuration Management</title>
      <dc:creator>Ankit Kumar</dc:creator>
      <pubDate>Fri, 30 Jul 2021 19:49:59 +0000</pubDate>
      <link>https://dev.to/jinxankit/distributed-system-configuration-management-5cbg</link>
      <guid>https://dev.to/jinxankit/distributed-system-configuration-management-5cbg</guid>
      <description>&lt;p&gt;This post has based on how can we configure our system so that it shouldn't be restarted to load new configurations. A distributed system's services use configuration to operate.&lt;/p&gt;

&lt;p&gt;Let's say we have a distributed system that has multiple services running that process the message stream from different sources based on their configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--we1iC73s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ifw0gelq5h20itavuz2.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--we1iC73s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ifw0gelq5h20itavuz2.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Zookeeper?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ZooKeeper is a distributed coordination service that also helps to manage a large set of hosts. Since managing and coordinating a service especially in a distributed environment is a complicated process, so ZooKeeper solves this problem due to its simple architecture as well as API.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;At its best, ZooKeeper allows developers to focus on core application logic without worrying about the distributed nature of the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What problem does Zookeeper Solve?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Services needs a restart to load the new configuration or need a new service that syncs the existing configuration&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For need to make API Calls to update configuration in each service.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Coordination is of utmost importance in distributed applications. In an application involving multiple services, the components of the system need to work together and coordinate to achieve a result.&lt;/p&gt;

&lt;p&gt;That's where Apache Zookeeper is useful. Distributed systems like Apache Hadoop, Apache Kafka, Apache Hive and many more are using zookeeper. All these distributed systems are using a zookeeper as a coordinator between all nodes and store all shared config, state and metadata. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Architecture of Zookeeper:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ZooKeeper follows a simple client-server model where clients are nodes (i.e., machines) that make use of the service, and servers are nodes that provide the service.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sQ1H_oAw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kfq6hymb40nmte182571.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sQ1H_oAw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kfq6hymb40nmte182571.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6N-z7VD9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/augymw1trpw4i6pquzzl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6N-z7VD9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/augymw1trpw4i6pquzzl.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Znode - Znodes are the fundamental abstraction provided by Zookeeper to represent a node in a tree-like structure.&lt;br&gt;
A znode can store data in the form of a byte array and it can have child nodes.&lt;br&gt;
Each znode also has an additional data structure called Stat which contains transaction id which created or modified the znode, transaction id which created or modified its children, timestamp, version for the data change, version for the child node change, ACL change, and the owner of the znode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So that's how zookeeper tree looks like:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vLnPD2no--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y7eb90lj5l3v16om3vyl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vLnPD2no--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y7eb90lj5l3v16om3vyl.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Watchers - While reading a particular znode, clients can set watchers. Moreover, for any of the znode (on which client registers) changes, watchers send a notification to the registered client.&lt;/p&gt;

&lt;p&gt;Type of Nodes:&lt;br&gt;
Ephemeral Nodes - These Znodes exists as long as the session that created the Znode is active.&lt;/p&gt;

&lt;p&gt;Sequence Nodes - When creating this type of node, Zookeeper will add a unique sequence number in the name.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some of the Key Znode features:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pPOvPDcf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gkk59trd7e788d60xncl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pPOvPDcf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gkk59trd7e788d60xncl.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some of the common Zookeeper Recipes:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Any system that needs a centralised reliable service to manage its configuration across the environment.&lt;/li&gt;
&lt;li&gt;Leader election &lt;/li&gt;
&lt;li&gt;Naming Service&lt;/li&gt;
&lt;li&gt;Queuing the messages&lt;/li&gt;
&lt;li&gt;Managing the Notification System&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Several Hadoop projects are already using ZooKeeper to coordinate the cluster and provide highly available distributed services.&lt;br&gt;
Apache HBase, which uses ZooKeeper to track the master, the region servers, and the status of data distributed throughout the cluster.&lt;/p&gt;

&lt;p&gt;For Zookeeper Installation and References:&lt;br&gt;
&lt;a href="https://www.tutorialspoint.com/zookeeper/zookeeper_installation.htm"&gt;Zookeeper&lt;/a&gt;&lt;/p&gt;

</description>
      <category>distributedsystems</category>
      <category>systems</category>
      <category>design</category>
    </item>
    <item>
      <title>Data Modelling / Database Design</title>
      <dc:creator>Ankit Kumar</dc:creator>
      <pubDate>Fri, 09 Jul 2021 20:32:38 +0000</pubDate>
      <link>https://dev.to/jinxankit/data-modelling-database-design-4hhc</link>
      <guid>https://dev.to/jinxankit/data-modelling-database-design-4hhc</guid>
      <description>&lt;p&gt;Database design is structuring data and organised relationships in a database. It goes beyond how the database further works.&lt;br&gt;
I was learning about cool stuff &lt;a href="https://dbdiagram.io" rel="noopener noreferrer"&gt;dbdigram.io&lt;/a&gt; for designing a database so hitting a random try for Bank Database design. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Requirements&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create and manage accounts { owner, branch, balance details...}&lt;/li&gt;
&lt;li&gt;Record all transactions history from accounts -&amp;gt; to accounts etc.&lt;/li&gt;
&lt;li&gt;Perform money transfer between 2 accounts consistently within a transactions&lt;/li&gt;
&lt;li&gt;Maintaining a Loan Records&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Database Design&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The basics of database design are identifying what data needs to get stored, grouping such data into tables or collections and adding relationships between related data points. The whole database design process involves&lt;/p&gt;

&lt;p&gt;Using &lt;em&gt;Entity-Relationship(ER)&lt;/em&gt; diagrams to visualize the objects that get stored and their relationships.&lt;/p&gt;

&lt;p&gt;Let's see how this can be designed on diagrams using &lt;a href="https://dbdiagram.io" rel="noopener noreferrer"&gt;dbdigram.io&lt;/a&gt; and then converted to SQL and PostgreSQL. &lt;/p&gt;

&lt;p&gt;Exciting right?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to use DB diagram&lt;/strong&gt;&lt;br&gt;
The tool is simple: you write code, it renders the ER diagram 👌. You can then export to PDF, PNG or generate SQL code with it ⭐️.&lt;/p&gt;

&lt;p&gt;It uses DBML (database markup language) to define and document database schemas.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17gpz0f1eu92te908dab.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17gpz0f1eu92te908dab.png" alt="Pic_1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;customer_id is the primary key(pk keyword) and auto-incremented&lt;/em&gt;&lt;br&gt;
&lt;em&gt;created_at enclose timezone information as well&lt;/em&gt;&lt;br&gt;
&lt;em&gt;deleted_at for maintaining the deletion record&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa0z80gmdhev8ccsnt3av.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa0z80gmdhev8ccsnt3av.png" alt="Pic_2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;bigserial in PostgreSQL is basically a big autoincrementing integers (8-byte/64-bit)&lt;/em&gt;&lt;br&gt;
&lt;em&gt;customer_id int [ref: &amp;gt; C.customer_id], customer_id is foreign key user here&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ssvjfm3l68w41vq6ir4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ssvjfm3l68w41vq6ir4.png" alt="Pic_3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Hence the Final ER - Diagram Result:&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrmnjjkfmauguzmq8525.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrmnjjkfmauguzmq8525.png" alt="Pic_4"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's write/generate Mysql Code for this schema now&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CREATE DATABASE bank;&lt;br&gt;
USE bank;&lt;/p&gt;

&lt;p&gt;CREATE TABLE &lt;code&gt;customers&lt;/code&gt; (&lt;br&gt;
  &lt;code&gt;customer_id&lt;/code&gt; int PRIMARY KEY AUTO_INCREMENT,&lt;br&gt;
  &lt;code&gt;first_name&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;last_name&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;city&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;mobile_no&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;pancard_no&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;dob&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;created_at&lt;/code&gt; timestampz DEFAULT "now()",&lt;br&gt;
  &lt;code&gt;deleted_at&lt;/code&gt; timestampz&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE &lt;code&gt;branchs&lt;/code&gt; (&lt;br&gt;
  &lt;code&gt;branch_id&lt;/code&gt; int PRIMARY KEY AUTO_INCREMENT,&lt;br&gt;
  &lt;code&gt;branch_name&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;branch_location&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;created_at&lt;/code&gt; timestampz DEFAULT "now()",&lt;br&gt;
  &lt;code&gt;deleted_at&lt;/code&gt; timestampz&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE &lt;code&gt;accounts&lt;/code&gt; (&lt;br&gt;
  &lt;code&gt;account_id&lt;/code&gt; bigserial PRIMARY KEY,&lt;br&gt;
  &lt;code&gt;customer_id&lt;/code&gt; int,&lt;br&gt;
  &lt;code&gt;balance&lt;/code&gt; bigint,&lt;br&gt;
  &lt;code&gt;account_status&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;account_type&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;currency&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;created_at&lt;/code&gt; timestampz DEFAULT "now()",&lt;br&gt;
  &lt;code&gt;deleted_at&lt;/code&gt; timestampz&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE &lt;code&gt;transactions&lt;/code&gt; (&lt;br&gt;
  &lt;code&gt;transaction_id&lt;/code&gt; bigserial PRIMARY KEY,&lt;br&gt;
  &lt;code&gt;transaction_type&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;from_account_id&lt;/code&gt; bigint,&lt;br&gt;
  &lt;code&gt;to_account_id&lt;/code&gt; bigint,&lt;br&gt;
  &lt;code&gt;date_issued&lt;/code&gt; date,&lt;br&gt;
  &lt;code&gt;amount&lt;/code&gt; bigint,&lt;br&gt;
  &lt;code&gt;transaction_medium&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;created_at&lt;/code&gt; timestampz DEFAULT "now()",&lt;br&gt;
  &lt;code&gt;deleted_at&lt;/code&gt; timestampz&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE &lt;code&gt;loans&lt;/code&gt; (&lt;br&gt;
  &lt;code&gt;loan_id&lt;/code&gt; bigserial PRIMARY KEY,&lt;br&gt;
  &lt;code&gt;customer_id&lt;/code&gt; int,&lt;br&gt;
  &lt;code&gt;branch_id&lt;/code&gt; int,&lt;br&gt;
  &lt;code&gt;loan_amount&lt;/code&gt; bigint,&lt;br&gt;
  &lt;code&gt;date_issued&lt;/code&gt; date,&lt;br&gt;
  &lt;code&gt;created_at&lt;/code&gt; timestampz DEFAULT "now()",&lt;br&gt;
  &lt;code&gt;deleted_at&lt;/code&gt; timestampz&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;ALTER TABLE &lt;code&gt;accounts&lt;/code&gt; ADD FOREIGN KEY (&lt;code&gt;customer_id&lt;/code&gt;) REFERENCES &lt;code&gt;customers&lt;/code&gt; (&lt;code&gt;customer_id&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;ALTER TABLE &lt;code&gt;transactions&lt;/code&gt; ADD FOREIGN KEY (&lt;code&gt;from_account_id&lt;/code&gt;) REFERENCES &lt;code&gt;accounts&lt;/code&gt; (&lt;code&gt;account_id&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;ALTER TABLE &lt;code&gt;transactions&lt;/code&gt; ADD FOREIGN KEY (&lt;code&gt;to_account_id&lt;/code&gt;) REFERENCES &lt;code&gt;accounts&lt;/code&gt; (&lt;code&gt;account_id&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;ALTER TABLE &lt;code&gt;loans&lt;/code&gt; ADD FOREIGN KEY (&lt;code&gt;customer_id&lt;/code&gt;) REFERENCES &lt;code&gt;customers&lt;/code&gt; (&lt;code&gt;customer_id&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;ALTER TABLE &lt;code&gt;loans&lt;/code&gt; ADD FOREIGN KEY (&lt;code&gt;branch_id&lt;/code&gt;) REFERENCES &lt;code&gt;branchs&lt;/code&gt; (&lt;code&gt;branch_id&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PostgreSQL Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CREATE TABLE &lt;code&gt;"customers"&lt;/code&gt; (&lt;br&gt;
  &lt;code&gt;"customer_id"&lt;/code&gt; SERIAL PRIMARY KEY,&lt;br&gt;
  &lt;code&gt;"first_name"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"last_name"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"city"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"mobile_no"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"pancard_no"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"dob"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"created_at"&lt;/code&gt; timestampz DEFAULT 'now()',&lt;br&gt;
  &lt;code&gt;"deleted_at"&lt;/code&gt; timestampz&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE &lt;code&gt;"branchs"&lt;/code&gt; (&lt;br&gt;
  &lt;code&gt;"branch_id"&lt;/code&gt; SERIAL PRIMARY KEY,&lt;br&gt;
  &lt;code&gt;"branch_name"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"branch_location"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"created_at"&lt;/code&gt; timestampz DEFAULT 'now()',&lt;br&gt;
  &lt;code&gt;"deleted_at"&lt;/code&gt; timestampz&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE &lt;code&gt;"accounts"&lt;/code&gt; (&lt;br&gt;
  &lt;code&gt;"account_id"&lt;/code&gt; bigserial PRIMARY KEY,&lt;br&gt;
  &lt;code&gt;"customer_id"&lt;/code&gt; int,&lt;br&gt;
  &lt;code&gt;"balance"&lt;/code&gt; bigint,&lt;br&gt;
  &lt;code&gt;"account_status"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"account_type"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"currency"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"created_at"&lt;/code&gt; timestampz DEFAULT 'now()',&lt;br&gt;
  &lt;code&gt;"deleted_at"&lt;/code&gt; timestampz&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE &lt;code&gt;"transactions"&lt;/code&gt; (&lt;br&gt;
  &lt;code&gt;"transaction_id"&lt;/code&gt; bigserial PRIMARY KEY,&lt;br&gt;
  &lt;code&gt;"transaction_type"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"from_account_id"&lt;/code&gt; bigint,&lt;br&gt;
  &lt;code&gt;"to_account_id"&lt;/code&gt; bigint,&lt;br&gt;
  &lt;code&gt;"date_issued"&lt;/code&gt; date,&lt;br&gt;
  &lt;code&gt;"amount"&lt;/code&gt; bigint,&lt;br&gt;
  &lt;code&gt;"transaction_medium"&lt;/code&gt; VARCHAR,&lt;br&gt;
  &lt;code&gt;"created_at"&lt;/code&gt; timestampz DEFAULT 'now()',&lt;br&gt;
  &lt;code&gt;"deleted_at"&lt;/code&gt; timestampz&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;CREATE TABLE &lt;code&gt;"loans"&lt;/code&gt; (&lt;br&gt;
  &lt;code&gt;"loan_id"&lt;/code&gt; bigserial PRIMARY KEY,&lt;br&gt;
  &lt;code&gt;"customer_id"&lt;/code&gt; int,&lt;br&gt;
  &lt;code&gt;"branch_id"&lt;/code&gt; int,&lt;br&gt;
  &lt;code&gt;"loan_amount"&lt;/code&gt; bigint,&lt;br&gt;
  &lt;code&gt;"date_issued"&lt;/code&gt; date,&lt;br&gt;
  &lt;code&gt;"created_at"&lt;/code&gt; timestampz DEFAULT 'now()',&lt;br&gt;
  &lt;code&gt;"deleted_at"&lt;/code&gt; timestampz&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;ALTER TABLE &lt;code&gt;"accounts"&lt;/code&gt; ADD FOREIGN KEY (&lt;code&gt;"customer_id"&lt;/code&gt;) REFERENCES &lt;code&gt;"customers"&lt;/code&gt; (&lt;code&gt;"customer_id"&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;ALTER TABLE &lt;code&gt;"transactions"&lt;/code&gt; ADD FOREIGN KEY (&lt;code&gt;"from_account_id"&lt;/code&gt;) REFERENCES &lt;code&gt;"accounts"&lt;/code&gt; (&lt;code&gt;"account_id"&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;ALTER TABLE &lt;code&gt;"transactions"&lt;/code&gt; ADD FOREIGN KEY (&lt;code&gt;"to_account_id"&lt;/code&gt;) REFERENCES &lt;code&gt;"accounts"&lt;/code&gt; (&lt;code&gt;"account_id"&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;ALTER TABLE &lt;code&gt;"loans"&lt;/code&gt; ADD FOREIGN KEY (&lt;code&gt;"customer_id"&lt;/code&gt;) REFERENCES &lt;code&gt;"customers"&lt;/code&gt; (&lt;code&gt;"customer_id"&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;ALTER TABLE &lt;code&gt;"loans"&lt;/code&gt; ADD FOREIGN KEY (&lt;code&gt;"branch_id"&lt;/code&gt;) REFERENCES &lt;code&gt;"branchs"&lt;/code&gt; (&lt;code&gt;"branch_id"&lt;/code&gt;);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/holistics/dbml" rel="noopener noreferrer"&gt;https://github.com/holistics/dbml&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Get the code here&lt;/em&gt;&lt;br&gt;
&lt;a href="https://github.com/jinxankit/Bank-DataBase-Design" rel="noopener noreferrer"&gt;https://github.com/jinxankit/Bank-DataBase-Design&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;THANK YOU!!!!!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>mysql</category>
      <category>postgres</category>
      <category>design</category>
    </item>
    <item>
      <title>How to upgrade/install Ubuntu 20.04 LTS (Focal Fossa)</title>
      <dc:creator>Ankit Kumar</dc:creator>
      <pubDate>Thu, 08 Jul 2021 17:28:11 +0000</pubDate>
      <link>https://dev.to/jinxankit/how-to-upgrade-install-ubuntu-20-04-lts-focal-fossa-3ji5</link>
      <guid>https://dev.to/jinxankit/how-to-upgrade-install-ubuntu-20-04-lts-focal-fossa-3ji5</guid>
      <description>&lt;p&gt;How to upgrade/install Ubuntu 20.04 LTS (Focal Fossa)&lt;br&gt;
The latest version of ubuntu 20.04 LTS released on 23rd April 2020. This article will show you how to upgrade into the new version and also how to install ubuntu from scratch.&lt;br&gt;
Installation requirement for Ubuntu 20.04 LTS is&lt;br&gt;
2 GHz dual-core processor&lt;br&gt;
4 GB RAM&lt;br&gt;
25 GB of hard drive space (or USB stick, memory card or external drive but see Live CD for an alternative approach)&lt;br&gt;
VGA capable of 1024x768 screen resolution&lt;br&gt;
Either a CD/DVD drive or a USB port for the installer media&lt;br&gt;
Internet access is always helpful&lt;/p&gt;

&lt;p&gt;So let's start:-&lt;br&gt;
Part 1: Upgrading ubuntu 18.04 to ubuntu 20.04 through the command line&lt;br&gt;
If you're using old ubuntu version like ubuntu 18.04 LTS then you can directly upgrade into it through the command line. Make sure to backup your important files into secondary storage for better precautions.&lt;br&gt;
step 1: Upgrade all install packages on ubuntu using&lt;br&gt;
sudo apt update &amp;amp;&amp;amp; sudo apt upgrade&lt;br&gt;
step 2: Now you've to make sure to install update-manager-core package by using&lt;br&gt;
sudo apt install update-manager-core&lt;br&gt;
step 3: The final command for checking &amp;amp; upgrading into the new LTS version using&lt;br&gt;
sudo do-release-upgrade&lt;br&gt;
This will search for a newer version and If it finds a newer version then it will require around 1.5 GB data and ask you to install new packages. After choosing yes, your procedure will start accordingly.&lt;br&gt;
If you're showing this:&lt;br&gt;
Note: Checking for a new Ubuntu release&lt;br&gt;
There is no development version of an LTS available.&lt;br&gt;
To upgrade to the latest non-LTS development release &lt;br&gt;
set Prompt=normal in /etc/update-manager/release-upgrades.&lt;br&gt;
that means you might not see the upgrade immediately, as it takes time from the older version. But if you want to upgrade forcefully, you can do it by using&lt;br&gt;
sudo do-release-upgrade -d&lt;br&gt;
"-d" refers to get the latest support version forcefully.&lt;br&gt;
Part 2: Fresh installation from a live USB/CD.&lt;br&gt;
step 1: Download the iso files of latest ubuntu release from their official site &lt;a href="https://releases.ubuntu.com/20.04/"&gt;https://releases.ubuntu.com/20.04/&lt;/a&gt;&lt;br&gt;
step 2: Create a bootable disk. You can use rufus,( &lt;a href="https://rufus.ie/"&gt;https://rufus.ie/&lt;/a&gt; ) easy to use and faster too.&lt;br&gt;
Press START after choosing ISO filestep 3: Prepare your PC to boot from USB.&lt;br&gt;
Every bios screen is different so for better help. You can check this page &lt;a href="https://support.endlessm.com/hc/en-us/articles/210527103-How-do-I-start-boot-my-computer-from-a-USB-device-or-DVD-with-Endless-OS-"&gt;https://support.endlessm.com/hc/en-us/articles/210527103-How-do-I-start-boot-my-computer-from-a-USB-device-or-DVD-with-Endless-OS-&lt;/a&gt;&lt;br&gt;
for better help.&lt;br&gt;
step 4: Starting the installation.&lt;br&gt;
Loading screen for ubuntu 20.04step 5: In the opening screen you've to choose between try ubuntu and install ubuntu.&lt;br&gt;
step 6: Choose your preferred language and keyboard layout.&lt;br&gt;
step 7: Get connected to any wireless, if any:&lt;br&gt;
step 8: Install third party software and updates by choosing them and click on continue further.&lt;br&gt;
step 9: Go for something else if you need dual booting.&lt;br&gt;
step 10: Let's allocate, swap memory = 2 * Ram Size for better performance of RAM and Create / partition of remaining unallocated size, Select the free space and then Click on the "+" symbol to create a new partition.&lt;br&gt;
e.g: / - 8 GB (for root space)&lt;br&gt;
SWAP - 2 GB (for RAM Performance)&lt;br&gt;
/home (for home directory)&lt;br&gt;
I've allocated like this :&lt;br&gt;
step 12: Proceed to continue for further steps.&lt;br&gt;
step 13. Select a region and input your account info like user and password details and at last, ubuntu is started to install. It'll take a few minutes to install and then restart your system.&lt;br&gt;
Your ubuntu installation is ready. Enjoy Ubuntu.&lt;/p&gt;

&lt;p&gt;References:&lt;br&gt;
Ubuntu 20.04 LTS (Focal Fossa)&lt;br&gt;
Ubuntu is distributed on three types of images described below. The desktop image allows you to try Ubuntu without…releases.ubuntu.com&lt;br&gt;
The Beginner's Guide To Installing Ubuntu Linux 18.04 LTS&lt;br&gt;
Grab a USB stick and start your Linux journey!medium.com&lt;br&gt;
How to install Ubuntu 18.04 alongside Windows 10&lt;br&gt;
After so many efforts I've figured out what went wrong while installing. Now at last I've installed Ubuntu 18.04…askubuntu.com&lt;/p&gt;

&lt;p&gt;Author:&lt;br&gt;
Ankit Kumar&lt;br&gt;
Thank you for reading this far. If you enjoyed this post, please like,share and comment. For more contacts and query you can reach me at &lt;a href="mailto:ankit.2official@gmail.com"&gt;ankit.2official@gmail.com&lt;/a&gt;. Follow me on Dev.to if you're interested in more in-depth and informative write-ups like these in the future!&lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>linux</category>
    </item>
    <item>
      <title>So Monolith or Microservice?</title>
      <dc:creator>Ankit Kumar</dc:creator>
      <pubDate>Thu, 08 Jul 2021 17:05:11 +0000</pubDate>
      <link>https://dev.to/jinxankit/so-monolith-or-microservice-5b5c</link>
      <guid>https://dev.to/jinxankit/so-monolith-or-microservice-5b5c</guid>
      <description>&lt;p&gt;&lt;strong&gt;MONOLITHIC ARCHITECTURE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A monolithic architecture refers to the fact that your entire application is one large project or codebase. Let’s say you were building an online store. This single codebase must be responsible for every concern of the application from login, to account management, to the product listings, to the shopping cart, payment processing etc. &lt;/p&gt;

&lt;p&gt;It sounds immediately critical but there's &lt;em&gt;advantage&lt;/em&gt; of monolithic architecture as well.&lt;br&gt;
&lt;em&gt;1.&lt;/em&gt; Monoliths are also generally easier to test, as all of their components are in one place for end-to-end access.&lt;br&gt;
&lt;em&gt;2.&lt;/em&gt; They are also easy to deploy and scale horizontally as a single package that you can place on multiple server instances.&lt;br&gt;
&lt;em&gt;3.&lt;/em&gt; Initial development of monolithic architecture is fast because it is built with the mindset that all parts should be interconnected and dependent on each other.&lt;br&gt;
&lt;em&gt;4.&lt;/em&gt; Monoliths don't require API for communication between components, enabling higher performance.&lt;/p&gt;

&lt;p&gt;There are also several &lt;em&gt;drawbacks&lt;/em&gt; of it:&lt;br&gt;
&lt;em&gt;1.&lt;/em&gt; When you get to an enterprise-level application, a single codebase becomes large and hard to handle.&lt;br&gt;
&lt;em&gt;2.&lt;/em&gt; Every change in any feature requires a redeployment of the entire application.&lt;br&gt;
&lt;em&gt;3.&lt;/em&gt; Making updates, making additions is time-consuming and need to be carefully coordinated.&lt;br&gt;
&lt;em&gt;4.&lt;/em&gt; It is extremely problematic to apply new technology in a monolithic application because then the entire application has to be rewritten.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MICROSERVICE ARCHITECTURE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A microservice architecture aims to break down a large application into several more manageable chunks. Using the example of an online store above, you could have a microservice, or even a micro application, dedicated to login. Another dedicated to your product catalogue. Yet a third to handle payments and/or shipping. Essentially, each concern of the application is broken into a separate project or service. &lt;/p&gt;

&lt;p&gt;But there's a double-edged sword, just like the monolith.&lt;br&gt;
There are many &lt;em&gt;advantages&lt;/em&gt; to a microservice approach as well though.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Each problem can be handled and managed independently.&lt;/li&gt;
&lt;li&gt; It makes the codebases more easily managed and the project can be broken up into more easily managed chunks and handled by specialized teams.&lt;/li&gt;
&lt;li&gt;New technologies can be adopted more easily, as you can update the services one by one, rather than all at once.&lt;/li&gt;
&lt;li&gt;Changes and enhancements to the application don’t require the entire application to be deployed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The major &lt;em&gt;disadvantage&lt;/em&gt; of Microservice is&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The initial deployment and development of a microservices architecture requires a high number of resources and can take time. Since there needs to be a seamless integration of the varying individual components.&lt;/li&gt;
&lt;li&gt;Due to the complexity of this architecture, testing can prove to be difficult, especially in terms of the interactions between services.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;So Monolith or Microservice?&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Choosing a monolithic architecture:&lt;/em&gt; Small teams, simple application, fast deployment, No microservice expertise, quick release.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Choosing a microservice architecture:&lt;/em&gt; Complex and scalable application, long term plans, larger data scale, have a team with different language expertise.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>microservices</category>
      <category>systems</category>
      <category>design</category>
    </item>
  </channel>
</rss>
