Configuración inicial del proyecto: estructura de directorios y dependencias mínimas instaladas

This commit is contained in:
manu
2025-12-05 09:36:39 -05:00
commit 002c79abcb
60 changed files with 11057 additions and 0 deletions

45
.gitignore vendored Normal file
View File

@@ -0,0 +1,45 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files (can opt-in for committing if needed)
.env*
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
# project specific
/docs
/.cursor

300
README.md Normal file
View File

@@ -0,0 +1,300 @@
# Turo Clone
Plataforma de alquiler de vehículos entre particulares inspirada en Turo.com. Aplicación web completa desarrollada con arquitectura modular basada en principios SOLID.
## Descripción
Este proyecto es un clon funcional de Turo.com que permite a los usuarios buscar, reservar y gestionar alquileres de vehículos. Los propietarios pueden listar sus vehículos y los arrendatarios pueden buscar y reservar vehículos disponibles.
## Características Principales
### Funcionalidades Core
- **Búsqueda y Filtrado**: Búsqueda avanzada de vehículos por ubicación, fechas, tipo y precio con visualización en mapa estilo Airbnb (integración con Google Maps)
- **Gestión de Vehículos**: Sistema completo para que los propietarios gestionen sus vehículos
- **Sistema de Reservas**: Calendario de disponibilidad y gestión completa de reservas
- **Pagos**: Procesamiento seguro de transacciones
- **Reseñas y Calificaciones**: Sistema de feedback entre usuarios
- **Mensajería**: Comunicación en tiempo real entre propietarios y arrendatarios
- **Notificaciones**: Sistema de alertas y notificaciones para mantener a los usuarios informados
### Flujos Críticos
**Onboarding Host**
Creación de perfil → KYC upload documento → Listar vehículo → Subir fotos → Publicar
**Reserva Guest**
Buscar → Elegir vehículo → Ver calendario → Seleccionar fechas → Ver precio final → Pagar → Notificación host → (Si no instantBook) Host acepta → Reserva confirmada y calendario bloqueado
**Mensajería**
Hilo por booking con notificaciones email/push
**Check-in / Check-out**
Host confirma entrega, marca inicio y fin; posibilidad de añadir "confirmation photos"
**Claims**
Subir fotos y formulario, admin procesa o simula pago de seguro
### Alcance Mínimo Viable (MVP)
#### Prioridad Alta - Funciones Imprescindibles
**Registro / Autenticación**
- Autenticación de usuarios con email
- OAuth: Google y Apple
- Implementado con Appwrite Auth
**Perfiles de Usuarios**
- Roles: Guest (huésped) y Host (anfitrión)
- KYC light para hosts: datos personales y datos del vehículo
**Gestión de Vehículos**
- Crear/editar listado de vehículo
- Campos: título, descripción, fotos, atributos (marca, modelo, año, asientos, transmisión, features)
- Precio base por día
- Reglas de viaje
- Ubicación y calendario de disponibilidad
- Fotos almacenadas en Appwrite Storage
**Búsqueda y Filtros**
- Búsqueda por ubicación, fechas, precio
- Visualización en mapa estilo Airbnb con integración de Google Maps
- Búsqueda interactiva en mapa con marcadores de vehículos disponibles
- Filtros por tipo de vehículo, features
- Filtro por distancia de entrega
- Opciones de entrega/pickup
**Página de Detalle del Vehículo**
- Galería de fotos
- Mapa de ubicación
- Precio diario con desglose
- Políticas del vehículo
- Reseñas
- Calendario de disponibilidad
- Botón reservar/solicitar
**Flujo de Reservas**
- Seleccionar fechas
- Ver precio total (impuestos + fees + protección opcional)
- Pago con Stripe
- Confirmación de reserva
**Mensajería**
- Mensajería en-app para coordinación huésped-anfitrión
- Hilos de conversación por booking
**Calendario y Disponibilidad**
- Calendario de disponibilidad
- Bloqueo automático por reservas
**Panel Host**
- Ver reservas
- Aceptar/rechazar reservas (si no es instant booking)
- Administrar listado de vehículos
- Gestionar protección del vehículo
**Panel Admin**
- Moderación de listados
- Gestión de usuarios
- Transacciones y reportes
#### Funciones Avanzadas (Post-MVP)
- Integración de seguros/planes de protección con distintos planes y deducibles
- Pricing dinámico, "boosts" y reglas de descuentos
- Entrega en aeropuerto con fees incluidos en precio diario
- Calendar sync con Google Calendar
- Integración de telemetría (opcional)
- Ratings & reviews completos
- Claims flow y soporte al cliente
### Roles y Permisos
#### Roles del Sistema
**Guest (Huésped)**
- Puede reservar vehículos
- Realizar pagos
- Dejar reseñas y calificaciones
- Comunicarse con hosts mediante mensajería
**Host (Anfitrión)**
- Crear y gestionar listados de vehículos
- Recibir pagos
- Elegir plan de protección
- Gestionar reservas (aceptar/rechazar)
- Administrar calendario de disponibilidad
**Super-admin / Moderador**
- Gestionar usuarios
- Moderar listados
- Gestionar transacciones
- Acceso a reportes y analytics
#### Implementación
- RBAC implementado en Appwrite con custom claims
- Guards en la capa de frontend para protección de páginas
- Permisos configurados en Appwrite Console por colección
## Stack Tecnológico
- **Frontend**: Next.js 16 con Cache Components
- **Lenguaje**: TypeScript
- **Estilos**: Tailwind CSS
- **UI Library**: Shadcn/ui
- **Validación**: Zod v4
- **Backend**: Appwrite v18
- **Arquitectura**: SOLID con módulos que simulan microservicios
## Arquitectura
El proyecto sigue una arquitectura modular basada en principios SOLID donde cada módulo es autocontenido con sus propios componentes, hooks, servicios y tipos. Esta estructura simula microservicios permitiendo que cada módulo sea independiente y fácil de mantener.
### Estructura de Módulos
Cada módulo contiene:
- Componentes de presentación
- Hooks personalizados para lógica de estado
- Servicios con lógica de negocio
- Tipos TypeScript y schemas de validación Zod
## Módulos del Sistema
1. **Autenticación** - Login, registro y gestión de sesiones
2. **Usuarios** - Perfiles y gestión de usuarios
3. **Vehículos** - CRUD completo y gestión de vehículos
4. **Búsqueda** - Búsqueda avanzada y filtrado
5. **Reservas** - Sistema completo de reservas con calendario
6. **Pagos** - Procesamiento de pagos
7. **Reseñas** - Sistema de calificaciones y feedback
8. **Mensajería** - Chat en tiempo real entre usuarios
9. **Notificaciones** - Sistema de alertas y notificaciones
## Configuración Inicial
### Requisitos Previos
- Node.js instalado
- Cuenta de Appwrite configurada
- Variables de entorno configuradas
### Variables de Entorno
Configurar las siguientes variables en un archivo `.env.local`:
- Endpoint de Appwrite
- ID del proyecto de Appwrite
- ID de la base de datos de Appwrite
### Instalación
Instalar las dependencias del proyecto y ejecutar el servidor de desarrollo.
### Configuración de Appwrite
El proyecto utiliza Appwrite SDK directamente desde el frontend sin necesidad de API routes intermedias. La autenticación y autorización son manejadas por Appwrite, y los permisos se configuran en Appwrite Console.
### Base de Datos
Se requiere crear las siguientes colecciones en Appwrite:
- Usuarios
- Vehículos
- Reservas
- Pagos
- Reseñas
- Mensajes
- Notificaciones
## Estructura del Proyecto
El proyecto está organizado en módulos independientes dentro de la carpeta `modules/`, cada uno con su propia estructura de componentes, hooks, servicios y tipos. Los componentes compartidos se encuentran en `components/`, y las configuraciones y utilidades en `lib/`.
### Estructura de Directorios
```
turo-clone/
├── app/ # Next.js App Router
│ ├── (auth)/ # Grupo de rutas de autenticación
│ │ ├── login/
│ │ ├── register/
│ │ └── layout.tsx
│ ├── (public)/ # Rutas públicas
│ │ ├── page.tsx # Homepage
│ │ ├── search/
│ │ ├── vehicles/
│ │ │ └── [id]/
│ │ └── layout.tsx
│ ├── (dashboard)/ # Rutas protegidas
│ │ ├── dashboard/
│ │ │ ├── vehicles/
│ │ │ │ ├── create/
│ │ │ │ └── [id]/
│ │ │ └── page.tsx
│ │ ├── reservations/
│ │ ├── profile/
│ │ └── layout.tsx
│ ├── api/ # API Routes (solo para webhooks o integraciones externas)
│ ├── error.tsx # Manejo de errores global
│ ├── global-error.tsx # Manejo de errores críticos
│ ├── not-found.tsx # Página 404 global
│ ├── loading.tsx # Estado de carga global
│ ├── layout.tsx
│ └── globals.css
├── modules/ # Módulos del sistema (microservicios simulados)
│ ├── auth/
│ │ ├── components/ # Componentes de UI
│ │ ├── hooks/ # Custom hooks
│ │ ├── services/ # Lógica de negocio
│ │ ├── types/ # Tipos TypeScript
│ │ └── index.ts # Barrel exports
│ │
│ ├── users/
│ ├── vehicles/
│ ├── search/
│ ├── reservations/
│ ├── payments/
│ ├── reviews/
│ ├── messaging/
│ └── notifications/
├── components/ # Componentes compartidos
│ ├── ui/ # Componentes de shadcn/ui
│ ├── layout/ # Componentes de layout
│ └── common/ # Componentes comunes
├── lib/ # Utilidades y configuraciones
│ ├── utils.ts
│ ├── appwrite/ # Configuración de Appwrite
│ └── constants/
├── hooks/ # Hooks compartidos
├── types/ # Tipos globales
├── public/ # Archivos estáticos
├── config/ # Configuraciones
└── docs/ # Documentación del proyecto
```
### Estructura de un Módulo
Cada módulo sigue esta estructura estándar:
```
modules/[module-name]/
├── components/ # Componentes de presentación
│ └── [Component].tsx
├── hooks/ # Custom hooks para lógica de estado
│ └── use[Feature].ts
├── services/ # Servicios de negocio (lógica pura)
│ └── [feature].service.ts
├── types/ # Definiciones de tipos TypeScript y schemas Zod
│ ├── [feature].types.ts # Tipos TypeScript
│ └── [feature].schemas.ts # Schemas de validación Zod
└── index.ts # Barrel exports para importaciones limpias
```

