- layout.tsx
- get a hold of the README.MD
-
bookings
-
checkout
-
favorites
-
profile
-
properties
-
rentals
-
reviews
-
new file - pageName/page.tsx
npx shadcn@latest init
- New York
- Zinc
npx shadcn@latest add button
npx shadcn@latest add breadcrumb calendar card checkbox dropdown-menu input label popover scroll-area select separator table textarea toast skeleton
- components
- ui
- card
- form
- home
- navbar
- properties
-
create
-
navbar
- DarkMode.tsx
- LinksDropdown.tsx
- Logo.tsx
- Navbar.tsx
- NavSearch.tsx
- SignOutLink.tsx
- UserIcon.tsx
globals.css
- replace css variables in in globals.css
- create app/providers.tsx
layout.tsx
- create app/theme-provider.tsx
providers.tsx
- make sure you export as default !!!
- create utils/links.ts
Clerk Docs Clerk + Next.js Setup
-
create new application
-
create .env.local
In Next.js, environment variables that start with NEXTPUBLIC are exposed to the browser. This means they can be accessed in your front-end code.
For example, NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY can be used in both server-side and client-side code.
On the other hand, CLERK_SECRET_KEY is a server-side environment variable. It's not exposed to the browser, making it suitable for storing sensitive data like API secrets.
layout.tsx
-
create middleware.ts
-
restart dev server
- customization
- avatars
- redirectUrl
.env.local
- profile
- create
- components/form/FormInput.tsx
- components/form/Buttons.tsx
-
create components/form/FormContainer.tsx
-
create utils/types.ts
Zod is a JavaScript library for building schemas and validating data, providing type safety and error handling.
- create utils/schemas.ts
- create utils/actions.ts
- import in profile/create page.tsx
- create account and organization
- create project
- setup password in .env (optional)
- add .env to .gitignore !!!
- it will take few minutes
- install prisma vs-code extension
Prisma ORM is a database toolkit that simplifies database access in web applications. It allows developers to interact with databases using a type-safe and auto-generated API, making database operations easier and more secure.
- Prisma server: A standalone infrastructure component sitting on top of your database.
- Prisma client: An auto-generated library that connects to the Prisma server and lets you read, write and stream data in your database. It is used for data access in your applications.
In development, the command next dev clears Node.js cache on run. This in turn initializes a new PrismaClient instance each time due to hot reloading that creates a connection to the database. This can quickly exhaust the database connections as each PrismaClient instance holds its own connection pool.
(Prisma Instance)[https://www.prisma.io/docs/guides/other/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices#solution]
- create utils/db.ts
-
add to .env
-
DATABASE_URL : Transaction + Password + "?pgbouncer=true&connection_limit=1"
-
DIRECT_URL : Session + Password
- Get All Records
- Get record by ID or unique identifier
- Update Record
- Update or create records
- Delete a single record
actions.ts
- components/navbar/UserIcon.tsx
actions.ts
app/profile/page.tsx
actions.ts
actions.ts
schemas.ts actions.ts
components/form/ImageInput.tsx
components/form/ImageInputContainer.tsx
actions.ts
schemas.ts
The .refine() method in Zod is used to add custom validation to a Zod schema. It takes two arguments:
A function that takes a value and returns a boolean. This function is the validation rule. If it returns true, the validation passes. If it returns false, the validation fails. A string that is the error message to be returned when the validation fails.
utils/supabase.ts
schemas.ts
actions.ts
- app/rentals/create/page.tsx
- components/form/PriceInput.tsx
- utils/categories.ts
- components/form/TextAreaInput.tsx
- utils/countries.ts
- components/form/CountriesInput.tsx
- components/form/CounterInput.tsx
- utils/amenities.ts
- components/form/AmenitiesInput.tsx
utils/types.ts actions.ts
- create in components/home
- CategoriesList.tsx
- EmptyList.tsx
- PropertiesContainer.tsx
- PropertiesList.tsx
- components/card
- CountryFlagAndName.tsx
- FavoriteToggleButton.tsx
- FavoriteToggleForm.tsx
- LoadingCards.tsx
- PropertyCard.tsx
- PropertyRating.tsx
- utils/format.ts
- app/loading.tsx - always an option components/card/LoadingCards.tsx
app/page.tsx
- navigate to a different page, refresh and then navigate back to home page
- make sure you fetch in component not page
components/form/Buttons.tsx components/card/FavoriteToggleButton.tsx
actions.ts
components/form/Buttons.tsx
actions.ts
actions.ts
- favorites/page.tsx
- utils/actions.ts
- properties/[id]/loading.tsx
- properties/[id]/page.tsx
- components/properties/BreadCrumbs.tsx
- properties/[id]/page.tsx
- components/properties/ShareButton.tsx
- properties/[id]/page.tsx
- components/properties/ImageContainer.tsx
- properties/[id]/page.tsx
- properties/[id]/page.tsx
- components/properties/booking/BookingCalendar.tsx
- properties/[id]/page.tsx
- utils/format.ts
- components/properties/PropertyDetails.tsx
- properties/[id]/page.tsx
- components/properties/UserInfo.tsx
- properties/[id]/page.tsx
- components/properties/Title.tsx
- components/properties/Description.tsx
- properties/[id]/page.tsx
- components/properties/Amenities.tsx
- properties/[id]/page.tsx
Leaflet makes direct calls to the DOM when it is loaded, therefore React Leaflet is not compatible with server-side rendering. nts/properties/PropertyMap.tsx
- properties/[id]/page.tsx
Lazy Loading: Components wrapped with dynamic are lazy loaded. This means that the component code is not loaded until it is needed. For example, if you have a component that is only visible when a user clicks a button, you could use dynamic to ensure that the code for that component is not loaded until the button is clicked.
Server Side Rendering (SSR) Control: By default, Next.js pre-renders every page. This means that it generates HTML for each page in advance, instead of doing it all on the client-side. However, with dynamic, you can control this behavior. You can choose to disable SSR for specific modules, which can be useful for modules that have client-side dependencies.
- refactor NavSearch Component
DON'T FORGET !!!!
npx prisma db push
- restart server
- create components/reviews
- Comment.tsx
- PropertyReviews.tsx
- Rating.tsx
- SubmitReview.tsx
- ReviewCard.tsx
- create placeholder functions in actions.ts
- components/form/RatingInput.tsx
- app/properties/[id]
- components/reviews/SubmitReview.tsx
- optional : set rows prop in TextArea.tsx
- utils/schemas.ts
- action.ts
- actions.ts
- app/properties/[id]
- components/reviews/PropertyReviews.tsx
- components/form/Buttons.tsx
- app/reviews/page.tsx
- loading.tsx
- actions.ts
- app/properties/[id]
Prisma's findUnique and findFirst methods are used to retrieve a single record from the database, but they have some differences in their behavior:
-
findUnique: This method is used when you want to retrieve a single record that matches a unique constraint or a primary key. If no record is found, it returns null.
-
findFirst: This method is used when you want to retrieve a single record that matches a non-unique constraint. It can also be used with ordering and filtering. If no record is found, it returns null.
In summary, use findUnique when you're sure the field you're querying by is unique, and use findFirst when you're querying by a non-unique field or need more complex queries with ordering and filtering.
- actions
- components/card/PropertyRating.tsx
- schema.prisma
- restart server !!!
- actions.ts
- utils/types.ts
- remove @/components/properties/BookingCalendar.tsx
- create @/components/booking
- BookingCalendar.tsx
- BookingContainer.tsx
- BookingForm.tsx
- BookingWrapper.tsx
- ConfirmBooking.tsx
- utils/store.ts
- properties/[id]/page.tsx
- utils/calendar.ts
- utils/calculateTotals.ts
- action.ts
BookingCalendar.tsx
BookingCalendar.tsx
- actions.ts
- utils/format.ts
Bookings.tsx
- create @/components/booking/LoadingTable.tsx
- create app/bookings/loading.tsx
- actions.ts
- create rentals/loading.tsx
- actions.ts
- rentals/[id]/edit/page.tsx
- in app/reservations create page.tsx and loading.tsx
- add to links utils/links.ts
- create app/admin/page.tsx
- add admin to links
- create components/admin
- Chart.tsx
- ChartsContainer.tsx
- Loading.tsx
- StatsCard.tsx
- StatsContainer.tsx
- refactor middleware
- create ENV variable with userId
- add to VERCEL
- LinksDropdown.tsx
format.ts
- setup and add keys to .env
- install
api/payment/route.ts
api/confirm/route.ts
- remove all bookings with 'paymentStatus' false, before creating a booking createBookingAction.ts
- Check for 'paymentStatus' when fetching bookings
- fetchBookings
- rentalsWithBookingSums
- fetchReservations
- fetchStats
- fetchChartsData
- actions.ts
- create components/reservations/Stats.tsx
- refactor StatsCard.tsx
- render in reservations