<?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: Vinicio Ochoa</title>
    <description>The latest articles on DEV Community by Vinicio Ochoa (@fochoac).</description>
    <link>https://dev.to/fochoac</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%2F191730%2Fe9cd0182-62c1-4fba-ba92-cdb4a90029c4.png</url>
      <title>DEV Community: Vinicio Ochoa</title>
      <link>https://dev.to/fochoac</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fochoac"/>
    <language>en</language>
    <item>
      <title>Building a Basic Web Architecture</title>
      <dc:creator>Vinicio Ochoa</dc:creator>
      <pubDate>Tue, 05 May 2020 03:21:44 +0000</pubDate>
      <link>https://dev.to/fochoac/architecting-a-basic-web-architecture-51k5</link>
      <guid>https://dev.to/fochoac/architecting-a-basic-web-architecture-51k5</guid>
      <description>&lt;h1&gt;
  
  
  Design the architecture
&lt;/h1&gt;

&lt;p&gt;When a team or person will want to create a general architecture, always try to generalize to five layers and tries to answers the questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access to Data: &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How do I consume and persist the information?&lt;br&gt;
What kind of database do I should use?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Business Logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How do I ensure an atomic transaction without loss of data?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Service Layer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What kind of protocol do I should use for publishing my services?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Presentation Layer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do I need a mobile, desktop, or web application?&lt;br&gt;
What framework or library do I should use?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security Layer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What security mechanism do I should use?&lt;/p&gt;

&lt;h2&gt;
  
  
  Answer the Questions
&lt;/h2&gt;

&lt;p&gt;To answer the questions you have to analyze the story to implement at his company, for example: &lt;br&gt;
The ACME Corporation needs to manage its inventory with a web system and needs to access it a cell phone. The system has to ensure that doesn't lose the information.  The company has a PostgresSQL database for other systems.&lt;/p&gt;

&lt;p&gt;What do you think is the best solution to the problem? Let's try to analyze the problem based on the questions proposed in the previous section.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Layer:
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Answer&lt;/th&gt;
&lt;th&gt;Observation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Do you need save the  inventory information?&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Do you need to ensure the  atomicity in the information?&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;It’s a transactional system&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Does the company manage  any databases?&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;The company manages a relational database.                                 Is there any relational database?     Yes, PostgresSQL                      Is there any NoSQL database?     No, there isn't any database&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;If  the company does not have any database, what database would you recommend to  the company? Why?&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Based on the questions  above, I recommend a relational database to manage inventory data and a NoSQL database for the logging events, because, there is a minor probability of the lost data than in the NoSQL database.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Business Layer:
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Answer&lt;/th&gt;
&lt;th&gt;Observation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Does the database manage  transactionality?&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Does the system need to support stateless and stateful transactions?&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;The system can be managed in stateless or stateful transactions.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Service Layer:
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Answer&lt;/th&gt;
&lt;th&gt;Observation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Does the system need any web service?&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;The inventory system needs to access in a cell phone&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What kind of  web service protocol do you need?&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;The mobile applications work fine with a lightweight protocol, hence I going to use RESTful Web Service.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Presentation Layer:
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Answer&lt;/th&gt;
&lt;th&gt;Observation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Do I need a mobile,  desktop, or web application?&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;The inventory system needs to access a cell phone and a web app.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What framework  or library do I should use?&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;The resources need to manage in the front end to try to save the server resources. There are many JavaScript libraries, for example, Vuejs, angular, react, etc. The service layer will help to manage the web services to interact with JavaScript libraries&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Security Layer:
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Answer&lt;/th&gt;
&lt;th&gt;Observation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Does the system needs  security?&lt;/td&gt;
&lt;td&gt;YES&lt;/td&gt;
&lt;td&gt;The inventory system needs to ensure the security to prevent unauthorized access to private resources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What security mechanism do  I should use?&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;There are many security mechanisms, for example, OAuth, JWT, User, and password. It will depend on the strategies and the criticality of the system. I think the intermediate strategy is JWT for web service security and mobile security, I recommend OAUTH, because many users use a third account credential, for example, Google.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;A basic architecture implicates many things, many frameworks, many programming languages in other cases, you will need batch applications to run scheduled processes.&lt;/p&gt;

&lt;p&gt;The necessity of the final user is the most important thing to architecture an application because should ensure hight flexibility to low cost and it is complex. I recommended understanding the business logic before designing any system.&lt;/p&gt;

&lt;p&gt;I hope the article has been helping you and if you believe that I forget anything, please comment and I will put it in the article.&lt;/p&gt;

&lt;p&gt;Regards everybody, &lt;/p&gt;

&lt;p&gt;Vinicio&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