8
app/(auth)/layout.tsx Normal file
View File

@@ -0,0 +1,8 @@
export default function AuthLayout({
children,
}: {
children: React.ReactNode;
}) {
return <>{children}</>;
}

View File

@@ -0,0 +1,9 @@
export default function LoginPage() {
return (
<div>
<h1>Login Page</h1>
{/* Login form will be implemented here */}
</div>
);
}

View File

@@ -0,0 +1,9 @@
export default function RegisterPage() {
return (
<div>
<h1>Register Page</h1>
{/* Register form will be implemented here */}
</div>
);
}

View File

@@ -0,0 +1,9 @@
export default function DashboardPage() {
return (
<div>
<h1>Dashboard</h1>
{/* Dashboard content will be implemented here */}
</div>
);
}

View File

@@ -0,0 +1,14 @@
export default function EditVehiclePage({
params,
}: {
params: { id: string };
}) {
return (
<div>
<h1>Edit Vehicle</h1>
<p>Vehicle ID: {params.id}</p>
{/* Vehicle edit form will be implemented here */}
</div>
);
}

View File

@@ -0,0 +1,9 @@
export default function CreateVehiclePage() {
return (
<div>
<h1>Create Vehicle</h1>
{/* Vehicle creation form will be implemented here */}
</div>
);
}

