,

Crear un clon de X utilizando Next.js 13, Supabase, React, TypeScript y TailwindCSS

Posted by








Clon de X con Next.js 13, Supabase, React, TypeScript y TailwindCSS

Building a Clon de X with Next.js 13, Supabase, React, TypeScript, and TailwindCSS

If you are looking to build a Clon de X application using the latest technologies, then you’ve come to the right place. In this article, we will discuss how to use Next.js 13, Supabase, React, TypeScript, and TailwindCSS to create a modern and efficient Clon de X.

Getting Started

To get started, you will need to have Node.js and npm installed on your computer. Once you have these installed, you can create a new Next.js project by running the following command:

npx create-next-app@13 my-clon-de-x-app
  

This will create a new Next.js project with all the necessary files and dependencies. Next, you can navigate into the project directory and install the Supabase client by running the following command:

npm install @supabase/supabase-js
  

Setting up Supabase

Supabase is a powerful and flexible platform for building Clon de X applications. To get started with Supabase, you will first need to sign up for an account and create a new project. Once you have your project set up, you can find your API URL and API Key in the project settings.

Next, you can initialize the Supabase client in your Next.js project by creating a new file called supabase.js and adding the following code:

import { createClient } from '@supabase/supabase-js';

  const supabaseUrl = 'your-api-url';
  const supabaseKey = 'your-api-key';

  export const supabase = createClient(supabaseUrl, supabaseKey);
  

Don’t forget to replace your-api-url and your-api-key with your actual Supabase API URL and API Key. Now your Next.js project is ready to interact with Supabase and perform various Clon de X operations.

Building the UI with React and TailwindCSS

Now that your project is set up with Supabase, you can start building the user interface using React and TailwindCSS. React is a popular JavaScript library for building user interfaces, and TailwindCSS is a utility-first CSS framework that makes it easy to style your application.

You can create new React components using functional or class-based syntax, and then use TailwindCSS classes to style your components. For example, you can create a new component called ClonItem and style it using TailwindCSS classes to display the Clon de X details.

Implementing TypeScript

To make your project more robust and maintainable, you can also implement TypeScript, which is a statically typed superset of JavaScript. TypeScript helps catch errors and improve code quality by providing type checking and other advanced features.

To add TypeScript to your Next.js project, you can run the following command:

npm install --save-dev typescript @types/react @types/node
  

This will install TypeScript and the necessary type definitions for React and Node.js. You can then rename your JavaScript files to TypeScript files by changing their extension from .js to .tsx for React components and .ts for other TypeScript files.

Conclusion

By using Next.js 13, Supabase, React, TypeScript, and TailwindCSS, you can create a modern and efficient Clon de X application. These technologies provide a powerful and flexible foundation for building Clon de X applications, and they can help you create a scalable and maintainable project.

Whether you are building a small personal project or a large enterprise application, these technologies can help you achieve your goals and deliver a high-quality Clon de X experience to your users.

0 0 votes
Article Rating
20 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Son Goku
7 months ago

una clase extraordinaria! 😀 gracias!

Ed nativido soto huamanhorcco
7 months ago

al momento de crear el triger no me aparece las tablas de auth, solo me aparece el de post y user osea los publicos, alguien sabe como soluciono eso?

panchomr
7 months ago

a quienes le de error despues de crear la funcion y el trigger, el problema está en la función ya que en el raw_meta_data no viene el campo name, revisen que campos tienen y ahí bindean , saludos

J
J
7 months ago

¿Estas seguro que el .origin en el mnuto 37:07 te redirigirá a la pagina web desde donde has lanzado el login?. no seria siempre localhost:3000?

Richard Espinoza
7 months ago

ya no se pueden hacer los triggers a tablas privadas desde la UI. Para solucionar este problema tienes que ir a la opcion de "SQL Editor" y copiar el siguiente comando:
create trigger on_auth_insert_users after insert on auth.users for each row execute function insert_user_in_public_table_for_new_user();
luego le das RUN en la esquina inferior derecha (o ctrl + enter) y ya te aparecera el triger creado correctamente.

