<?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>Forem: Andrea Bellu</title>
    <description>The latest articles on Forem by Andrea Bellu (@andrebellu).</description>
    <link>https://forem.com/andrebellu</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%2F973430%2F369ec034-609c-4025-b6d3-2489a36f3234.jpeg</url>
      <title>Forem: Andrea Bellu</title>
      <link>https://forem.com/andrebellu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/andrebellu"/>
    <language>en</language>
    <item>
      <title>MongoDB Atlas Hackathon 2022 on DEV</title>
      <dc:creator>Andrea Bellu</dc:creator>
      <pubDate>Thu, 08 Dec 2022 22:57:45 +0000</pubDate>
      <link>https://forem.com/andrebellu/mongodb-atlas-hackathon-2022-on-dev-3ka7</link>
      <guid>https://forem.com/andrebellu/mongodb-atlas-hackathon-2022-on-dev-3ka7</guid>
      <description>&lt;h2&gt;
  
  
  F-Rec
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
F-Rec

&lt;ul&gt;
&lt;li&gt;Table of Contents&lt;/li&gt;
&lt;li&gt;What We built&lt;/li&gt;
&lt;li&gt;Category Submission&lt;/li&gt;
&lt;li&gt;App Link&lt;/li&gt;
&lt;li&gt;Self host your app&lt;/li&gt;
&lt;li&gt;
Screenshots

&lt;ul&gt;
&lt;li&gt;Desktop&lt;/li&gt;
&lt;li&gt;Mobile&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Description&lt;/li&gt;
&lt;li&gt;Link to Source Code&lt;/li&gt;
&lt;li&gt;Permissive License&lt;/li&gt;
&lt;li&gt;Background&lt;/li&gt;
&lt;li&gt;How We built it&lt;/li&gt;
&lt;li&gt;Additional Resources/Info&lt;/li&gt;
&lt;li&gt;Authors&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What We built
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QS6uVLnZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://iili.io/HnzdANI.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QS6uVLnZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://iili.io/HnzdANI.png" alt="Logo" width="746" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Python, Mongodb and Sveltekit project to register access to a door&lt;/p&gt;

&lt;h2&gt;
  
  
  Category Submission
&lt;/h2&gt;

&lt;p&gt;Choose Your Own Adventure&lt;/p&gt;

&lt;h2&gt;
  
  
  App Link
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://f-rec.vercel.app/"&gt;Link to the webapp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use the following credentials to login:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;user&lt;/strong&gt;: &lt;em&gt;test&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;password&lt;/strong&gt;: &lt;em&gt;test&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Self host your app
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create a MongoDB database named "db" with the following collections:

&lt;ul&gt;
&lt;li&gt;users&lt;/li&gt;
&lt;li&gt;access_log&lt;/li&gt;
&lt;li&gt;auth&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;cd to the frontend directory&lt;/li&gt;
&lt;li&gt;Create a .env file in the frontend directory and add the following variables:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;MONGODB_URI&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_mongodb_uri
&lt;span class="nv"&gt;ENV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;production
&lt;span class="nv"&gt;JWT_SECRET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;random_string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace your_mongodb_uri with the uri of your MongoDB database and random_string with a random string.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add an admin to the database by inserting the following data
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"admin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"salt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"salt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"hash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"hash"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Get the hash and salt values by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run &lt;span class="nb"&gt;hash&lt;/span&gt; &amp;lt;password&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now run the app with the following commands:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run build
npm run preview
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visit &lt;a href="http://localhost:4173"&gt;http://localhost:4173&lt;/a&gt; to see the webapp&lt;/p&gt;

&lt;h2&gt;
  
  
  Screenshots
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Desktop
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;fig. 1 - Login Page&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X59Ql_Eq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://iili.io/Hnzfvwl.png" alt="Login" width="880" height="483"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;fig. 2 - Main Dashboard&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K9523-sK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/DW675w4.png" alt="MainDashboard" width="880" height="479"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;fig. 3 - User List&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--29M-tv2c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/OhJeEOT.png" alt="UserList" width="880" height="480"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;fig. 4 - Adding a user&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gvyk6sb3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/60Yl5mK.png" alt="AddUser" width="880" height="480"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Mobile
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;fig. 5 - Dasboard Mobile view&lt;/th&gt;
&lt;th&gt;fig . 6 - User List Mobile View&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QiqjDsqZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/3aVcxN1.png" alt="MobileMainDashboard" width="591" height="1280"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kVNCaU-o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/1EZaTln.png" alt="MobileUserList" width="591" height="1280"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Description
&lt;/h2&gt;

&lt;p&gt;With this webapp you can view the list of users that have access to a door, add new users and delete them. You can also view the history of the access to the door that are recognized by face recognition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Source Code
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/andrebellu/f-rec"&gt;https://github.com/andrebellu/f-rec&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Permissive License
&lt;/h2&gt;

&lt;p&gt;MIT License&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;We thought about a project that could be useful in our daily life. We decided to create a webapp that could be used to register the access to a door. Maybe it could be useful in a school or in a company where you want to know who has access to a specific door and restrict the access to some people. Maybe you can use an arduino to open the door when the face is recognized or you can use a raspberry pi to do the same thing.&lt;/p&gt;

&lt;h2&gt;
  
  
  How We built it
&lt;/h2&gt;

&lt;p&gt;We used python to make a script that uses the webcam that is connected to the computer to recognize the face of the user. If the face is recognized, the script sends the log to the MongoDB database. We used SvelteKit to create the webapp that uses the MongoDB database to show the list of users that have access to the door and the history of the accesses to the door. The people entered in the same day are counted and shown in the dashboard. The webapp is responsive and can be used on mobile devices. We used the following technologies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MongoDB&lt;/li&gt;
&lt;li&gt;Python

&lt;ul&gt;
&lt;li&gt;OpenCV&lt;/li&gt;
&lt;li&gt;Face Recognition&lt;/li&gt;
&lt;li&gt;pymongo&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Sveltekit

&lt;ul&gt;
&lt;li&gt;TailwindCSS&lt;/li&gt;
&lt;li&gt;jsonwebtoken&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Additional Resources/Info
&lt;/h2&gt;

&lt;p&gt;Stack overflow is a great resource to find solutions to problems that you have. We used it to find solutions to problems that we had. We also used the following resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.python.org/"&gt;Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mongodb.com/"&gt;MongoDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kit.svelte.dev/"&gt;Sveltekit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tailwindcss.com/"&gt;TailwindCSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://boxicons.com/"&gt;Box Icons&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fonts.google.com/"&gt;Google Fonts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fonts.google.com/icons"&gt;Google Icons&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Authors
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a class="mentioned-user" href="https://dev.to/mattianicastro"&gt;@mattianicastro&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a class="mentioned-user" href="https://dev.to/andrebellu"&gt;@andrebellu&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a class="mentioned-user" href="https://dev.to/stefanolonghena"&gt;@stefanolonghena&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a class="mentioned-user" href="https://dev.to/leonardobaccalario"&gt;@leonardobaccalario&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a class="mentioned-user" href="https://dev.to/francescoannunziata"&gt;@francescoannunziata&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>atlashackathon22</category>
      <category>svelte</category>
      <category>python</category>
      <category>mongodb</category>
    </item>
  </channel>
</rss>