View File

@@ -0,0 +1,8 @@
export default function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
return <>{children}</>;
}

View File

@@ -0,0 +1,9 @@
export default function ProfilePage() {
return (
<div>
<h1>Profile</h1>
{/* Profile content will be implemented here */}
</div>
);
}

View File

@@ -0,0 +1,9 @@
export default function ReservationsPage() {
return (
<div>
<h1>Reservations</h1>
{/* Reservations list will be implemented here */}
</div>
);
}

8
app/(public)/layout.tsx Normal file
View File

@@ -0,0 +1,8 @@
export default function PublicLayout({
children,
}: {
children: React.ReactNode;
}) {
return <>{children}</>;
}

View File

@@ -0,0 +1,9 @@
export default function SearchPage() {
return (
<div>
<h1>Search Page</h1>
{/* Search functionality will be implemented here */}
</div>
);
}

View File

@@ -0,0 +1,14 @@
export default function VehicleDetailPage({
params,
}: {
params: { id: string };
}) {
return (
<div>
<h1>Vehicle Detail Page</h1>
<p>Vehicle ID: {params.id}</p>
{/* Vehicle details will be implemented here */}
</div>
);
}

51
app/error.tsx Normal file
View File

@@ -0,0 +1,51 @@
'use client'
import { useEffect } from 'react';
import Link from 'next/link';
import { ROUTES } from '@/lib/constants/routes';
export default function Error({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
// Log error to monitoring service (Sentry, etc.)
console.error('Error:', error);
}, [error]);
return (
<div className="flex min-h-screen flex-col items-center justify-center p-4">
<div className="text-center space-y-4 max-w-md">
<h2 className="text-2xl font-bold text-turo-primary">
Algo salió mal
</h2>
<p className="text-muted-foreground">
{error.message || 'Ocurrió un error inesperado'}
</p>
{error.digest && (
<p className="text-sm text-muted-foreground">
Error ID: {error.digest}
</p>
)}
<div className="flex gap-4 justify-center">
<button
onClick={reset}
className="px-4 py-2 bg-turo-accent text-white rounded-lg hover:bg-turo-accent-hover transition-colors"
>
Intentar de nuevo
</button>
<Link
href={ROUTES.HOME}
className="px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors"
>
Volver al inicio
</Link>
</div>
</div>
</div>
);
}