Ricardo Sequeira
7 months ago

Interesante Midu como siempre Crack !

Consulta, yo podria crear API routes (las que ofrece next) usando el client de supabase ?

Junior Fabian Pacheco Moyano
7 months ago

Jajajajaja la policía me esta extorsionando, editor donde estas? sería bueno musica de fondo para ese momento XD

666 SKRTSKRTSKRT
7 months ago

hola, supabase a cambiado los triggers alguien sabria como hacerlo?

Tiago Mastrangelo
7 months ago

midu haz un video haciendo y explicando de como hacer comentarios anidados (Alguien me recomienda un video que lo explique desde cero)

Mauricio Cruz
7 months ago

Hola! Una pregunta. Cuando quiero crear el trigger, En el apartado "conditions to fire trigger" , "Table", no me deja seleccionar la tabla auth, sólo me deja seleccionar tablas públicas. Alquien sabe por qué? Si no puedo seleccionar auth no puedo hacer el trigger. Gracias!

Julian Rodriguez Jiménez
7 months ago

Hola, estoy intentando hacer el Trigger, en supabase. Pero resulta no puedo seleccionar la tabla de users. Habria otra forma de hacerlo, sin el Trigger? Un saludo

Manuel
7 months ago

Alguien sabe porque al crear el trigger sólo me salen las tablas públicas? No me aparece el acceso a las tabla auth users. Gracias de antemano

david garcia
7 months ago

En 2 Horas ha hecho medio clon de twiiter y yo en 2 horas he recorrido 2 arrays XD

Ricardo Gimenez
7 months ago

Tengo una duda, como puedo hacer para instalar el linter de la forma que lo hace, siempre al crear un proyecto ya me instala directo y me gustaria hacerlo de manera mas personalizada

Tiago Mastrangelo
7 months ago

Alguien mas le pasa que cuando crea la function y el trigger no le deja mas acceder a la homepage y solo se queda en el login aunque apretes el boton y te mande a github, el boton no te redirecciona hacia la homepage? AYUDA

Mario Andres Vaquero Chueca
7 months ago

Me encantan tus videos, pero con este se me esta atravesando intentar hacerlo con supabase, no me genera bien el token, y no se como solucionarlo! Si alguien ha sufrido algo parecido, estaré encantado de recibir ayuda!

ecstaticfaiv
7 months ago

Mis respetos hacia ti, siempre me divierto y aprendo mucho con estos videos, un grande el midu

NPCMAN
7 months ago

Hay parte 2? @midulive

Jhosx Zerpa
7 months ago

Para aquellos que llegaron al minuto 1:06:54 y no les funcionó posiblemente es por que la cuenta de Github que estan usando para probar no trae alguno de los datos, en mi caso era una cuenta sin nombre y el new.raw_user_meta_data->>'name' daba error en supabase por que era un valor null

Modifiquen la Function con un CASE-WHEN-ELSE-END dentro de VALUES, esto hará que en caso de que new.raw_user_meta_data->>'name' sea null, el campo name de la tabla se llenará con el new.raw_user_meta_data->>'user_name'

Me funcionó a mi.

BEGIN

INSERT INTO public.users (id, name, user_name, avatar_url)

VALUES (

new.id,

CASE

WHEN new.raw_user_meta_data->>'name' IS NULL THEN new.raw_user_meta_data->>'user_name'

ELSE new.raw_user_meta_data->>'name'

END,

new.raw_user_meta_data->>'user_name',

new.raw_user_meta_data->>'avatar_url'

);

RETURN new;

END

Alpharius
7 months ago

1:04:11 escribo exactamente el mismo código para la función de supabase y me da este error: Failed to create function: failed to create pg.functions: syntax error at or near ")"

No tengo ni idea de que hacer