<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hasan Demir on Medium]]></title>
        <description><![CDATA[Stories by Hasan Demir on Medium]]></description>
        <link>https://medium.com/@hsndmr?source=rss-d9b3ae594943------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*W-g1sE98yzodSUzquGodEg.jpeg</url>
            <title>Stories by Hasan Demir on Medium</title>
            <link>https://medium.com/@hsndmr?source=rss-d9b3ae594943------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 06:28:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hsndmr/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Enhance Laravel App Debugging with the Power of Cappadocia Viewer]]></title>
            <link>https://medium.com/@hsndmr/enhance-laravel-app-debugging-with-the-power-of-cappadocia-viewer-f3f16d0fc1b0?source=rss-d9b3ae594943------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3f16d0fc1b0</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[log-viewer]]></category>
            <category><![CDATA[debug]]></category>
            <dc:creator><![CDATA[Hasan Demir]]></dc:creator>
            <pubDate>Wed, 02 Aug 2023 00:26:16 GMT</pubDate>
            <atom:updated>2023-08-05T18:24:59.378Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jWLfVoilg3GewAqdWytcrA.png" /></figure><p>Cappadocia Viewer, a desktop application, significantly enhances the debugging experience by providing a dedicated window for seamless transmission of debugging information</p><h3>Installation</h3><p>Before debugging your Laravel app, it is essential to install the Cappadocia Viewer desktop app, which allows you to debug your Laravel app. To get the Cappadocia Viewer desktop app, visit the <a href="https://github.com/hsndmr/cappadocia-viewer/releases/tag/0.1.0"><strong>releases page</strong></a> and download the app.</p><p>Once you have the Cappadocia Viewer desktop app installed, you can integrate it with your Laravel project by installing the “Cappadocia Viewer for Laravel” package via Composer. Open your terminal and run the following command:</p><pre>composer require hsndmr/cappadocia-viewer-for-laravel --dev</pre><h3>Usage</h3><h4>Showing Queries</h4><p>You can show queries by using cappadocia helper function.</p><pre>cappadocia()-&gt;watchQueries();<br>User::latest()-&gt;first();<br>cappadocia()-&gt;stopWatchingQueries();<br>    <br>// This query will not be shown in the viewer<br>User::first()-&gt;first();</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7-ASJT1bxRaZW_uf.png" /></figure><p>If you want to show all queries, you can add CAPPADOCIA_VIEWER_WATCH_QUERIES=true to your .env file.</p><h4>Showing Jobs</h4><p>You can show jobs by using cappadocia helper function.</p><pre>cappadocia()-&gt;watchJobs();<br>CappadociaViewerJob::dispatchSync(&#39;viewer&#39;);<br>cappadocia()-&gt;stopWatchingJobs();<br><br>// This job will not be shown in the viewer<br>CappadociaViewerJob::dispatchSync(&#39;another viewer&#39;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BB-cZF4B2vxti1K6.png" /></figure><p>If you are utilizing Laravel Horizon, you can insert CAPPADOCIA_VIEWER_WATCH_JOBS=true into your .env file. This will enable you to view all jobs in the viewer</p><h4>Showing Jobs</h4><p>Logs are shown by default. If you want to disable it, you can add CAPPADOCIA_VIEWER_WATCH_LOGS=false to your .env file.</p><pre>Log::info(&#39;This log will be shown in the viewer&#39;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vzwcEHrUTAxdJVrK.png" /></figure><h4>Showing Requests</h4><p>If you want to show requests, you can add CAPPADOCIA_VIEWER_WATCH_REQUESTS=true to your .env file. After that, you can see all requests in the viewer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hFdOlBbeetkqtt8V.png" /></figure><h4>Custom Messages</h4><p>If you want to show custom messages, you can use cappadocia helper function.</p><pre>cappadocia(&#39;This is custom message&#39;)<br>    -&gt;send([<br>        &#39;custom&#39; =&gt; &#39;data&#39;,<br>    ]);<br><br>cappadocia(&#39;This is custom message with Badge&#39;)<br>    -&gt;setBadge(&#39;Badge&#39;)<br>    -&gt;send([<br>        &#39;custom&#39; =&gt; &#39;data&#39;,<br>    ]);<br></pre><h3>Disabling Cappadocia Viewer</h3><p>To disable the Cappadocia Viewer, you can include CAPPADOCIA_VIEWER_ENABLED=false in your .env file. This could be particularly useful if you wish to disable it within a testing environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3f16d0fc1b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seamlessly Combining NestJS and NextJS Projects with Vercel Deployment]]></title>
            <link>https://medium.com/@hsndmr/seamlessly-combining-nestjs-and-nextjs-projects-with-vercel-deployment-378c742abc5a?source=rss-d9b3ae594943------2</link>
            <guid isPermaLink="false">https://medium.com/p/378c742abc5a</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[nestjs]]></category>
            <dc:creator><![CDATA[Hasan Demir]]></dc:creator>
            <pubDate>Sat, 18 Mar 2023 10:20:47 GMT</pubDate>
            <atom:updated>2023-03-18T10:43:47.608Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*KDMx1YspSrBcFJG-NDZgDg.png" /></figure><p><a href="https://nextjs-auth-starter-topaz.vercel.app/">https://nextjs-auth-starter-topaz.vercel.app/</a></p><p>Assume that there is an existing NestJS project for managing user authentication tasks such as login, registration, and logout. First, deploy the NestJS project on Vercel. Next, create and deploy a NextJS project on Vercel. When both projects are deployed, link the NextJS project to the NestJS project.</p><h3>NestJS Auth Project</h3><p><a href="https://github.com/hsndmr/nestjs-auth-starter">The NestJS Auth Starter project</a> is a starter project for <a href="https://nestjs.com/">NestJS</a> that provides authentication and authorization functionality out of the box. It is built on top of the popular NestJS framework and uses the <a href="https://mongoosejs.com/">mongoose</a> library to access the database. For authentication and authorization, it relies on the powerful <a href="https://www.npmjs.com/package/jsonwebtoken">jsonwebtoken</a> library, while password hashing is performed using <a href="https://www.npmjs.com/package/bcrypt">bcrypt</a>. Additionally, the project utilizes the <a href="https://xstate.js.org/">xstate</a> library for state management in authentication cases, and includes tests for all cases. With this starter project, developers can quickly set up a secure and robust authentication system in their NestJS applications.</p><h3>NextJS Auth Project</h3><p><a href="https://github.com/hsndmr/nextjs-auth-starter">The NextJS Auth Starter project</a> uses a NestJS api for user authentication and has three pages: login, register, and dashboard. Visitors to the site can either log in or register, while users can log out. The project utilizes XState for handling authentication-related cases.</p><p>This project is deployed on Vercel and can be accessed at <a href="https://nextjs-auth-starter-topaz.vercel.app/">https://nextjs-auth-starter-topaz.vercel.app/</a></p><h3>Connection NestJS To NextJS</h3><p>We have NextJS project. It is deployed to Vercel. We need to add config to conect NestJS to NextJS. We will add some rules to next.config.js file.</p><pre>/** @type {import(&#39;next&#39;).NextConfig} */<br>const nextConfig = {<br>  reactStrictMode: true,<br>  swcMinify: true,<br>};<br><br>module.exports = {<br>  ...nextConfig,<br>  async rewrites() {<br>    return [<br>      {<br>        source: &#39;/api/:path*&#39;,<br>        destination: `${process.env.API_URL}/:path*`,<br>      },<br>    ];<br>  },<br>};</pre><p>By adding these rules, requests will be automatically redirected to NestJS.</p><h3>How to Store a Token Securely</h3><p>When a user signs in, their authentication token is securely stored in a cookie with the HttpOnly and SameSite (Strict) attributes. Using the “Strict” setting for SameSite on cookies involved in user authentication or session management helps to substantially lower the chances of CSRF attacks. Nevertheless, this security measure on its own may not be enough to defend against all forms of CSRF attacks. Therefore, it’s crucial to implement additional safeguards like CSRF tokens, which will be added to this project at a later stage.</p><p><a href="https://nextjs-auth-starter-topaz.vercel.app/">https://nextjs-auth-starter-topaz.vercel.app/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=378c742abc5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing JWT Authentication in NestJS]]></title>
            <link>https://medium.com/@hsndmr/implementing-jwt-authentication-in-nestjs-a-step-by-step-guide-847c1e97e490?source=rss-d9b3ae594943------2</link>
            <guid isPermaLink="false">https://medium.com/p/847c1e97e490</guid>
            <category><![CDATA[jwt-auth]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[nestjs-tutorial]]></category>
            <category><![CDATA[nestjs]]></category>
            <dc:creator><![CDATA[Hasan Demir]]></dc:creator>
            <pubDate>Sun, 05 Mar 2023 02:29:30 GMT</pubDate>
            <atom:updated>2023-03-05T02:30:51.786Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*smxvqnwDeqJglsfLzt2IVw.jpeg" /></figure><p>Authentication plays a crucial role in ensuring the security of any application by validating the identity of users before granting them access to various functionalities. It enables businesses to keep track of the number of individuals utilizing their products or services. In other words, authentication helps to establish trust and accountability by ensuring that only authorized users can access sensitive information or perform specific actions within an application.</p><p>This article focuses on the <a href="https://github.com/hsndmr/nestjs-auth-starter">NestJS Auth Starter project</a>, which serves as an excellent example of how to implement JWT authentication. The project provides a useful template for developers seeking to build secure, scalable, and customizable authentication systems in their NestJS applications.</p><h3>Prerequisites</h3><p>Before you begin with this tutorial, make sure that you have the following software installed on your computer as it is a practical, hands-on demonstration:</p><ul><li><a href="https://www.mongodb.com/">MongoDB</a></li><li><a href="https://nodejs.org/">Nodejs</a> v16 and above</li></ul><h3>NestJS Auth Starter</h3><p><a href="https://github.com/hsndmr/nestjs-auth-starter">The NestJS Auth Starter project</a> is a starter project for NestJS that provides authentication and authorization functionality out of the box. It is built on top of the popular NestJS framework and uses the Mongoose library to access the database. For authentication and authorization, it relies on the powerful jsonwebtoken library, while password hashing is performed using bcrypt. Additionally, the project utilizes the xstate library for state management in authentication cases, and includes tests for all cases. With this starter project, developers can quickly set up a secure and robust authentication system in their NestJS applications.</p><h4>Installation</h4><p>Clone it:</p><pre>https://github.com/hsndmr/nestjs-auth-starter</pre><p>Install the dependencies for the Nest application:</p><pre>npm install</pre><p>Create .env file from .env.example</p><pre>cp .env.example .env</pre><p>Set `MONGO_URI` and `JWT_SECRET`</p><pre>MONGO_URI=Mongo_uri<br>JWT_SECRET=secret</pre><p>Run NestJS Application</p><pre>npm run start<br><br># watch mode<br>npm run start:dev</pre><p>Open api documentation</p><pre>http://localhost:3000/api</pre><h3>What is JWT?</h3><p>JWT stands for JSON Web Token, which is a compact and secure way of transmitting information between parties as a JSON object. It consists of three parts: a header, a payload, and a signature.</p><p>The header describes the type of token and the algorithm used for the signature. The payload contains the information that needs to be transmitted, such as user ID, permissions, and expiration time. The signature is generated using the header, the payload, and a secret key that is known only to the sender and the receiver, which ensures the integrity and authenticity of the information.</p><p>JWTs are commonly used for authentication and authorization in web applications, where a user logs in and receives a JWT that can be used to access protected resources on the server. The server can verify the JWT and allow or deny access based on the information in the payload. JWTs can also be used for sharing information between microservices in a distributed system.</p><h3>Creating a token using JWT</h3><p>To create a token, we will rely on the “jsonwebtoken” library, which requires a user’s information (user_id), a JWT ID (jti), expiration time (exp) and a secret key. When a user registers, we will generate a token that can be used to access their credentials. The JWT ID is a string generated through cryptography, while the secret key must be consistent across all tokens to ensure successful encryption and decryption. Below is an example code snippet demonstrating how to create a token:</p><pre>sign(options: SignOptions): Sign {<br><br>  const exp =<br>    Math.floor(Date.now() / MS_PER_SEC) +<br>    (options.exp || this.options.exp || DEFAULT_EXPIRES_IN);<br><br>  const jti = this.cryptoService.randomString(80);<br>  const token = this.jwt.sign(<br>    {<br>      exp: exp,<br>      subject: options.subject,<br>      jti: jti,<br>    },<br>    this.options.secret,<br>  );<br><br>  return {<br>    token: token,<br>    exp: exp,<br>    jti: this.cryptoService.hash(jti),<br>  };<br>}</pre><p>To prevent unauthorized token creation using the same JWT ID (jti), we will hash the jti value. We are saving it as hased version. Furthermore, the secret key used to create a token must be the same as the one used to verify it during the authentication process. This ensures successful encryption and decryption of the token.</p><p>We will be storing a token for each user, which includes both an expiration time (expires_at) and the hashed JWT ID (jti). This ensures that the token will expire after a set period.</p><pre>{<br>    &quot;_id&quot;: { &quot;$oid&quot;: &quot;11fbe057e3bf5a530d800da5&quot; },<br>    &quot;name&quot;: &quot;Name&quot;,<br>    &quot;lastName&quot;: &quot;lastName&quot;,<br>    &quot;email&quot;: &quot;email@test.com&quot;,<br>    &quot;password&quot;: &quot;password&quot;,<br>    &quot;tokens&quot;: [{ &quot;jti&quot;: &quot;3b7a2b88104f5ac07529058125db8560f50a3fd2126d1d03874e2d7cc2d755b6&quot;, &quot;expires_at&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1677454952000&quot; } } }],<br>    &quot;createdAt&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1677451351967&quot; } },<br>    &quot;updatedAt&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1677451352045&quot; } },<br>    &quot;__v&quot;: { &quot;$numberInt&quot;: &quot;1&quot; }<br>}</pre><h4>Encoded Token:</h4><pre>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2Nzc5ODM4NDQsInN1YmplY3QiOiI2NDAzZjI1NDY2YTY1MjE5YWI4OTU2NjgiLCJqdGkiOiJlMDNkMzgyZjc1MmY4MjBmNzUwMzRiYzU0NmYyMzdhYjI1NGQ5OTUwZTRhY2YxODM2ZjUzMmVhZWM3ODdiYWJkNDZkNWRmNjg5MWRlODI2YzYxMTcwNzBiNGY0NzA0OWEzNDFjZWIwNjY4NjUxZDFkNGY2MTA4YzA2YjY2ZTRjODk2NTY4NmE0MjllZWNlYzQ3MGRlNjVjZmExYTBiYWRiIiwiaWF0IjoxNjc3OTgwMjQ0fQ.2KLZucbBX7PMVZYQTSfn2HQxJVvn1DMv390kCJMaTb</pre><h4>Payload:</h4><pre>{<br>  &quot;exp&quot;: 1677983844,<br>  &quot;subject&quot;: &quot;6403f25466a65219ab895668&quot;,<br>  &quot;jti&quot;: &quot;e03d382f752f820f75034bc546f237ab254d9950e4acf1836f532eaec787babd46d5df6891de826c6117070b4f47049a341ceb0668651d1d4f6108c06b66e4c8965686a429eecec470de65cfa1a0badb&quot;,<br>  &quot;iat&quot;: 1677980244<br>}</pre><p>Once a token is decoded and verified, it will have a payload containing data that can be verified. To verify the token, we’ll search for a user using the JWT and subject (user_id) values. If a user is found using these values, we can confirm that the token is valid and has been successfully verified.</p><h3>Verifying a token using JWT</h3><p>Let’s say we have a user with a token who wishes to obtain their information. To accomplish this, the first step is to decode the token using the secret key. If we can confirm that the token was indeed created using our secret key, it will be considered verified. Once verified, the payload will include a subject (user_id) and a random string known as the JWT ID (jti). Next, we’ll hash the jti and search for it in our database. If we locate a user with matching jti and user_id values, we can retrieve their information.</p><pre>verify(token: string): Promise&lt;JwtPayload&gt; {<br>  return new Promise((resolve, reject) =&gt; {<br>    this.jwt.verify(token, this.options.secret, (err, decoded) =&gt; {<br>      if (err) {<br>        reject(err);<br>        return;<br>      }<br><br>      if (typeof decoded !== &#39;object&#39;) {<br>        reject(new Error(&#39;Invalid token&#39;));<br>        return;<br>      }<br><br>      resolve({<br>        ...decoded,<br>        jti: this.cryptoService.hash(decoded.jti),<br>      });<br>    });<br>  });<br>}</pre><h3>Conclusion</h3><p>In this guide, we have explored the basics of JWT authentication and how to implement it in NestJS. We’ve covered the essential components of a JWT, how to create a token using the jsonwebtoken library, and how to verify a token’s authenticity by searching for a matching jti and user_id value in our database. By understanding these concepts and following the step-by-step guide, developers can build robust and secure authentication systems for their NestJS applications. Proper authentication is critical in establishing trust with users and ensuring the confidentiality and integrity of sensitive information. With the knowledge gained from this guide, developers can create scalable and customizable authentication systems to meet their application’s specific needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=847c1e97e490" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reactotron React Query for React Native]]></title>
            <link>https://medium.com/@hsndmr/reactotron-react-query-for-react-native-e005687167f6?source=rss-d9b3ae594943------2</link>
            <guid isPermaLink="false">https://medium.com/p/e005687167f6</guid>
            <category><![CDATA[react-query]]></category>
            <category><![CDATA[reactotron]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Hasan Demir]]></dc:creator>
            <pubDate>Sun, 01 Jan 2023 23:28:35 GMT</pubDate>
            <atom:updated>2023-01-01T23:28:35.263Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*laiHarzXYbvl2CN2h5gbrg.png" /></figure><p>Is there a plugin for Reactotron that allows for similar functionality to the React Query Devtools? Certainly! The React Query plugin for Reactotron allows you to debug and inspect the cache and queries of your React Query application in Reactotron. This can be useful for understanding how your React Query application is behaving and identifying any potential issues or problems.</p><h3>Installation</h3><pre>npm i react-query<br>npm i reactotron-react-native --save-dev<br>npm i reactotron-react-query --save-dev</pre><h3>Usage</h3><p>Create a file queryClient.ts</p><pre>import { QueryClient } from &quot;react-query&quot;;<br>const queryClient = new QueryClient();<br><br>export { queryClient };</pre><p>Create a file reactotron.ts</p><pre>import Reactotron from &quot;reactotron-react-native&quot;;<br>import { queryClient } from &quot;./queryClient&quot;;<br>import {<br>  QueryClientManager,<br>  reactotronReactQuery,<br>} from &quot;reactotron-react-query&quot;;<br><br>const queryClientManager = new QueryClientManager({<br>  queryClient,<br>});<br>Reactotron.use(reactotronReactQuery(queryClientManager))<br>  .configure({<br>    onDisconnect: () =&gt; {<br>      queryClientManager.unsubscribe();<br>    },<br>  })<br>  .useReactNative()<br>  .connect();</pre><p>Import the queryClient and reactotron in your App.jsx file.</p><pre>import { StyleSheet, Text, View } from &quot;react-native&quot;;<br>import { QueryClientProvider } from &quot;react-query&quot;;<br>import { queryClient } from &quot;./queryClient&quot;;<br><br>if (__DEV__) {<br>  // @ts-ignore<br>  import(&quot;./reactotron&quot;);<br>}<br>export default function App() {<br>  return (<br>    &lt;QueryClientProvider client={queryClient}&gt;<br>      &lt;View style={styles.container}&gt;<br>        &lt;Text&gt;Open up App.js to start working on your app!&lt;/Text&gt;<br>      &lt;/View&gt;<br>    &lt;/QueryClientProvider&gt;<br>  );<br>}<br><br>const styles = StyleSheet.create({<br>  container: {<br>    flex: 1,<br>    backgroundColor: &quot;#fff&quot;,<br>    alignItems: &quot;center&quot;,<br>    justifyContent: &quot;center&quot;,<br>  },<br>});</pre><p><a href="https://github.com/hsndmr/reactotron-react-query#readme">https://github.com/hsndmr/reactotron-react-query</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e005687167f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel Horizon Watcher]]></title>
            <link>https://medium.com/@hsndmr/laravel-horizon-watcher-4deba1221542?source=rss-d9b3ae594943------2</link>
            <guid isPermaLink="false">https://medium.com/p/4deba1221542</guid>
            <category><![CDATA[restart]]></category>
            <category><![CDATA[watcher]]></category>
            <category><![CDATA[horizons]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Hasan Demir]]></dc:creator>
            <pubDate>Mon, 12 Dec 2022 20:01:08 GMT</pubDate>
            <atom:updated>2022-12-12T20:01:08.571Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tI_sELZ_jIZALc9ktZ5f1g.png" /></figure><p>It is common for people to spend a significant amount of time debugging local jobs, only to realize that they forgot to restart Horizon. This can be frustrating and can cause people to lose valuable time. To avoid this situation, it is important to regularly check that Horizon is running properly and to restart it as necessary.</p><p>I recently came across a package that automatically restarts Horizon when a PHP file is changed. <a href="https://github.com/spatie/laravel-horizon-watcher/">This package</a> is developed using PHP, and it must be installed in every project where it is used. I thought that it would be useful to create a similar package that could be installed only once and used in any Laravel project. This would save time and effort, as the package would not need to be installed separately for each project.</p><p>I have developed <a href="https://github.com/hsndmr/laravel-horizon-watcher">a package</a> using Node.js that can be used in any Laravel project. This package is designed to improve the functionality of Laravel and make it easier to use in a variety of different projects. By using this package, developers can save time and effort.</p><p><strong>Installation</strong></p><pre>npm i -g laravel-horizon-watcher</pre><p><strong>Usage</strong></p><p>Run this command in the root directory of your Laravel application:</p><pre>laravel-horizon-watcher start</pre><p><strong>Custom Php Interpreter</strong></p><p>If you want to use a custom php interpreter, you can use the --php option:</p><pre>laravel-horizon-watcher start --php=&quot;/usr/bin/php7.4&quot;</pre><p><strong>Custom Paths to Watch</strong></p><p>If you want to watch a custom path, you can use the --path option:</p><pre>laravel-horizon-watcher start --paths=&quot;app,config,.env&quot;</pre><p><a href="https://github.com/hsndmr/laravel-horizon-watcher">GitHub - hsndmr/laravel-horizon-watcher: This package automatically restarts Horizon whenever a PHP file in the local environment is changed</a></p><p><a href="https://www.npmjs.com/package/laravel-horizon-watcher">https://www.npmjs.com/package/laravel-horizon-watcher</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4deba1221542" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Go authentication project with go sanctum]]></title>
            <link>https://medium.com/@hsndmr/go-authentication-project-with-go-sanctum-d72ee7fe94ad?source=rss-d9b3ae594943------2</link>
            <guid isPermaLink="false">https://medium.com/p/d72ee7fe94ad</guid>
            <category><![CDATA[go-rest-api]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[go-authenticated]]></category>
            <category><![CDATA[go-gin-authenticated]]></category>
            <category><![CDATA[go-gin-example-project]]></category>
            <dc:creator><![CDATA[Hasan Demir]]></dc:creator>
            <pubDate>Wed, 04 May 2022 13:34:59 GMT</pubDate>
            <atom:updated>2022-05-04T13:36:52.501Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ifpd_HtDiK9u6h68SZgNuA.png" /></figure><p>Laravel Sanctum provides an easy-to-use authentication system. I used Laravel Sanctum my last project. My goal was to implement Laravel Sanctum to the Go</p><p>Git Repository:</p><p><a href="https://github.com/hsndmr/go-sanctum">https://github.com/hsndmr/go-sanctum</a></p><h3>What does the Laravel Sanctum do?</h3><p>The Laravel Sanctum generates a token which describes it to a user.</p><p><strong>How to generate a token?</strong></p><p>1-) A string of 40 characters is generated by random</p><p>Random String: hgB3RurwJgkbgzlxQ7OnNYnqkJ63Dia0ngMsNwxz</p><p>2-) This string that is generated is hashed with SHA algorithm.</p><p>Hashed String: 49cb804484328c044c5e04899d7ef46321017075afe989dcb97c9a7c9b4b60d4</p><p>3-) The hash value and user information (user_id) is stored somewhere like a database.</p><pre>+----+---------+-------------+<br>| id | user_id |    token    |<br>+----+---------+-------------+<br>|  1 |       1 | 49cb8044... |<br>+----+---------+-------------+</pre><p>4-) The data id which is stored is merged with string that is generated. New string after merged is token (1|hgB3RurwJgkbgzlxQ7OnNYnqkJ63Dia0ngMsNwxz)</p><p><strong>How to verify a token?</strong></p><p>1-) The token is parsed.</p><p>ID: 1<br>String: hgB3RurwJgkbgzlxQ7OnNYnqkJ63Dia0ngMsNwxz</p><p>2-) This string that is parsed hashed with SHA algorithm.</p><p>Hashed String: 49cb804484328c044c5e04899d7ef46321017075afe989dcb97c9a7c9b4b60d4</p><p>3-) ID and String which parsed and hashed from the token is searched from the database. If these are found in the database, the token is verified.</p><p>Example Search Query:</p><pre>Select * from tokens where token=49cb804484328c044c5e04899d7ef46321017075afe989dcb97c9a7c9b4b60d4 and id = 1</pre><h3>What does the Go Sanctum Project do?</h3><p>Go Sanctum offers a simple-to-use authentication system like Laravel Sanctum.</p><h3>How to install Go Sanctum?</h3><p>Clone the repository</p><pre>git clone https://github.com/hsndmr/go-sanctum</pre><p>Go to the repository folder and execute command</p><pre>docker build --tag go-sanctum .</pre><p>Run the go-sanctum docker image</p><pre>docker run -p 3000:3000 --name go-sanctum go-sanctum</pre><p>Open swagger</p><pre><a href="http://localhost:3000/swagger/index.html">http://localhost:3000/swagger/index.html</a></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d72ee7fe94ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>