BIN
app/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

45
app/global-error.tsx Normal file
View File

@@ -0,0 +1,45 @@
'use client'
import { useEffect } from 'react';
export default function GlobalError({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
// Log error to monitoring service (Sentry, etc.)
console.error('Global error:', error);
}, [error]);
return (
<html>
<body>
<div className="flex min-h-screen flex-col items-center justify-center p-4 bg-background">
<div className="text-center space-y-4 max-w-md">
<h2 className="text-2xl font-bold text-turo-primary">
Error Crítico
</h2>
<p className="text-muted-foreground">
{error.message || 'Ocurrió un error crítico en la aplicación'}
</p>
{error.digest && (
<p className="text-sm text-muted-foreground">
Error ID: {error.digest}
</p>
)}
<button
onClick={reset}
className="px-4 py-2 bg-turo-accent text-white rounded-lg hover:bg-turo-accent-hover transition-colors"
>
Reintentar
</button>
</div>
</div>
</body>
</html>
);
}

157
app/globals.css Normal file
View File

@@ -0,0 +1,157 @@
@import "tailwindcss";
@import "tw-animate-css";
@custom-variant dark (&:is(.dark *));
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
--color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar: var(--sidebar);
--color-chart-5: var(--chart-5);
--color-chart-4: var(--chart-4);
--color-chart-3: var(--chart-3);
--color-chart-2: var(--chart-2);
--color-chart-1: var(--chart-1);
--color-ring: var(--ring);
--color-input: var(--input);
--color-border: var(--border);
--color-destructive: var(--destructive);
--color-accent-foreground: var(--accent-foreground);
--color-accent: var(--accent);
--color-muted-foreground: var(--muted-foreground);
--color-muted: var(--muted);
--color-secondary-foreground: var(--secondary-foreground);
--color-secondary: var(--secondary);
--color-primary-foreground: var(--primary-foreground);
--color-primary: var(--primary);
--color-popover-foreground: var(--popover-foreground);
--color-popover: var(--popover);
--color-card-foreground: var(--card-foreground);
--color-card: var(--card);
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
/* Turo Brand Colors */
--color-turo-primary: var(--turo-primary);
--color-turo-secondary: var(--turo-secondary);
--color-turo-accent: var(--turo-accent);
--color-turo-accent-hover: var(--turo-accent-hover);
--color-turo-accent-alt: var(--turo-accent-alt);
--color-turo-white: var(--turo-white);
--color-turo-gray-light: var(--turo-gray-light);
--color-turo-gray-medium: var(--turo-gray-medium);
--color-turo-gray-dark: var(--turo-gray-dark);
--color-turo-black: var(--turo-black);
}
:root {
--radius: 0.625rem;
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--chart-1: oklch(0.646 0.222 41.116);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
--chart-5: oklch(0.769 0.188 70.08);
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
/* Turo Brand Colors */
--turo-primary: #1A1A2E;
--turo-secondary: #16213E;
--turo-accent: #00A676;
--turo-accent-hover: #008A5E;
--turo-accent-alt: #E94560;
--turo-white: #FFFFFF;
--turo-gray-light: #F0F0F0;
--turo-gray-medium: #282828;
--turo-gray-dark: #141414;
--turo-black: #000000;
}
.dark {
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.205 0 0);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.205 0 0);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.922 0 0);
--primary-foreground: oklch(0.205 0 0);
--secondary: oklch(0.269 0 0);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.269 0 0);
--muted-foreground: oklch(0.708 0 0);
--accent: oklch(0.269 0 0);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 10%);
--input: oklch(1 0 0 / 15%);
--ring: oklch(0.556 0 0);
--chart-1: oklch(0.488 0.243 264.376);
--chart-2: oklch(0.696 0.17 162.48);
--chart-3: oklch(0.769 0.188 70.08);
--chart-4: oklch(0.627 0.265 303.9);
--chart-5: oklch(0.645 0.246 16.439);
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.556 0 0);
/* Turo Brand Colors - Dark Mode */
--turo-primary: #2A3A4E;
--turo-secondary: #1A2A3E;
--turo-accent: #00C896;
--turo-accent-hover: #00A676;
--turo-accent-alt: #FF6B7A;
--turo-white: #FFFFFF;
--turo-gray-light: #2A2A2A;
--turo-gray-medium: #3A3A3A;
--turo-gray-dark: #1A1A1A;
--turo-black: #000000;
}
@layer base {
* {
@apply border-border outline-ring/50;
}
body {
@apply bg-background text-foreground;
}
}

