<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Juan Manzanero</title><description>Welcome to my domain, stranger.</description><link>https://juanmanzanero.com</link><language>en-us</language><image><url>https://juanmanzanero.com//logo.png</url><title>Juan Manzanero</title><link>https://juanmanzanero.com/</link></image><atom:link href="https://juanmanzanero.com//feed.xml" rel="self" type="application/rss+xml"/><item><title>A Better Way for Consuming Content</title><link>https://juanmanzanero.com/blog/en/a-better-way-for-consuming-content</link><guid isPermaLink="true">https://juanmanzanero.com/blog/en/a-better-way-for-consuming-content</guid><description>Get your news without visiting websites with algorithms that shows content that you don&apos;t want to see.</description><pubDate>Thu, 11 Apr 2024 06:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Get your news without visiting websites with algorithms that shows content that you don&apos;t want to see.&lt;/p&gt;
&lt;h2&gt;Algorithms that Dictates What You See&lt;/h2&gt;
&lt;p&gt;Social media are not designed for showing you the latest and most important
news, but for showing you content dictated by an algorithm.&lt;/p&gt;
&lt;p&gt;And this content is normally viral, and viral doesn&apos;t mean interesting.&lt;/p&gt;
&lt;p&gt;Usually this algorithm prioritizes content that get you angry.&lt;/p&gt;
&lt;p&gt;Content that promotes negativity gets more clicks rather than those whose
promotes positivity.&lt;/p&gt;
&lt;p&gt;That&apos;s the reason why Twitter and Facebook are full of stupid and irrelevant
posts (usually).&lt;/p&gt;
&lt;p&gt;Of course, it&apos;s really cool when the algorithm shows you content that you like,
discovering new people and pages, but that&apos;s not usual.&lt;/p&gt;
&lt;p&gt;Without mentioning the annoying ads and more stuff that wants you to click it.&lt;/p&gt;
&lt;p&gt;Meta (previously Facebook) knows about this, and encourages it in their products
like Instagram and Facebook, and the same for Twitter.&lt;/p&gt;
&lt;h2&gt;The Solution: News Aggregators (RSS)&lt;/h2&gt;
&lt;p&gt;RSS is an acronym for &quot;Really Simple Syndication&quot;.&lt;/p&gt;
&lt;p&gt;It&apos;s an ancient technology, not promoted so much by companies.&lt;/p&gt;
&lt;p&gt;That&apos;s because when you read a post in an RSS Reader, you don&apos;t need to visit
the website, and the website can&apos;t show advertisements using Google Ads (for
example). You don&apos;t generate traffic; your visits don&apos;t count, at least not if
you don&apos;t open the post link in your RSS Reader.&lt;/p&gt;
&lt;p&gt;The good thing is that almost every RSS Reader shows you content sorted by date,
not by a creepy algorithm that wants you to be mad.&lt;/p&gt;
&lt;p&gt;For my website I use a Node.js script that takes the &lt;code&gt;.mdx&lt;/code&gt; files inside &lt;code&gt;content/blog&lt;/code&gt; and
&lt;code&gt;content/portfolio&lt;/code&gt;, then generates the RSS Items, those with the &lt;code&gt;rss: true&lt;/code&gt; in
the metadata.&lt;/p&gt;
&lt;h2&gt;How to Use an RSS Reader&lt;/h2&gt;
&lt;p&gt;First, you should download one.&lt;/p&gt;
&lt;p&gt;There are many options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://netnewswire.com/&quot;&gt;NetNewsWire&lt;/a&gt;: a native RSS Reader for macOS and
iOS, free and Open Source, my favorite option as an Apple &lt;s&gt;Sinner&lt;/s&gt; user&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://apps.kde.org/akregator&quot;&gt;Akregator&lt;/a&gt;: from the KDE project for Linux&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.nononsenseapps.feeder.play&quot;&gt;Feeder&lt;/a&gt;:
for Android&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ravenreader.app/&quot;&gt;Raven Reader&lt;/a&gt;: desktop cross-platform&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Adding Feeds&lt;/h3&gt;
&lt;p&gt;Now you need to search for the RSS URL on your favorite website, like
&lt;a href=&quot;https://juanmanzanero.com/feed.xml&quot;&gt;this one&lt;/a&gt;!&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;https://juanmanzanero.com/rss.xml
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you open it, you&apos;ll get a weird page with code similar to HTML.&lt;/p&gt;
&lt;p&gt;Once copied, go to your RSS feed and search for &quot;Add feed&quot; or something similar,
and paste the link, and you&apos;re done! Now you&apos;ll get the latest posts from my
website.&lt;/p&gt;
&lt;h3&gt;Adding Social Media Feeds&lt;/h3&gt;
&lt;p&gt;You can even add feeds from sites like Reddit or YouTube.&lt;/p&gt;
&lt;h4&gt;Reddit&lt;/h4&gt;
&lt;p&gt;Just change &lt;code&gt;[SUBREDDIT]&lt;/code&gt; for the name of your subreddit to add:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;https://reddit.com/r/[SUBREDDIT]/new/.rss
&lt;/code&gt;&lt;/pre&gt;
&lt;h4&gt;YouTube&lt;/h4&gt;
&lt;p&gt;Go to the channel to add, then go to the &lt;strong&gt;About&lt;/strong&gt; tab, then click on &lt;strong&gt;Share &amp;gt;
Copy channel ID&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Now just change &lt;code&gt;[CHANNEL ID]&lt;/code&gt; for the copied one:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;https://youtube.com/feeds/videos.xml?channel_id=[CHANNEL ID]
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;My Favorite Feeds&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://juanmanzanero.com/feed.xml&quot;&gt;juanmanzanero.com (obviously!)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://apod.com/feed.rss&quot;&gt;Astronomic Picture of the Day (apod)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://feeds2.feedburner.com/EarthSciencePictureoftheDay&quot;&gt;Earth Science Picture of the Day (epod)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ericmurphy.xyz/index.xml&quot;&gt;Erick Murphy (cool guy)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://lukesmith.xyz/index.xml&quot;&gt;Luke Smith&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;More About RSS&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.privacytools.io/privacy-rss-feed-readers&quot;&gt;Privacy Tools - RSS Feed Readers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.privacyguides.org/en/news-aggregators/&quot;&gt;Privacy Guides - News Aggregators&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content:encoded><author>Juan Manzanero</author></item><item><title>Build a fullstack web app</title><link>https://juanmanzanero.com/blog/en/build-a-fullstack-app-copy</link><guid isPermaLink="true">https://juanmanzanero.com/blog/en/build-a-fullstack-app-copy</guid><description>Build a fullstack web app using Next.js as meta-framework and PostgreSQL as database.</description><pubDate>Thu, 18 Jan 2024 06:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://github.com/juanmanzanero-com/fullstack-app&quot;&gt;GitHub repo&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Content&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#1-introduction&quot;&gt;Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#2-initial-setup&quot;&gt;Initial setup&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#21-install-shadcnui&quot;&gt;Install shadcn/ui&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#22-create-a-db-using-docker&quot;&gt;Create a db using Docker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#23-install-prisma&quot;&gt;Install Prisma&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#24-config-authjs&quot;&gt;Config Auth.js&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#3-improve-your-ui&quot;&gt;Improve your UI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#4-add-crud-functionality&quot;&gt;Add CRUD functionality&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#5-conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;1. Introduction&lt;/h2&gt;
&lt;p&gt;In this tutorial, we will develop a fullstack web app with the following tech
stack:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://nextjs.org/&quot;&gt;Next.js&lt;/a&gt; as meta-framework&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://tailwindcss.com/&quot;&gt;TailwindCSS&lt;/a&gt; for styling&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://ui.shadcn.com/&quot;&gt;shadcn/ui&lt;/a&gt; for UI components&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.prisma.io/&quot;&gt;Prisma&lt;/a&gt; as ORM&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt; as database&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://authjs.dev/&quot;&gt;Auth.js&lt;/a&gt; for authentication&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.docker.com/&quot;&gt;Docker&lt;/a&gt; for creating an intance of a PostgreSQL
database locally&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We&apos;ll learn some of the fundamentals of this tech stack, like using &lt;strong&gt;server
components&lt;/strong&gt; in Next.js, or creating &lt;strong&gt;API endpoints&lt;/strong&gt; using the &lt;strong&gt;app router&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;2. Initial setup&lt;/h2&gt;
&lt;p&gt;Let&apos;s start creating a new Next.js project, in your &lt;strong&gt;terminal&lt;/strong&gt; run:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npx create-next-app@latest
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Make sure to mark &lt;strong&gt;Yes&lt;/strong&gt; the following options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Would you like to use &lt;strong&gt;TypeScript&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;Would you like to use &lt;strong&gt;ESLint&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;Would you like to use &lt;strong&gt;Tailwind CSS&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;Would you like to use &lt;strong&gt;&apos;src/&apos; directory&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;Would you like to use &lt;strong&gt;App Router&lt;/strong&gt;? (recommended)&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; What is your project named? fullstack-app
&amp;gt; Would you like to use TypeScript? No / Yes
&amp;gt; Would you like to use ESLint? No / Yes
&amp;gt; Would you like to use Tailwind CSS? No / Yes
&amp;gt; Would you like to use `src/` directory? No / Yes
&amp;gt; Would you like to use App Router? (recommended) No / Yes
&amp;gt; Would you like to customize the default import alias (@/*)? No / Yes
&amp;gt; What import alias would you like configured? @/*
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Wait until the dependencies installation is completed, then access to the
project directory:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cd fullstack-app
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Open your code editor of your preference.&lt;/p&gt;
&lt;h3&gt;2.1 Install shadcn/ui&lt;/h3&gt;
&lt;p&gt;This components will help us a lot building the &lt;strong&gt;UI&lt;/strong&gt; along with TailwindCSS.&lt;/p&gt;
&lt;p&gt;First, initialize shadcn/ui:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npx shadcn-ui@latest init
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Make sure to config shadcn/ui according your project configuration.&lt;/p&gt;
&lt;p&gt;You can check the &lt;a href=&quot;https://ui.shadcn.com/docs&quot;&gt;shadcn/ui docs&lt;/a&gt; for every
component that you could need, each components is installed individually.&lt;/p&gt;
&lt;h3&gt;2.2 Create a db using Docker&lt;/h3&gt;
&lt;p&gt;Make sure to have &lt;a href=&quot;https://www.docker.com/&quot;&gt;Docker&lt;/a&gt; installed in your machine.&lt;/p&gt;
&lt;p&gt;First you need to pull a PostgreSQL image from Docker Hub:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;docker pull postgres
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, create a container with the image:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;docker run --name my-postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;2.3 Install Prisma&lt;/h3&gt;
&lt;p&gt;Install Prisma using your dependency manager, in this case &lt;strong&gt;npm&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npm install prisma -D
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now initialize Prisma:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npx prisma init
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A new &lt;code&gt;./prisma&lt;/code&gt; direcotry will be created in the root of your project, with a
schema.prisma file.&lt;/p&gt;
&lt;p&gt;You&apos;ll create your schemas in this file.&lt;/p&gt;
&lt;p&gt;Add this model as an example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;model User {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  email     String   @unique
  name      String?
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Update your &lt;code&gt;.env&lt;/code&gt; file with the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;DATABASE_URL=&quot;postgresql://postgres:password@localhost:5432/postgres?schema=public&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the URL is your username (by default is postgres), your password (in this
case password), the host (by default is localhost), the port (by default is
5432), the database name (by default is postgres) and the schema (by default is
public).&lt;/p&gt;
&lt;p&gt;Create your first migration to test if Prisma can connect to your local
database:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npx prisma migrate dev --name init
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If everything is ok, you&apos;ll see a new /migrations directory with a new file
inside.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If you have an error, make sure you can connect to your local DB. Delete, and
create the container again if necessary.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;2.4 Config Auth.js&lt;/h3&gt;
&lt;p&gt;Add this models to your &lt;strong&gt;prisma schema&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;model Account {
  id                String  @id @default(cuid())
  userId            String
  type              String
  provider          String
  providerAccountId String
  refresh_token     String? @db.Text
  access_token      String? @db.Text
  expires_at        Int?
  token_type        String?
  scope             String?
  id_token          String? @db.Text
  session_state     String?

  user User @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@unique([provider, providerAccountId])
}

model Session {
  id           String   @id @default(cuid())
  sessionToken String   @unique
  userId       String
  expires      DateTime
  user         User     @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model User {
  id            String    @id @default(cuid())
  name          String?
  email         String?   @unique
  emailVerified DateTime?
  image         String?
  accounts      Account[]
  sessions      Session[]
}

model VerificationToken {
  identifier String
  token      String   @unique
  expires    DateTime

  @@unique([identifier, token])
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;These models are for &lt;strong&gt;Auth.js&lt;/strong&gt;, now we can install it with the prisma adapter:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npm install @prisma/client @auth/prisma-adapter
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Instal nodemailer too, as we&apos;ll use magic links for authentication:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npm install nodemailer -D
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now create a &lt;code&gt;src/utils/db.ts&lt;/code&gt; and initialize &lt;strong&gt;prisma&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import { PrismaClient } from &apos;@prisma/client&apos;;

const prismaClientSingleton = () =&amp;gt; {
  return new PrismaClient();
};

declare global {
  var prisma: undefined | ReturnType&amp;lt;typeof prismaClientSingleton&amp;gt;;
}

const prisma = globalThis.prisma ?? prismaClientSingleton();

export default prisma;

if (process.env.NODE_ENV !== &apos;production&apos;) globalThis.prisma = prisma;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, create a &lt;code&gt;src/utils/auth.ts&lt;/code&gt; file to config &lt;strong&gt;Auth.js&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import type { NextAuthOptions } from &apos;next-auth&apos;;
import { PrismaAdapter } from &apos;@auth/prisma-adapter&apos;;
import EmailProvider from &apos;next-auth/providers/email&apos;;
import prisma from &apos;@/libs/db&apos;;
import { Adapter } from &apos;next-auth/adapters&apos;;

export const authOptions = {
  adapter: PrismaAdapter(prisma) as Adapter,
  providers: [
    EmailProvider({
      server: {
        host: process.env.EMAIL_SERVER_HOST,
        port: process.env.EMAIL_SERVER_PORT,
        auth: {
          user: process.env.EMAIL_SERVER_USER,
          pass: process.env.EMAIL_SERVER_PASSWORD,
        },
      },
      from: process.env.EMAIL_FROM,
    }),
  ],
  callbacks: {
    session: async ({ session, user }) =&amp;gt; {
      return {
        ...session,
        user: user,
      };
    },
  },
} satisfies NextAuthOptions;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This config is for using an email provider, for this project we&apos;ll use
&lt;a href=&quot;https://resend.com/&quot;&gt;Resend&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Create an account and get the next credentials in your .env file:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;EMAIL_SERVER_HOST: smtp.resend.com&lt;/li&gt;
&lt;li&gt;EMAIL_SERVER_PORT: 465&lt;/li&gt;
&lt;li&gt;EMAIL_SERVER_USER: resend&lt;/li&gt;
&lt;li&gt;EMAIL_FROM: onboarding@resend(dot)dev&lt;/li&gt;
&lt;li&gt;EMAIL_SERVER_PASSWORD: yor api key&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, create a &lt;code&gt;src/app/api/auth/[...nextauth]/route.ts&lt;/code&gt; file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import { authOptions } from &apos;@/libs/auth&apos;;
import NextAuth from &apos;next-auth/next&apos;;

const handler = NextAuth(authOptions);

export { handler as GET, handler as POST };
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This file is for handling the authentication in our app.&lt;/p&gt;
&lt;p&gt;You can now authenticate users with a magic link sent by email.&lt;/p&gt;
&lt;p&gt;Create a &lt;code&gt;src/app/auth/signin-form.tsx&lt;/code&gt; file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&apos;use client&apos;;

import { useState } from &apos;react&apos;;
import { signIn } from &apos;next-auth/react&apos;;

export default function SigninForm() {
  const [email, setEmail] = useState&amp;lt;null | string&amp;gt;(null);

  async function handleSubmit() {
    await signIn(&apos;email&apos;, {
      email,
      callbackUrl: `${window.location.origin}`,
    });
  }

  return (
    &amp;lt;form className=&apos;mt-5 space-y-4&apos; action={handleSubmit}&amp;gt;
      &amp;lt;section className=&apos;flex flex-col gap-2&apos;&amp;gt;
        &amp;lt;label htmlFor=&apos;email&apos;&amp;gt;Email&amp;lt;/label&amp;gt;
        &amp;lt;input
          id=&apos;email&apos;
          type=&apos;email&apos;
          name=&apos;email&apos;
          onChange={(e) =&amp;gt; setEmail(e.target.value)}
          className=&apos;w-max p-1 border border-slate-400&apos;
        /&amp;gt;
      &amp;lt;/section&amp;gt;
      &amp;lt;button type=&apos;submit&apos;&amp;gt;Sign in&amp;lt;/button&amp;gt;
    &amp;lt;/form&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Import it to your &lt;code&gt;src/app/auth/page.tsx&lt;/code&gt; file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import { authOptions } from &apos;@/libs/auth&apos;;
import { getServerSession } from &apos;next-auth&apos;;
import { redirect } from &apos;next/navigation&apos;;
import SigninForm from &apos;./form&apos;;

export default async function Signin() {
  const session = await getServerSession(authOptions);

  if (session) {
    return redirect(&apos;/&apos;);
  }

  return (
    &amp;lt;&amp;gt;
      &amp;lt;h1&amp;gt;Sign in&amp;lt;/h1&amp;gt;

      &amp;lt;SigninForm /&amp;gt;
    &amp;lt;/&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can see, you can redirect users if they&apos;re not authenticated getting the
session with &lt;strong&gt;getServerSession&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;3. Improve your UI&lt;/h2&gt;
&lt;p&gt;Let&apos;s create a short posts like app.&lt;/p&gt;
&lt;p&gt;First, add some shadcn/ui components and update your components, we&apos;ll create
new components too:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npx shadcn-ui@latest add button
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;npx shadcn-ui@latest add dialog
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;npx shadcn-ui@latest add input
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;npx shadcn-ui@latest add textarea
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;npx shadcn-ui@latest add form
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;npx shadcn-ui@latest add label
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;npx shadcn-ui@latest add sonner
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We&apos;ll add the endpoints URL for these components, but we&apos;ll create them later.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;src/app/auth/signin-form.tsx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Here we&apos;ll update the UI and add form validation.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&apos;use client&apos;;

import { signIn } from &apos;next-auth/react&apos;;
import { Button } from &apos;@/components/ui/button&apos;;
import {
  Form,
  FormControl,
  FormField,
  FormItem,
  FormLabel,
  FormMessage,
} from &apos;@/components/ui/form&apos;;
import { Input } from &apos;@/components/ui/input&apos;;
import { Textarea } from &apos;@/components/ui/textarea&apos;;
import { useForm } from &apos;react-hook-form&apos;;
import * as z from &apos;zod&apos;;
import { zodResolver } from &apos;@hookform/resolvers/zod&apos;;

const formSchema = z.object({
  email: z.string().email(),
});

export default function SigninForm() {
  const form = useForm&amp;lt;z.infer&amp;lt;typeof formSchema&amp;gt;&amp;gt;({
    resolver: zodResolver(formSchema),
    defaultValues: {
      email: &apos;&apos;,
    },
  });

  async function onSubmit({ email }: z.infer&amp;lt;typeof formSchema&amp;gt;) {
    await signIn(&apos;email&apos;, {
      email,
      callbackUrl: `${window.location.origin}`,
    });
  }

  return (
    &amp;lt;Form {...form}&amp;gt;
      &amp;lt;form className=&apos;space-y-4&apos; onSubmit={form.handleSubmit(onSubmit)}&amp;gt;
        &amp;lt;FormField
          control={form.control}
          name=&apos;email&apos;
          render={({ field }) =&amp;gt; (
            &amp;lt;FormItem&amp;gt;
              &amp;lt;FormLabel&amp;gt;Email&amp;lt;/FormLabel&amp;gt;
              &amp;lt;FormControl&amp;gt;
                &amp;lt;Input placeholder=&apos;address@example.com&apos; {...field} /&amp;gt;
              &amp;lt;/FormControl&amp;gt;
              &amp;lt;FormMessage /&amp;gt;
            &amp;lt;/FormItem&amp;gt;
          )}
        /&amp;gt;
        &amp;lt;Button className=&apos;w-full&apos; type=&apos;submit&apos;&amp;gt;
          Send magic link
        &amp;lt;/Button&amp;gt;
      &amp;lt;/form&amp;gt;
    &amp;lt;/Form&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/components/post/create.tsx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Update UI components and form validation.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&apos;use client&apos;;

import { useState } from &apos;react&apos;;
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from &apos;@/components/ui/dialog&apos;;
import { Button } from &apos;@/components/ui/button&apos;;
import {
  Form,
  FormControl,
  FormField,
  FormItem,
  FormLabel,
  FormMessage,
} from &apos;@/components/ui/form&apos;;
import { Input } from &apos;@/components/ui/input&apos;;
import { Textarea } from &apos;@/components/ui/textarea&apos;;
import { useForm } from &apos;react-hook-form&apos;;
import * as z from &apos;zod&apos;;
import { zodResolver } from &apos;@hookform/resolvers/zod&apos;;
import { useRouter } from &apos;next/navigation&apos;;
import { toast } from &apos;sonner&apos;;
import { SessionProps } from &apos;./types&apos;;

const formSchema = z.object({
  title: z.string().min(1).max(100),
  content: z.string().min(1),
});

export default function CreatePost(props: SessionProps) {
  const [open, setOpen] = useState(false);
  const router = useRouter();
  const form = useForm&amp;lt;z.infer&amp;lt;typeof formSchema&amp;gt;&amp;gt;({
    resolver: zodResolver(formSchema),
    defaultValues: {
      title: &apos;&apos;,
      content: &apos;&apos;,
    },
  });

  async function onSubmit(values: z.infer&amp;lt;typeof formSchema&amp;gt;) {
    try {
      const res = await fetch(&apos;/api/posts&apos;, {
        method: &apos;POST&apos;,
        headers: { &apos;Content-Type&apos;: &apos;application/json&apos; },
        body: JSON.stringify({
          ...values,
          authorId: props.session.user?.id,
        }),
      });
      const json = await res.json();

      if (!res.ok) {
        toast(json.message);

        return;
      }

      toast(&apos;Post created!&apos;);
      form.reset();
      setOpen(false);
      router.refresh();
    } catch (error) {
      console.error(error);
    }
  }

  return (
    &amp;lt;Dialog open={open} onOpenChange={setOpen}&amp;gt;
      &amp;lt;DialogTrigger asChild&amp;gt;
        &amp;lt;Button&amp;gt;Create post&amp;lt;/Button&amp;gt;
      &amp;lt;/DialogTrigger&amp;gt;
      &amp;lt;DialogContent className=&apos;max-w-[300px]&apos;&amp;gt;
        &amp;lt;DialogHeader className=&apos;text-left&apos;&amp;gt;
          &amp;lt;DialogTitle&amp;gt;Create post&amp;lt;/DialogTitle&amp;gt;
          &amp;lt;DialogDescription&amp;gt;
            Please &amp;lt;strong&amp;gt;do not&amp;lt;/strong&amp;gt; post &amp;lt;strong&amp;gt;NSFW&amp;lt;/strong&amp;gt; content.
          &amp;lt;/DialogDescription&amp;gt;
        &amp;lt;/DialogHeader&amp;gt;
        &amp;lt;Form {...form}&amp;gt;
          &amp;lt;form className=&apos;space-y-4&apos; onSubmit={form.handleSubmit(onSubmit)}&amp;gt;
            &amp;lt;FormField
              control={form.control}
              name=&apos;title&apos;
              render={({ field }) =&amp;gt; (
                &amp;lt;FormItem&amp;gt;
                  &amp;lt;FormLabel&amp;gt;Title&amp;lt;/FormLabel&amp;gt;
                  &amp;lt;FormControl&amp;gt;
                    &amp;lt;Input placeholder=&apos;Hi there!&apos; {...field} /&amp;gt;
                  &amp;lt;/FormControl&amp;gt;
                  &amp;lt;FormMessage /&amp;gt;
                &amp;lt;/FormItem&amp;gt;
              )}
            /&amp;gt;
            &amp;lt;FormField
              control={form.control}
              name=&apos;content&apos;
              render={({ field }) =&amp;gt; (
                &amp;lt;FormItem&amp;gt;
                  &amp;lt;FormLabel&amp;gt;Content&amp;lt;/FormLabel&amp;gt;
                  &amp;lt;FormControl&amp;gt;
                    &amp;lt;Textarea
                      placeholder=&apos;Testing this great app!&apos;
                      {...field}
                    /&amp;gt;
                  &amp;lt;/FormControl&amp;gt;
                  &amp;lt;FormMessage /&amp;gt;
                &amp;lt;/FormItem&amp;gt;
              )}
            /&amp;gt;
            &amp;lt;Button className=&apos;w-full&apos; type=&apos;submit&apos;&amp;gt;
              Post
            &amp;lt;/Button&amp;gt;
          &amp;lt;/form&amp;gt;
        &amp;lt;/Form&amp;gt;
      &amp;lt;/DialogContent&amp;gt;
    &amp;lt;/Dialog&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/app/page.tsx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Fetch data from Prisma, as this page is a server component, we can fetch it
directly.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import { authOptions } from &apos;@/libs/auth&apos;;
import { getServerSession } from &apos;next-auth&apos;;
import prisma from &apos;@/libs/db&apos;;
import CreatePost from &apos;@/components/post/create&apos;;
import Post from &apos;@/components/post&apos;;

export default async function Home() {
  const session = await getServerSession(authOptions);

  // You can fetch data to Prisma in server components
  const posts = await prisma.post.findMany({
    include: {
      author: true,
    },
  });

  return (
    &amp;lt;&amp;gt;
      &amp;lt;h1 className=&apos;mb-5 font-bold text-xl&apos;&amp;gt;Home&amp;lt;/h1&amp;gt;
      {session ? (
        &amp;lt;&amp;gt;
          &amp;lt;CreatePost session={session} /&amp;gt;
        &amp;lt;/&amp;gt;
      ) : (
        &amp;lt;&amp;gt;
          &amp;lt;p&amp;gt;You are not logged in&amp;lt;/p&amp;gt;
        &amp;lt;/&amp;gt;
      )}
      &amp;lt;h3 className=&apos;text-lg font-semibold mt-10&apos;&amp;gt;Posts&amp;lt;/h3&amp;gt;
      &amp;lt;ul className=&apos;mt-5 space-y-2.5&apos;&amp;gt;
        {posts.length &amp;gt; 0 ? (
          posts.map((post) =&amp;gt; (
            &amp;lt;li key={post.id}&amp;gt;
              &amp;lt;Post {...post} session={session} /&amp;gt;
            &amp;lt;/li&amp;gt;
          ))
        ) : (
          &amp;lt;p&amp;gt;No posts&amp;lt;/p&amp;gt;
        )}
      &amp;lt;/ul&amp;gt;
    &amp;lt;/&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/components/post/item.tsx&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&apos;use client&apos;;

import DeletePost from &apos;./delete&apos;;
import EditPost from &apos;./edit&apos;;
import { TPostProps } from &apos;./types&apos;;

export default function PostItem(props: TPostProps) {
  return (
    &amp;lt;article className=&apos;w-max p-2 border border-slate-500 rounded-md&apos;&amp;gt;
      &amp;lt;header className=&apos;flex justify-between items-center&apos;&amp;gt;
        &amp;lt;h2 className=&apos;font-bold text-lg&apos;&amp;gt;{props.title}&amp;lt;/h2&amp;gt;
        {props.session?.user?.id === props.authorId &amp;amp;&amp;amp; (
          &amp;lt;section className=&apos;space-x-2&apos;&amp;gt;
            &amp;lt;EditPost {...props} /&amp;gt;
            &amp;lt;DeletePost {...props} /&amp;gt;
          &amp;lt;/section&amp;gt;
        )}
      &amp;lt;/header&amp;gt;
      &amp;lt;p&amp;gt;{props.content}&amp;lt;/p&amp;gt;
      &amp;lt;span className=&apos;text-sm&apos;&amp;gt;
        Posted by {props.author?.email || &apos;anon&apos;} at{&apos; &apos;}
        {new Date(props.createdAt).toLocaleString()}
      &amp;lt;/span&amp;gt;
    &amp;lt;/article&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/components/post/edit.tsx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a button icon for opening a dialog rendering the post data for editing,
add validation and fetch to the API endpoint.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&apos;use client&apos;;

import { useState } from &apos;react&apos;;
import { Edit } from &apos;lucide-react&apos;;
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from &apos;@/components/ui/dialog&apos;;
import {
  Form,
  FormControl,
  FormField,
  FormItem,
  FormLabel,
  FormMessage,
} from &apos;@/components/ui/form&apos;;
import { Input } from &apos;@/components/ui/input&apos;;
import { Textarea } from &apos;@/components/ui/textarea&apos;;
import { useForm } from &apos;react-hook-form&apos;;
import * as z from &apos;zod&apos;;
import { zodResolver } from &apos;@hookform/resolvers/zod&apos;;
import { useRouter } from &apos;next/navigation&apos;;
import { toast } from &apos;sonner&apos;;
import { Button } from &apos;@/components/ui/button&apos;;
import { TPostProps } from &apos;./types&apos;;

const formSchema = z.object({
  title: z.string().min(1).max(100),
  content: z.string().min(1),
});

export default function EditPost(props: TPostProps) {
  const [open, setOpen] = useState(false);
  const router = useRouter();
  const form = useForm&amp;lt;z.infer&amp;lt;typeof formSchema&amp;gt;&amp;gt;({
    resolver: zodResolver(formSchema),
    defaultValues: {
      title: props.title,
      content: props.content,
    },
  });

  async function onSubmit(values: z.infer&amp;lt;typeof formSchema&amp;gt;) {
    try {
      const res = await fetch(&apos;/api/posts&apos;, {
        method: &apos;PUT&apos;,
        headers: { &apos;Content-Type&apos;: &apos;application/json&apos; },
        body: JSON.stringify({
          ...values,
          id: props.id,
        }),
      });
      const json = await res.json();

      if (!res.ok) {
        toast(json.message);

        return;
      }

      toast(&apos;Post edited!&apos;);
      form.reset();
      setOpen(false);
      router.refresh();
    } catch (error) {
      console.error(error);
    }
  }

  return (
    &amp;lt;Dialog open={open} onOpenChange={setOpen}&amp;gt;
      &amp;lt;DialogTrigger asChild&amp;gt;
        &amp;lt;Button variant=&apos;secondary&apos; size=&apos;icon&apos;&amp;gt;
          &amp;lt;Edit /&amp;gt;
        &amp;lt;/Button&amp;gt;
      &amp;lt;/DialogTrigger&amp;gt;
      &amp;lt;DialogContent className=&apos;max-w-[300px]&apos;&amp;gt;
        &amp;lt;DialogHeader className=&apos;text-left&apos;&amp;gt;
          &amp;lt;DialogTitle&amp;gt;Edit post&amp;lt;/DialogTitle&amp;gt;
          &amp;lt;DialogDescription&amp;gt;
            Please &amp;lt;strong&amp;gt;do not&amp;lt;/strong&amp;gt; post &amp;lt;strong&amp;gt;NSFW&amp;lt;/strong&amp;gt; content.
          &amp;lt;/DialogDescription&amp;gt;
        &amp;lt;/DialogHeader&amp;gt;
        &amp;lt;Form {...form}&amp;gt;
          &amp;lt;form className=&apos;space-y-4&apos; onSubmit={form.handleSubmit(onSubmit)}&amp;gt;
            &amp;lt;FormField
              control={form.control}
              name=&apos;title&apos;
              render={({ field }) =&amp;gt; (
                &amp;lt;FormItem&amp;gt;
                  &amp;lt;FormLabel&amp;gt;Title&amp;lt;/FormLabel&amp;gt;
                  &amp;lt;FormControl&amp;gt;
                    &amp;lt;Input placeholder=&apos;Hi there!&apos; {...field} /&amp;gt;
                  &amp;lt;/FormControl&amp;gt;
                  &amp;lt;FormMessage /&amp;gt;
                &amp;lt;/FormItem&amp;gt;
              )}
            /&amp;gt;
            &amp;lt;FormField
              control={form.control}
              name=&apos;content&apos;
              render={({ field }) =&amp;gt; (
                &amp;lt;FormItem&amp;gt;
                  &amp;lt;FormLabel&amp;gt;Content&amp;lt;/FormLabel&amp;gt;
                  &amp;lt;FormControl&amp;gt;
                    &amp;lt;Textarea
                      placeholder=&apos;Testing this great app!&apos;
                      {...field}
                    /&amp;gt;
                  &amp;lt;/FormControl&amp;gt;
                  &amp;lt;FormMessage /&amp;gt;
                &amp;lt;/FormItem&amp;gt;
              )}
            /&amp;gt;
            &amp;lt;DialogClose asChild&amp;gt;
              &amp;lt;Button className=&apos;w-full&apos; type=&apos;submit&apos;&amp;gt;
                Edit post
              &amp;lt;/Button&amp;gt;
            &amp;lt;/DialogClose&amp;gt;
          &amp;lt;/form&amp;gt;
        &amp;lt;/Form&amp;gt;
      &amp;lt;/DialogContent&amp;gt;
    &amp;lt;/Dialog&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/components/post/delete.tsx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Create a button icon for opening a dialog for deleting the post, add validation
and fetch to the API endpoint.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&apos;use client&apos;;

import { LucideTrash2 } from &apos;lucide-react&apos;;
import { Button } from &apos;@/components/ui/button&apos;;
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from &apos;@/components/ui/dialog&apos;;
import { useRouter } from &apos;next/navigation&apos;;
import { toast } from &apos;sonner&apos;;
import { TPostProps } from &apos;./types&apos;;

export default function DeletePost(props: TPostProps) {
  const router = useRouter();

  async function handleDelete() {
    try {
      const res = await fetch(&apos;/api/posts&apos;, {
        method: &apos;DELETE&apos;,
        headers: { &apos;Content-Type&apos;: &apos;application/json&apos; },
        body: JSON.stringify({
          id: props.id,
        }),
      });
      const json = await res.json();

      if (!res.ok) {
        toast(json.message);

        return;
      }

      toast(&apos;Post deleted!&apos;);
      router.refresh();
    } catch (error) {
      console.error(error);
    }
  }
  return (
    &amp;lt;Dialog&amp;gt;
      &amp;lt;DialogTrigger asChild&amp;gt;
        &amp;lt;Button variant=&apos;destructive&apos; size=&apos;icon&apos;&amp;gt;
          &amp;lt;LucideTrash2 /&amp;gt;
        &amp;lt;/Button&amp;gt;
      &amp;lt;/DialogTrigger&amp;gt;
      &amp;lt;DialogContent className=&apos;max-w-[300px]&apos;&amp;gt;
        &amp;lt;DialogHeader className=&apos;text-left&apos;&amp;gt;
          &amp;lt;DialogTitle&amp;gt;Delete post&amp;lt;/DialogTitle&amp;gt;
          &amp;lt;DialogDescription&amp;gt;
            Are you sure you want to &amp;lt;strong&amp;gt;delete&amp;lt;/strong&amp;gt; this post? This
            action cannot be undone.
          &amp;lt;/DialogDescription&amp;gt;
        &amp;lt;/DialogHeader&amp;gt;
        &amp;lt;footer className=&apos;flex flex-col gap-2&apos;&amp;gt;
          &amp;lt;DialogClose asChild&amp;gt;
            &amp;lt;Button variant=&apos;secondary&apos; className=&apos;w-full&apos;&amp;gt;
              No, keep post
            &amp;lt;/Button&amp;gt;
          &amp;lt;/DialogClose&amp;gt;
          &amp;lt;DialogClose asChild&amp;gt;
            &amp;lt;Button
              onClick={handleDelete}
              variant=&apos;destructive&apos;
              className=&apos;w-full&apos;
            &amp;gt;
              Yes, delete post
            &amp;lt;/Button&amp;gt;
          &amp;lt;/DialogClose&amp;gt;
        &amp;lt;/footer&amp;gt;
      &amp;lt;/DialogContent&amp;gt;
    &amp;lt;/Dialog&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/components/post/types.ts&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;type SessionProps = {
  session: any;
};

type TPostProps = {
  author: {
    id: string;
    name: string | null;
    email: string | null;
    emailVerified: Date | null;
    image: string | null;
  } | null;
  id: string;
  createdAt: Date;
  updatedAt: Date;
  title: string;
  content: string;
  authorId: string | null;
  session: any;
};

export type { SessionProps, TPostProps };
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/components/sign-out.tsx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;A simple sign out button.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&apos;use client&apos;;

import { signOut } from &apos;next-auth/react&apos;;
import { Button } from &apos;./ui/button&apos;;

export default function SignOut() {
  return &amp;lt;Button onClick={() =&amp;gt; signOut()}&amp;gt;Sign out&amp;lt;/Button&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/components/navbar.tsx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Render the sign out or sign in button depending if the user is logged in or not.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import Link from &apos;next/link&apos;;
import { Button } from &apos;./ui/button&apos;;
import { getServerSession } from &apos;next-auth&apos;;
import { authOptions } from &apos;@/libs/auth&apos;;
import SignOut from &apos;./sign-out&apos;;

export default async function Navbar() {
  const session = await getServerSession(authOptions);

  return (
    &amp;lt;nav className=&apos;w-full p-4 border-b flex justify-between items-center&apos;&amp;gt;
      &amp;lt;section&amp;gt;
        &amp;lt;Button variant=&apos;link&apos; className=&apos;px-0 font-semibold text-lg&apos;&amp;gt;
          &amp;lt;Link href=&apos;/&apos;&amp;gt;Fullstack app&amp;lt;/Link&amp;gt;
        &amp;lt;/Button&amp;gt;
      &amp;lt;/section&amp;gt;
      &amp;lt;section&amp;gt;
        {session ? (
          &amp;lt;SignOut /&amp;gt;
        ) : (
          &amp;lt;Button asChild&amp;gt;
            &amp;lt;Link href=&apos;/auth&apos;&amp;gt;Sign in&amp;lt;/Link&amp;gt;
          &amp;lt;/Button&amp;gt;
        )}
      &amp;lt;/section&amp;gt;
    &amp;lt;/nav&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;src/app/layout.tsx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Add your &lt;strong&gt;Navbar&lt;/strong&gt; and &lt;strong&gt;Toaster&lt;/strong&gt; components and some styles.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import { Inter } from &apos;next/font/google&apos;;
import Navbar from &apos;@/components/navbar&apos;;
import { Toaster } from &apos;@/components/ui/sonner&apos;;
import &apos;./globals.css&apos;;

const inter = Inter({ subsets: [&apos;latin&apos;] });

interface Props extends React.PropsWithChildren {}

export default function RootLayout(props: Props) {
  return (
    &amp;lt;html lang=&apos;en&apos;&amp;gt;
      &amp;lt;body className={inter.className}&amp;gt;
        &amp;lt;Navbar /&amp;gt;
        &amp;lt;main className=&apos;px-4 py-8&apos;&amp;gt;{props.children}&amp;lt;/main&amp;gt;
        &amp;lt;Toaster /&amp;gt;
      &amp;lt;/body&amp;gt;
    &amp;lt;/html&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;4. Add CRUD functionality&lt;/h2&gt;
&lt;p&gt;Now we can add Create, Read, Update and Delete functionality to our app.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;prisma/schema.prisma&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Update your Prisma schema adding to User model a relationship with Post model:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;generator client {
  provider = &quot;prisma-client-js&quot;
}

datasource db {
  provider = &quot;postgresql&quot;
  url      = env(&quot;DATABASE_URL&quot;)
}

model Account {
  id                String  @id @default(cuid())
  userId            String
  type              String
  provider          String
  providerAccountId String
  refresh_token     String? @db.Text
  access_token      String? @db.Text
  expires_at        Int?
  token_type        String?
  scope             String?
  id_token          String? @db.Text
  session_state     String?

  user User @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@unique([provider, providerAccountId])
}

model Session {
  id           String   @id @default(cuid())
  sessionToken String   @unique
  userId       String
  expires      DateTime
  user         User     @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model User {
  id            String    @id @default(cuid())
  name          String?
  email         String?   @unique
  emailVerified DateTime?
  image         String?
  accounts      Account[]
  sessions      Session[]
  posts         Post[]
}

model VerificationToken {
  identifier String
  token      String   @unique
  expires    DateTime

  @@unique([identifier, token])
}

model Post {
  id        String   @id @default(cuid())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  title     String
  content   String
  author    User     @relation(fields: [authorId], references: [id])
  authorId  String
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Generate a new Prisma migration:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;npx prisma migrate dev --name add-posts
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, create a &lt;code&gt;src/app/api/posts/route.ts&lt;/code&gt; file with a &lt;strong&gt;POST&lt;/strong&gt;, &lt;strong&gt;PUT&lt;/strong&gt; and
&lt;strong&gt;DELETE&lt;/strong&gt; async functions:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import prisma from &apos;@/libs/db&apos;;
import { NextRequest, NextResponse } from &apos;next/server&apos;;

export async function POST(req: Request) {
  try {
    if (!req.body) {
      return NextResponse.json({
        ok: false,
        status: 400,
        message: &apos;Data required&apos;,
      });
    }

    const json = await req.json();
    const res = await prisma.post.create({
      data: json,
    });

    return NextResponse.json({
      ok: true,
      status: 201,
      data: res,
    });
  } catch (error) {
    if (error instanceof Error) {
      return NextResponse.json({
        ok: false,
        status: 500,
        message: error.message,
      });
    }

    return NextResponse.json({
      ok: false,
      status: 500,
      message: &apos;Internal server error&apos;,
    });
  }
}

export async function PUT(req: NextRequest) {
  try {
    const body = await req.json();
    const res = await prisma.post.update({
      where: { id: body.id },
      data: {
        title: body.title,
        content: body.content,
      },
    });

    return NextResponse.json({
      ok: true,
      status: 200,
      data: res,
    });
  } catch (error) {
    if (error instanceof Error) {
      return NextResponse.json({
        ok: false,
        status: 500,
        message: error.message,
      });
    }

    return NextResponse.json({
      ok: false,
      status: 500,
      message: &apos;Internal server error&apos;,
    });
  }
}

export async function DELETE(req: NextRequest) {
  try {
    const body = await req.json();
    const res = await prisma.post.delete({
      where: { id: body.id },
    });

    return NextResponse.json({
      ok: true,
      status: 200,
      data: res,
    });
  } catch (error) {
    if (error instanceof Error) {
      return NextResponse.json({
        ok: false,
        status: 500,
        message: error.message,
      });
    }

    return NextResponse.json({
      ok: false,
      status: 500,
      message: &apos;Internal server error&apos;,
    });
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Try creating a post in the home.&lt;/p&gt;
&lt;p&gt;The page will refresh and you&apos;ll see the post, as you created it, only you can
edit or delete it.&lt;/p&gt;
&lt;h2&gt;5. Conclusion&lt;/h2&gt;
&lt;p&gt;As you can see, create a fullstack app with Next.js and Prisma is really easy.&lt;/p&gt;
&lt;p&gt;Of course, it could be improved, adding server side validation for inputs,
adding pagination for posts in the home, etc.&lt;/p&gt;
</content:encoded><author>Juan Manzanero</author></item><item><title>How Computers Works</title><link>https://juanmanzanero.com/blog/en/how-computers-works</link><guid isPermaLink="true">https://juanmanzanero.com/blog/en/how-computers-works</guid><description>Today we use, in some way, the computer in almost every activity in our lives, it could be for work or just fun, but if we think carefully, computers are an invention from the previous century, and have changed our lives.</description><pubDate>Mon, 29 May 2023 06:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Today we use, in some way, the computer in almost every activity in our lives, it could be for work or just fun, but if we think carefully, computers are an invention from the previous century, and have changed our lives.&lt;/p&gt;
&lt;p&gt;New works have appeared, new careers to study, and new problems to be solved.&lt;/p&gt;
&lt;p&gt;However, do we know how computers penetrated our lives? Do we know how a
computer works? How does the Internet work?&lt;/p&gt;
&lt;p&gt;Many people use their smartphones to communicate with family and friends and to
share their lives, but they don’t know how all this is possible.&lt;/p&gt;
&lt;p&gt;I’m not saying that everyone needs to be a Software Engineer or IT Expert, but
knowing about this could be outstanding knowledge.&lt;/p&gt;
&lt;h2&gt;The power of computers&lt;/h2&gt;
&lt;p&gt;Computers can expand our brains, such things like sends messages to people from
the other side of the Earth, to create an app that speeds up delivery.&lt;/p&gt;
&lt;p&gt;All these things are possible by flipping 0’s and 1’s, but how is this possible?&lt;/p&gt;
&lt;p&gt;If you&apos;ve watched The Imitation Code, maybe you know this story.&lt;/p&gt;
&lt;h3&gt;Computing Fundaments&lt;/h3&gt;
&lt;p&gt;Alan Turing was the inventor of the Turing Machine, a simple but powerful
machine that can receive instructions to move along a long tape, changing the
state of each slot. This three things, a head, a long tape and a set of
instructions are the bases for the modern computers.&lt;/p&gt;
&lt;p&gt;The head is the Central Processing Unit (CPU), a piece of hardware that can be
used for general purposes, receiving instructions (Algorithm) whose are
transformed to electric pulses, understanding if electricity pass trough or not,
if it&apos;s true or false, 1 or 0. All these instructions are saved in a Random
Access Memory (RAM) for a quick access of the work that needs to be
accomplished, and using a Read-Only Memory (ROM) to store persistent data that
needs to be saved even if the computer shuts down.&lt;/p&gt;
&lt;p&gt;An algorithm&apos;s like a recipe, declaring ingredients (variables) and the steps to
follow to achieve the result (functions).&lt;/p&gt;
&lt;p&gt;A variable is an identifier that points to a slot of memory in the RAM, storing
a value that can be a number, a text (known as “string”), a boolean (true or
false), or an object (a set of multiple variables and functions that can be
instanced), etc.&lt;/p&gt;
&lt;p&gt;Functions are blocks of instructions that achieve a task, like obtaining your
current location or sending a message.&lt;/p&gt;
&lt;p&gt;And maybe you are asking, how do I tell a computer how to do what I want?&lt;/p&gt;
&lt;h3&gt;Programming languages&lt;/h3&gt;
&lt;p&gt;If you try to speak with someone who doesn’t speak the same language as you, you
try to use a translator or use gestures, something that you know that both can
in some way understand, the same is for computers.&lt;/p&gt;
&lt;p&gt;Computers are powerful, but they need someone to tell them what to do, this is
work for humans, and to achieve it we use programming languages. With a
programming language you use a specific syntax to tell a computer your desired
task, then you compile that file where you type all your instructions, when a
file compiles, is transformed to a computer nature language (1’s and 0’s) and
then the computer executes the task.&lt;/p&gt;
&lt;p&gt;There are different programming languages, and all of them are designed to
achieve specific needs, like the programming languages C and C++, both are
low-level languages, which means that are close to how a computer “speaks” and
are used to control and administrate memory in high-efficient apps, or to
illuminate the screen of your computer.&lt;/p&gt;
&lt;p&gt;There is Java, is a language that can create an environment when is compiled,
meaning that can be used on almost every computer.&lt;/p&gt;
&lt;p&gt;JavaScript (is NOT Java or something like that) is a language that our browsers
understands, with the help of JavaScript, we can access to a web page and see
nice interactions when we click a button, login with a username and password,
and more.&lt;/p&gt;
&lt;p&gt;JavaScript is a high-level language, that is easiest to learn than Java or C,
but not that is worse or better, just resolves a different need.&lt;/p&gt;
&lt;h3&gt;The Browser&lt;/h3&gt;
&lt;p&gt;A powerful software that can access other computers using the Hyper Text
Transfer Protocol (HTTP), it means that thanks to this protocol different
computers can send and receive information to communicate, even if they’re far
away. The browsers receive data in the form of a file, mainly three:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hyper Text Markup Language (HTML)&lt;/li&gt;
&lt;li&gt;Cascading Styles Sheet (CSS)&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;HTML&lt;/h3&gt;
&lt;p&gt;Helps the browser to structure data like texts or images, using a markup
language (tags). The browser can know where to put an input to type your email
or a button to subscribe to your favorite artist.&lt;/p&gt;
&lt;h3&gt;CSS&lt;/h3&gt;
&lt;p&gt;It gives colors and forms to the HTML tags using selectors. It can be used to
change page&apos;s background color, change button&apos;s rounded borders, modify text
color, and everything your creativity can give.&lt;/p&gt;
&lt;h3&gt;JavaScript&lt;/h3&gt;
&lt;p&gt;Combining HTML and CSS with JavaScript creates an interactive web site, or web
app (like this one). You can for example, add a button that changes the theme to
dark/light, or store items in a shopping cart and show a number of items you
have.&lt;/p&gt;
&lt;p&gt;For all this you need to store your files somewhere, letting people access a
computer to download all these files using their browsers, that&apos;s the
functionality of servers.&lt;/p&gt;
&lt;p&gt;Servers are computers that are connected to the Internet, and store files that
can be downloaded or uploaded using protocols and security rules. Some companies
like Google or Microsoft have multiple centers with many servers in different
regions of the planet, called Data Centers, and can be used with a fee for
storing your web app, these multiple Data Centers are called Cloud.&lt;/p&gt;
&lt;h3&gt;The Cloud&lt;/h3&gt;
&lt;p&gt;Administrating a powerful computer can be difficult, but if you know how to use
it, you can save a lot of money instead of maintaining local computers that need
to be turned on 24/7. Thanks to the cloud we can deliver the fastest apps, and
we can have a 24/7 service for our customers with a marginal cost.&lt;/p&gt;
&lt;h2&gt;Computers Changed Humanity&lt;/h2&gt;
&lt;p&gt;Computers simplifies our daily tasks, software can be easy replicated and
distributed without need of logistics like a tangible product. You just need an
Internet connection to reach someone’s project.&lt;/p&gt;
&lt;p&gt;You don’t need a factory or natural resources like wood to produce paper, you
need a group of engineers, UX/UI designers, digital marketers, and more IT
people to reach billions of customers.&lt;/p&gt;
&lt;p&gt;The reason that computers are too powerful is that the marginal cost is minimal,
you don’t need to extract something from the earth to build an app, you need a
group of talented persons that uses their brains to create solutions.&lt;/p&gt;
</content:encoded><author>Juan Manzanero</author></item><item><title>I participated in a Hackathon</title><link>https://juanmanzanero.com/blog/en/i-participated-in-a-hackathon</link><guid isPermaLink="true">https://juanmanzanero.com/blog/en/i-participated-in-a-hackathon</guid><description>I recently participated in a Supabase Hackathon, forming a team with people from other countries.</description><pubDate>Wed, 16 Aug 2023 06:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I recently participated in a Supabase Hackathon, forming a team with people from other countries.&lt;/p&gt;
&lt;p&gt;The Hackathon thematic was free, the only main rule is to use Supabase for any
feature, like authentication, as a PostgreSQL database or using vectors for AI,
with 10 days to build a product using any technology and upload it in a GitHub
repository.&lt;/p&gt;
&lt;p&gt;We developed an e-commerce app with a Walmart products model, implementing
vectors for better search results.&lt;/p&gt;
&lt;p&gt;Using Supabase we implemented auth and protected routes so the user needs to log
in to see recommendations and more.&lt;/p&gt;
&lt;p&gt;The user can add products to the shopping cart and check their items for saved
it and see recommendations and which items are frequently bought.&lt;/p&gt;
&lt;p&gt;My main role was focused on creating the UI using the Next.js 13 app router,
protecting routes only for authenticated users, and create reusable components
such as product cards, and of course, making the layout responsive for mobile
and desktop.&lt;/p&gt;
&lt;p&gt;We used &lt;a href=&quot;https://ui.shadcn.com/&quot;&gt;Shadcn/UI&lt;/a&gt; as those components are already
implemented functionalities with accessibility like modals or sidebars, like the
sidebar that appears when you’re on a mobile device and open the button in the
header, with a smooth animation.&lt;/p&gt;
&lt;p&gt;We submitted the project on time and waiting for the results, and this is my
first time participating in a Hackathon, I really enjoy it and hope to continue
contributing to the project on GitHub.&lt;/p&gt;
&lt;p&gt;It&apos;s amazing work with people from other countries, using English even if is not
our native language, but with a purpose in common, create a great product.&lt;/p&gt;
&lt;p&gt;I’ll keep looking to participate in more Hackathons in the future and contribute
to open source projects on Github because I really enjoy the feeling of
developing something big with more people.&lt;/p&gt;
&lt;p&gt;I learned too much in these few days, like integrating Next.js with Supabase for
authentication and protected routes, using the Supabase docs as a guide, and
using it for the first time Shadcn/UI, and looking forward to keep using it.&lt;/p&gt;
&lt;p&gt;It took me so long to participate in a Hackathon, as before I hesitated about my
experience, but the reality is we’ll never be ready for new challenges because
if you’re already ready it means that’s too late.&lt;/p&gt;
&lt;p&gt;I want to learn more about using vectors for AI, so I’ll investigate more about
the topic, as the tech tends to go that way, who knows what would be the next
big tech trend or when.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://groce-wise.vercel.app/&quot;&gt;You can see the project: Grocewise here&lt;/a&gt;&lt;/p&gt;
</content:encoded><author>Juan Manzanero</author></item><item><title>Next Intl Blog Template</title><link>https://juanmanzanero.com/blog/en/next-intl-blog-template</link><guid isPermaLink="true">https://juanmanzanero.com/blog/en/next-intl-blog-template</guid><description>Start your blog in multiple languages!</description><pubDate>Mon, 18 Dec 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://github.com/juanmanzanero-com/next-intl-blog-template&quot;&gt;GitHub&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://next-intl-blog-template.vercel.app/en&quot;&gt;Website&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Overview&lt;/h2&gt;
&lt;p&gt;Recently I update this website, and as you may know, is an &lt;strong&gt;English and Spanish
content website&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I&apos;m not using a translation plugin, instead I write every work in both English
and Spanish.&lt;/p&gt;
&lt;p&gt;Thanks to Next.js and &lt;a href=&quot;https://next-intl-docs.vercel.app/&quot;&gt;next-intl&lt;/a&gt; I can
achieve this, rendering routes for each language in the website, accessing a
dictionary that contains the content translated by me.&lt;/p&gt;
&lt;p&gt;For the .mdx files, I created a directory for each language, and inside of those
directories it contains the content in both languages too.&lt;/p&gt;
&lt;h2&gt;How to use&lt;/h2&gt;
&lt;p&gt;This template is an extension of
&lt;a href=&quot;https://next-intl-docs.vercel.app/&quot;&gt;next-intl&lt;/a&gt;, chek the
&lt;a href=&quot;https://next-intl-docs.vercel.app/docs/getting-started&quot;&gt;getting started&lt;/a&gt; to
learn the basics, the purpouse of the template is to create a simple layout for
future customization.&lt;/p&gt;
&lt;h3&gt;Add or remove locales&lt;/h3&gt;
&lt;p&gt;You can add or remove locales in the &lt;code&gt;src/lang/locales.ts&lt;/code&gt; file.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;export type locales = &apos;en&apos; | &apos;es&apos;;

export const localesList: locales[] = [&apos;en&apos;, &apos;es&apos;];
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Just add or remove a locale from the &lt;code&gt;locales&lt;/code&gt; const, and add or remove it from
the list.&lt;/p&gt;
&lt;p&gt;The first item in the &lt;code&gt;localesList&lt;/code&gt; must be the default locale.&lt;/p&gt;
&lt;p&gt;The list is used for static generation of the routes in
&lt;code&gt;src/app/[locale]/layout.tsx&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import { localesList } from &apos;@/lang/locales&apos;;

export function generateStaticParams() {
  return localesList.map((locale) =&amp;gt; ({ locale }));
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Remember to update the matcher in &lt;code&gt;src/middleware.ts&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//...

export const config = {
  matcher: [&apos;/&apos;, &apos;/(en|es)/:path*&apos;],
};
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And of course, update your &lt;code&gt;src/lang/[locale].json&lt;/code&gt; files.&lt;/p&gt;
&lt;h3&gt;Content creation&lt;/h3&gt;
&lt;p&gt;Use &lt;code&gt;src/content/[locale]&lt;/code&gt; for create content, in the &lt;code&gt;/[locale]/&lt;/code&gt; directory
ceate the directory for each purpouse, for example: &lt;code&gt;/[locale]/blog&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Inside create the .mdx file with an unique name, the name will be used as the
slug for create the static page for that post.&lt;/p&gt;
&lt;p&gt;For create a blog section, you&apos;ll use the &lt;em&gt;getAllContent&lt;/em&gt; function in your
route, for example: &lt;code&gt;src/app/[locale]/blog/[slug]/page.tsx&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import { Mdx } from &apos;@/components&apos;;
import { TParamsLocale, TPage, TSlugLang } from &apos;@/types&apos;;
import { Metadata } from &apos;next&apos;;
import { getAllContent, getContent } from &apos;@/utils/getContent&apos;;

export async function generateStaticParams(
  props: TParamsLocale,
): Promise&amp;lt;TSlugLang[]&amp;gt; {
  const blogs = await getAllContent(props.params.locale, &apos;blog&apos;);

  if (!blogs) return [];

  return blogs.map((blog) =&amp;gt; ({
    slug: blog.slug,
    locale: props.params.locale,
  }));
}

//...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will create each static page for each blog post.&lt;/p&gt;
&lt;p&gt;You can get the metadata of the &lt;code&gt;.mdx&lt;/code&gt; file too.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//...

export async function generateMetadata(props: TPage): Promise&amp;lt;Metadata&amp;gt; {
  const blog = await getContent(props.params.locale, &apos;blog&apos;, props.params.slug);

  if (!blog) return {};

  return {
    title: blog.title,
    //...
  };
}

//...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, render the content using the &lt;em&gt;Mdx&lt;/em&gt; component.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//...

export default async function Page(props: TPage) {
  const post = await getContent(props.params.locale, &apos;blog&apos;, props.params.slug);

  if (!post) return null;

  return &amp;lt;Mdx code={post.body.code} /&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/juanmanzanero-com/next-intl-blog-template&quot;&gt;You can fork this template here&lt;/a&gt;&lt;/p&gt;
</content:encoded><author>Juan Manzanero</author></item><item><title>Privacy Must Be Taken More Seriously</title><link>https://juanmanzanero.com/blog/en/privacy-must-be-taken-more-seriously</link><guid isPermaLink="true">https://juanmanzanero.com/blog/en/privacy-must-be-taken-more-seriously</guid><description>Privacy is a fundamental pillar for free speech.</description><pubDate>Thu, 23 Apr 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Privacy is a fundamental pillar for free speech.&lt;/p&gt;
&lt;p&gt;You might found state &lt;em&gt;propaganda&lt;/em&gt; on social media, about how “anonymous
individuals/groups” are doing crimes, hacking, etc.&lt;/p&gt;
&lt;p&gt;Well, as I said, that&apos;s pure &lt;strong&gt;propaganda&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Governments wants to convince you that privacy or anonymity equals crime.&lt;/p&gt;
&lt;p&gt;I shouldn&apos;t tell you, but that&apos;s just stupid thinking.&lt;/p&gt;
&lt;p&gt;Not because a criminal uses Tor or Monero it means that everyone which uses the
mentioned technologies are criminals.&lt;/p&gt;
&lt;p&gt;It&apos;s like saying that if a criminal uses a spoon then everyone who uses a spoon
is also a criminal, yes; that&apos;s how stupid it sounds.&lt;/p&gt;
&lt;p&gt;Privacy is a basic right, it guarantees that those in power can be questioned
without them taking down their criticizers, and this is more required as the
censorship keeps incrementing.&lt;/p&gt;
&lt;p&gt;Today they might censor bad words, tomorrow memes of the idiot in a chair who
people calls president, in 1 month you can&apos;t talk about anything but good things
about the government.&lt;/p&gt;
&lt;p&gt;But as freedom, everyone wants it, but not everyone is going to fight for it, at
least in these days.&lt;/p&gt;
&lt;p&gt;Learn about &lt;em&gt;PGP&lt;/em&gt;, &lt;em&gt;Tor&lt;/em&gt;, &lt;em&gt;Monero&lt;/em&gt;, and any other technology that protects you.&lt;/p&gt;
</content:encoded><author>Juan Manzanero</author></item><item><title>Rewind 2023 and future plans</title><link>https://juanmanzanero.com/blog/en/rewind-2023-and-future-plans</link><guid isPermaLink="true">https://juanmanzanero.com/blog/en/rewind-2023-and-future-plans</guid><description>My rewind for 2023 and my plans for 2024 and beyond.</description><pubDate>Sat, 16 Dec 2023 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;My rewind for 2023 and my plans for 2024 and beyond.&lt;/p&gt;
&lt;p&gt;I hope you are having a good time this holiday.&lt;/p&gt;
&lt;p&gt;Life is a succession of choices, and in retrospect, I&apos;m happy that this year I
made the right ones.&lt;/p&gt;
&lt;h2&gt;In retrospect about my career this 2023&lt;/h2&gt;
&lt;p&gt;I grew up drastically as a Full Stack Developer, learning new libraries and
establishing my tech stack.&lt;/p&gt;
&lt;p&gt;I even started hacking (not the thing you hear in the news), creating side
projects looking to create solutions.&lt;/p&gt;
&lt;p&gt;I updated this website, creating new functionalities for content creation.&lt;/p&gt;
&lt;p&gt;Now I have more confidence in my skills, ready to keep growing up and taking on
new challenges.&lt;/p&gt;
&lt;h2&gt;Futures plans for my career this 2024&lt;/h2&gt;
&lt;p&gt;I want to start freelancing, I&apos;ll be creating templates and demo projects for
selling my services as a Frontend Developer mainly, but I&apos;ll keep learning about
Backend and Cloud, as well as keep practicing my English to enter the USA or
European markets.&lt;/p&gt;
&lt;p&gt;Maybe I&apos;ll not achieve this in 2024, but I must keep growing, as each year
passes, I&apos;ll be more prepared.&lt;/p&gt;
&lt;p&gt;I&apos;ll check if I could contribute to an Open Source project, as almost every tool
that I use is an Open Source one, I couldn&apos;t be here without if not with the
help of Open Source projects.&lt;/p&gt;
&lt;p&gt;Honestly, my true wish is to work full time in a Software as a Service startup,
or any startup with a focus on Software.&lt;/p&gt;
&lt;p&gt;The good thing that is I keep growing professionally, and I expect (and will)
the next year I&apos;ll reach more milestones.&lt;/p&gt;
&lt;p&gt;And of course, I&apos;ll continue hacking (in a creative way, not stealing info or
criminal things) with side projects, creating an extra incoming source will be
great for my finances.&lt;/p&gt;
&lt;h2&gt;Retrospect of 2023 personally and more&lt;/h2&gt;
&lt;p&gt;This year I rediscovered the hobby of reading, and I really enjoy it.&lt;/p&gt;
&lt;p&gt;I discovered my new favorite book, &lt;strong&gt;Ready Player One&lt;/strong&gt;, it was a really
exciting and great lecture, the next year I&apos;ll read the sequel.&lt;/p&gt;
&lt;p&gt;I also started reading &lt;strong&gt;Ikigai&lt;/strong&gt;, to keep acquiring good habits for a long and
happy life, and seek a purpose in life.&lt;/p&gt;
&lt;p&gt;Another book I started reading is &lt;strong&gt;The Little Book of Common Sense Investing&lt;/strong&gt;,
as I already had a good habit of saving, but I want my money to keep growing
more for a dignified retirement.&lt;/p&gt;
&lt;p&gt;I&apos;m spending less time on social media,
&lt;a href=&quot;/blog/the-monotony-of-social-media&quot;&gt;even I wrote an article about this&lt;/a&gt;,
doing things that &lt;strong&gt;I really want to do&lt;/strong&gt; instead.&lt;/p&gt;
&lt;p&gt;Is really horrible how much time social media steals from us, keeping us away
from doing things that we really enjoy.&lt;/p&gt;
&lt;p&gt;I&apos;m doing moderate exercise, but indoors, I want to go outdoors too, I need more
solar light.&lt;/p&gt;
&lt;p&gt;I&apos;m happy spending my time with my family, even if the majority of the time I&apos;m
working or studying, I keep contact with my loved ones, and continue doing it,
clearly.&lt;/p&gt;
&lt;h2&gt;Future plans for 2024 personally and more&lt;/h2&gt;
&lt;p&gt;I&apos;ll keep reading, I&apos;ll write more on this website.&lt;/p&gt;
&lt;p&gt;I want to acquire new habits, like pixel art.&lt;/p&gt;
&lt;p&gt;And I&apos;m retaking an old hobby, &lt;strong&gt;GameDev&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;As Unity is doing questionable things, I&apos;ll be using
&lt;a href=&quot;https://godotengine.org/&quot;&gt;Godot&lt;/a&gt; instead.&lt;/p&gt;
&lt;p&gt;I don&apos;t have in mind a big project or something like that, just retake to
develop simple videogames demos, it would be great to launch a little videogame,
but a complete one.&lt;/p&gt;
&lt;p&gt;Trust me, is really, &lt;strong&gt;REALLY&lt;/strong&gt; challenging to develop videogames, so instead of
overwhelming myself, I&apos;ll keep my &lt;strong&gt;ambitions simple&lt;/strong&gt;, but &lt;strong&gt;constant&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;Happy holidays!&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://juanmanzanero.com/_astro/2023-complete!.C65X4Dkp_GxmRo.webp&quot; alt=&quot;2023 complete image!&quot; /&gt;&lt;/p&gt;
</content:encoded><author>Juan Manzanero</author></item><item><title>The Monotony of Social Media</title><link>https://juanmanzanero.com/blog/en/the-monotony-of-social-media</link><guid isPermaLink="true">https://juanmanzanero.com/blog/en/the-monotony-of-social-media</guid><description>Abstracting human interaction using software has caused many problems that didn’t exist before.</description><pubDate>Mon, 17 Jul 2023 06:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Abstracting human interaction using software has caused many problems that
didn’t exist before.&lt;/p&gt;
&lt;p&gt;It’s obvious, a lot of interactions on the Internet occurs through social media,
letting you send friend requests, chat, or share memes and photos. However,
abstracting human interaction using software has caused many problems that
didn’t exist before.&lt;/p&gt;
&lt;p&gt;When the Internet started, many people created their own websites because that&apos;s
was the thing you must have if you want to be cool, and a lot of these websites
was just blogpost-like where the users shares their hobbies like movies, sports,
books, videogames, etc. This motivation made more unique and human websites,
where you can meet someone and their likes or dislikes.&lt;/p&gt;
&lt;p&gt;Now, with the boom of social media in the middle of 2000&apos;s, people prefer to
connect just searching for a name or looking the friends of their friends, and
send friend requests to try and connect. That was cool at the start, as anything
new, but the problems started when companies like Facebook (now Meta) or Google
(with YouTube) needed to monetize their platforms, mostly with Ads.&lt;/p&gt;
&lt;p&gt;And of course, that means that they needed to suppress, censor or ban anything
that could be harmful for society, like hate speeches or stupid challenges that
could risk people&apos;s lives.&lt;/p&gt;
&lt;p&gt;But, the bat thing about this, is that they homogenize almost everyone, forcing
them to act as the algorithms keeps recommending users with likes and comments,
guiding the people to act like someone else, and so.&lt;/p&gt;
&lt;p&gt;Now almost everyone does mainly two things, post photos about their &quot;perfect&quot;
lives or share memes, and don&apos;t get me wrong, it&apos;s ok to enter to social media
and try to disconnect for your job or problems, but using this every day as
instant escape instead of confronting your own problems could be harmful in the
long term, isolating you from the need of socialize in real life, with real
people, and thinking that everyone has a perfect life.&lt;/p&gt;
&lt;p&gt;No, EVERYONE has problems in their lives, even more than yours, but social media
algorithms promotes mainly &quot;positive vibes only&quot; and all that shit that in big
dose is hamrful for our minds.&lt;/p&gt;
&lt;p&gt;And don&apos;t mention the censorship and shadow-banning if you post something
controversial, it could be something that should not be tolerated like incite
hate to a group, or it could be something that don&apos;t everyone agrees but it
could be useful think a little about it, but still being controversial.&lt;/p&gt;
&lt;p&gt;Should everyone can tell what they thinks? Yeah, always if doesn&apos;t promotes hate
or hurt other people or animals.&lt;/p&gt;
&lt;p&gt;They&apos;re reports like Twitter promotes hate in the algorithm, and Meta knows that
Instagram increases anxiety and depression on young people, and actually;
promotes it... as all negative feelings keeps you on the social media
interacting with others, as that&apos;s what those companies sell, your data and time
to advertisers.&lt;/p&gt;
&lt;p&gt;I recently heard a video talking about this topic, and that would be cool if we
go back as the starts of the Internet where people created content as a hobby,
instead of looking for validation through likes and comments, being more
authentic persons instead of products.&lt;/p&gt;
&lt;p&gt;Should software solutions replace human interactions? I think not, but it&apos;s too
late for almost everyone, but if you&apos;re reading this, start changing your life
first if you want to be honest with yourself.&lt;/p&gt;
&lt;p&gt;Blog inspired by &quot;Why does every personal website look like this now?&quot; by Eric
Murphy on YouTube.&lt;/p&gt;
&lt;p&gt;Source Video:&lt;/p&gt;
&lt;p&gt;&amp;lt;iframe
width=&apos;100%&apos;
height=&apos;320&apos;
className=&apos;rounded-md&apos;
src=&apos;https://www.youtube-nocookie.com/embed/_x6SCSz7g5I&apos;
title=&apos;YouTube video player&apos;
allow=&apos;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&apos;
allowFullScreen&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;lt;/iframe&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;
</content:encoded><author>Juan Manzanero</author></item><item><title>Website migrated to Astro</title><link>https://juanmanzanero.com/blog/en/website-migrated-to-astro</link><guid isPermaLink="true">https://juanmanzanero.com/blog/en/website-migrated-to-astro</guid><description>I migrated this website to Astro, so I can test it and I really like it the features of Astro.</description><pubDate>Wed, 26 Jun 2024 06:00:00 GMT</pubDate><content:encoded>&lt;p&gt;So yeah, I proved this tool for building static websites, as Vercel has been taking weird decisions about the direction of the development of Next.js.&lt;/p&gt;
&lt;p&gt;That, and I realized that I just need a full static website, no need of SSR.&lt;/p&gt;
&lt;h2&gt;Static is the way to go&lt;/h2&gt;
&lt;p&gt;At the start of the Internet, websites were just plain HTML, CSS and JS, no need of Single Page Application, Server Side Rendering, etc.&lt;/p&gt;
&lt;p&gt;Of course, there are many websites that need these rendering strategies, but for a website like this, just static is better.&lt;/p&gt;
&lt;p&gt;Less time building, fast load, cheaper hosting, less JavaScript on the browser.&lt;/p&gt;
&lt;h2&gt;The cool thing about Astro&lt;/h2&gt;
&lt;p&gt;You can use any component from any framework.&lt;/p&gt;
&lt;p&gt;You can use React, Angular, Vue, Svelte components in the same project, as Astro compiles them as HTML/CSS/JS.&lt;/p&gt;
&lt;p&gt;Not only that, but you can use Astro as Next.js too, with the &lt;em&gt;hybrid&lt;/em&gt; rendering strategy, you can specify which pages you want to be Server Side Rendered. Obviously, if you&apos;re going this way, you must host your project on a server.&lt;/p&gt;
&lt;h3&gt;In other things...&lt;/h3&gt;
&lt;p&gt;I&apos;m planning on making videos for YouTube, talking about topics that I think we need more in the Hispanic community, topics like cybersecurity, privacy, the current status of technology, and more.&lt;/p&gt;
&lt;p&gt;There are many YT channels in English talking about that, so that&apos;s why I&apos;m thinking of doing it in Spanish.&lt;/p&gt;
&lt;p&gt;I need to improve the banners of these posts, though.&lt;/p&gt;
</content:encoded><author>Juan Manzanero</author></item></channel></rss>