34
app/layout.tsx Normal file
View File

@@ -0,0 +1,34 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
</html>
);
}

6
app/loading.tsx Normal file
View File

@@ -0,0 +1,6 @@
import { Loading } from '@/components/common/Loading';
export default function GlobalLoading() {
return <Loading />;
}

31
app/not-found.tsx Normal file
View File

@@ -0,0 +1,31 @@
import Link from 'next/link';
import { ROUTES } from '@/lib/constants/routes';
export default function NotFound() {
return (
<div className="flex min-h-screen flex-col items-center justify-center p-4">
<div className="text-center space-y-4 max-w-md">
<h2 className="text-4xl font-bold text-turo-primary">404</h2>
<h3 className="text-2xl font-semibold">Página no encontrada</h3>
<p className="text-muted-foreground">
La página que buscas no existe o ha sido movida.
</p>
<div className="flex gap-4 justify-center">
<Link
href={ROUTES.HOME}
className="px-4 py-2 bg-turo-accent text-white rounded-lg hover:bg-turo-accent-hover transition-colors"
>
Volver al inicio
</Link>
<Link
href={ROUTES.SEARCH}
className="px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors"
>
Buscar vehículos
</Link>
</div>
</div>
</div>
);
}

65
app/page.tsx Normal file
View File

@@ -0,0 +1,65 @@
import Image from "next/image";
export default function Home() {
return (
<div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
<Image
className="dark:invert"
src="/next.svg"
alt="Next.js logo"
width={100}
height={20}
priority
/>
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
To get started, edit the page.tsx file.
</h1>
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
Looking for a starting point or more instructions? Head over to{" "}
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
className="font-medium text-zinc-950 dark:text-zinc-50"
>
Templates
</a>{" "}
or the{" "}
<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
className="font-medium text-zinc-950 dark:text-zinc-50"
>
Learning
</a>{" "}
center.
</p>
</div>
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
<a
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert"
src="/vercel.svg"
alt="Vercel logomark"
width={16}
height={16}
/>
Deploy Now
</a>
<a
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Documentation
</a>
</div>
</main>
</div>
);
}

22
components.json Normal file
View File

@@ -0,0 +1,22 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "app/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"iconLibrary": "lucide",
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"registries": {}
}

View File

View File

@@ -0,0 +1,30 @@
export function Loading() {
return (
<div className="flex items-center justify-center p-8 min-h-[200px]">
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-turo-accent" />
</div>
);
}
export function LoadingSkeleton() {
return (
<div className="animate-pulse space-y-4 p-4">
<div className="h-4 bg-gray-200 rounded w-3/4" />
<div className="h-4 bg-gray-200 rounded w-1/2" />
<div className="h-4 bg-gray-200 rounded w-5/6" />
</div>
);
}
export function CardSkeleton() {
return (
<div className="animate-pulse border rounded-lg p-6 space-y-4">
<div className="h-48 bg-gray-200 rounded" />
<div className="space-y-2">
<div className="h-4 bg-gray-200 rounded w-3/4" />
<div className="h-4 bg-gray-200 rounded w-1/2" />
</div>
</div>
);
}

View File

0
components/ui/.gitkeep Normal file
View File

View File

@@ -0,0 +1,3 @@
// Appwrite configuration file
// This file will contain Appwrite-specific configurations

3
config/env.config.ts Normal file
View File

@@ -0,0 +1,3 @@
// Environment variables configuration
// This file will validate and export environment variables

18
eslint.config.mjs Normal file
View File

@@ -0,0 +1,18 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";
const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);
export default eslintConfig;

3
lib/appwrite/client.ts Normal file
View File

@@ -0,0 +1,3 @@
// Appwrite client setup
// This file will be implemented when Appwrite SDK is installed

7
lib/appwrite/config.ts Normal file
View File

@@ -0,0 +1,7 @@
// Appwrite configuration
export const appwriteConfig = {
endpoint: process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT || '',
projectId: process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID || '',
databaseId: process.env.NEXT_PUBLIC_APPWRITE_DATABASE_ID || '',
};

3
lib/appwrite/database.ts Normal file
View File

@@ -0,0 +1,3 @@
// Appwrite database setup
// This file will be implemented when Appwrite SDK is installed

18
lib/constants/appwrite.ts Normal file
View File

@@ -0,0 +1,18 @@
// Appwrite collection and database constants
export const APPWRITE_COLLECTIONS = {
USERS: 'users',
VEHICLES: 'vehicles',
RESERVATIONS: 'reservations',
TRANSACTIONS: 'transactions',
PAYMENT_METHODS: 'payment_methods',
REVIEWS: 'reviews',
CONVERSATIONS: 'conversations',
MESSAGES: 'messages',
NOTIFICATIONS: 'notifications',
} as const;
export const APPWRITE_STORAGE_BUCKETS = {
PROFILE_IMAGES: 'profile-images',
VEHICLE_IMAGES: 'vehicle-images',
} as const;

20
lib/constants/routes.ts Normal file
View File

@@ -0,0 +1,20 @@
// Application routes constants
export const ROUTES = {
HOME: '/',
LOGIN: '/login',
REGISTER: '/register',
SEARCH: '/search',
VEHICLES: {
BASE: '/vehicles',
DETAIL: (id: string) => `/vehicles/${id}`,
},
DASHBOARD: '/dashboard',
PROFILE: '/profile',
RESERVATIONS: '/reservations',
VEHICLES_MANAGE: {
BASE: '/dashboard/vehicles',
CREATE: '/dashboard/vehicles/create',
EDIT: (id: string) => `/dashboard/vehicles/${id}`,
},
} as const;

6
lib/utils.ts Normal file
View File

@@ -0,0 +1,6 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}

View File

@@ -0,0 +1,86 @@
// Common validation schemas reusable across modules
import { z } from 'zod';
/**
* Email validation schema
*/
export const emailSchema = z.string().email('Email inválido');
/**
* Password validation schema
* - Minimum 8 characters
* - At least one uppercase letter
* - At least one lowercase letter
* - At least one number
*/
export const passwordSchema = z
.string()
.min(8, 'La contraseña debe tener al menos 8 caracteres')
.regex(/[A-Z]/, 'Debe contener al menos una mayúscula')
.regex(/[a-z]/, 'Debe contener al menos una minúscula')
.regex(/[0-9]/, 'Debe contener al menos un número');
/**
* Phone number validation schema
* Supports international format with optional +
*/
export const phoneSchema = z
.string()
.regex(/^\+?[1-9]\d{1,14}$/, 'Número de teléfono inválido')
.optional();
/**
* URL validation schema
*/
export const urlSchema = z.string().url('URL inválida');
/**
* Date validation schema with coercion
*/
export const dateSchema = z.coerce.date();
/**
* Date range validation schema
* Ensures end date is after start date
*/
export const dateRangeSchema = z
.object({
start: z.coerce.date(),
end: z.coerce.date(),
})
.refine((data) => data.end > data.start, {
message: 'La fecha de fin debe ser posterior a la fecha de inicio',
path: ['end'],
});
/**
* Positive number schema
*/
export const positiveNumberSchema = z.number().positive('El valor debe ser mayor a 0');
/**
* Non-empty string schema
*/
export const nonEmptyStringSchema = z.string().min(1, 'Este campo es requerido');
/**
* Image file validation schema
* - Max size: 5MB
* - Allowed types: JPEG, PNG, WebP
*/
export const imageFileSchema = z
.instanceof(File)
.refine((file) => file.size <= 5 * 1024 * 1024, 'El archivo debe ser menor a 5MB')
.refine(
(file) => ['image/jpeg', 'image/png', 'image/webp'].includes(file.type),
'Solo se permiten imágenes JPEG, PNG o WebP'
);
/**
* Multiple image files schema
*/
export const imageFilesSchema = z
.array(imageFileSchema)
.min(1, 'Al menos una imagen es requerida')
.max(10, 'Máximo 10 imágenes');

3
lib/validations/index.ts Normal file
View File

@@ -0,0 +1,3 @@
// Barrel exports for common validation schemas
export * from './common.schemas';

6
modules/auth/index.ts Normal file
View File

@@ -0,0 +1,6 @@
// Barrel exports for auth module
export * from './types';
export * from './services';
export * from './hooks';
export * from './components';

View File

@@ -0,0 +1,6 @@
// Barrel exports for messaging module
export * from './types';
export * from './services';
export * from './hooks';
export * from './components';

View File

@@ -0,0 +1,6 @@
// Barrel exports for notifications module
export * from './types';
export * from './services';
export * from './hooks';
export * from './components';

View File

@@ -0,0 +1,6 @@
// Barrel exports for payments module
export * from './types';
export * from './services';
export * from './hooks';
export * from './components';

View File

@@ -0,0 +1,6 @@
// Barrel exports for reservations module
export * from './types';
export * from './services';
export * from './hooks';
export * from './components';

6
modules/reviews/index.ts Normal file
View File

@@ -0,0 +1,6 @@
// Barrel exports for reviews module
export * from './types';
export * from './services';
export * from './hooks';
export * from './components';

6
modules/search/index.ts Normal file
View File

@@ -0,0 +1,6 @@
// Barrel exports for search module
export * from './types';
export * from './services';
export * from './hooks';
export * from './components';

6
modules/users/index.ts Normal file
View File

@@ -0,0 +1,6 @@
// Barrel exports for users module
export * from './types';
export * from './services';
export * from './hooks';
export * from './components';

View File

@@ -0,0 +1,6 @@
// Barrel exports for vehicles module
export * from './types';
export * from './services';
export * from './hooks';
export * from './components';

7
next.config.ts Normal file
View File

@@ -0,0 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
};
export default nextConfig;

9761
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

35
package.json Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "turo-clone",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint"
},
"dependencies": {
"@hookform/resolvers": "^5.2.2",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.555.0",
"next": "16.0.6",
"react": "19.2.0",
"react-dom": "19.2.0",
"react-hook-form": "^7.67.0",
"tailwind-merge": "^3.4.0",
"zod": "^4.1.13"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "16.0.6",
"shadcn": "^3.5.1",
"tailwindcss": "^4",
"tw-animate-css": "^1.4.0",
"typescript": "^5"
}
}

7
postcss.config.mjs Normal file
View File

@@ -0,0 +1,7 @@
const config = {
plugins: {
"@tailwindcss/postcss": {},
},
};
export default config;

1
public/file.svg Normal file
View File

@@ -0,0 +1 @@
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 391 B

1
public/globe.svg Normal file
View File

@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

1
public/next.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

1
public/vercel.svg Normal file
View File

@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 128 B

1
public/window.svg Normal file
View File

@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>

After

Width:  |  Height:  |  Size: 385 B

79
scripts/list-databases.js Normal file
View File

@@ -0,0 +1,79 @@
#!/usr/bin/env node
const https = require('https');
const APPWRITE_ENDPOINT = 'https://appwrite.sunshinebestdeals.com/v1';
const APPWRITE_PROJECT_ID = '693051e800374dd0a5b1';
const APPWRITE_API_KEY = 'standard_b7ab9cd9f604fc98ab40f8c3472ba0bb27ea37c68567ec1b5c665de851aa66ee2c12a15b9f1f3a69d4d8c6cda4dbb0801150f749fdba052e8c822d82bd56b5ad75815d799ffd6a2ed21c3ed2432ececbfb65ca12e46dcb5b36e48557276463de9c6830dd8d966a549343dc60f5919be595d967568de21aa99621ff8e44dccf4a';
function listDatabases() {
return new Promise((resolve, reject) => {
const url = new URL(`${APPWRITE_ENDPOINT}/databases`);
const options = {
hostname: url.hostname,
port: url.port || 443,
path: url.pathname,
method: 'GET',
headers: {
'X-Appwrite-Project': APPWRITE_PROJECT_ID,
'X-Appwrite-Key': APPWRITE_API_KEY,
'Content-Type': 'application/json',
},
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
try {
const json = JSON.parse(data);
if (res.statusCode === 200) {
resolve(json);
} else {
reject(new Error(`Error ${res.statusCode}: ${json.message || data}`));
}
} catch (e) {
reject(new Error(`Error parsing response: ${e.message}\nResponse: ${data}`));
}
});
});
req.on('error', (error) => {
reject(error);
});
req.end();
});
}
async function main() {
try {
console.log('📊 Listando bases de datos de Appwrite...\n');
const response = await listDatabases();
if (response.databases && response.databases.length > 0) {
console.log(`✅ Encontradas ${response.databases.length} base(s) de datos:\n`);
response.databases.forEach((db, index) => {
console.log(`${index + 1}. ${db.name}`);
console.log(` ID: ${db.$id}`);
console.log(` Creada: ${new Date(db.$createdAt).toLocaleString()}`);
console.log('');
});
console.log(`Total: ${response.total} base(s) de datos`);
} else {
console.log(' No se encontraron bases de datos en tu proyecto.');
}
} catch (error) {
console.error('❌ Error al listar bases de datos:', error.message);
process.exit(1);
}
}
main();

34
tsconfig.json Normal file
View File

@@ -0,0 +1,34 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts",
"**/*.mts"
],
"exclude": ["node_modules"]
}

2
types/appwrite.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
// Appwrite-specific type definitions

2
types/global.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
// Global type definitions