Given the uncertain situation in the country, the client needed a way to stay visible online and keep their content available without depending on any foreign services. They also asked for online booking that would largely replace their system of spreadsheets, phone calls and WhatsApp.
I chose to build the whole thing from scratch with Next.js, both to gain experience and to make sure everything was unique and tailored to Kazheh's needs.
The client's starting point. All the names and numbers of guests are generics in this page.
How it went
The project was initially planned to take around 45 days. Paperwork, photography, videography and a few unexpected twists during development stretched it to 65.
Week 1
Planning and first drafts
The first days went into drafting a rough plan, experimenting with the design and color palette, and building the first iteration of the navbar, homepage and footer.
First version of the homepage.
Weeks 2 to 3
Design and the rooms page
By this point the homepage was finished and the design approved, so I moved on to the rooms page. We decided to use the hotel's floor plan as an interactive element.
First version of the homepage.
Weeks 3 to 4
Building the guest side
Next came the calendar, which took longer than expected because it had to support both the Iranian solar and Gregorian calendars. I wasn't happy with the rooms page either, so I redid it, and the final version grew out of that second iteration. Each room's own page was also built during this stretch.
Weeks 4 to 6
Backend foundations
I set up the PostgreSQL database and split the backend into API endpoints and server actions. The guest side got further polish, and work on the admin panel began.
Weeks 6 to 8
Admin panel and content
Most of this stretch went into the admin panel's UI, with the API evolving alongside it. The staff needed a calendar that was always up to date and easy to use, plus pages for pricing, statistics, discounts, record keeping and more.
Week 8 to launch
Launch and handover
The final weeks went into testing, cleaning up the code, polishing the design, setting up the content, teaching the staff and testing again.
What I chose, and why
I made many decisions along the way. Here are a few of them.
Framework
ChosenNext.js
Next.js let me develop every layer of the stack quickly in one framework and offers modern features such as server actions. It also has a large developer community, so the client isn't dependent on any one developer.
Also considered: ASP.NET Core
Database
ChosenPostgreSQL
PostgreSQL was the right fit. A date-range exclusion constraint makes overlapping bookings for the same room impossible at the database level, with advisory locks serializing bookings per room on top of it, and our host supports it.
Also considered: SQLite
Hosting
ChosenLiara
The site needed to be fast both inside and outside Iran. Among the options, Liara offered the best balance of affordability, ease of use and useful features.
Also considered: Vercel, Hostiran
What got in the way
Many problems came up during development. Here a few who got me thinking up ideas.
Reservation state machine
The problem
A boutique hotel differs from larger hotels in scale and workflow, so a standard booking flow didn't fit. I had to design a state machine for reservations from scratch.
How I solved it
The diagram below shows how the state machine works.
A visual representation of the reservation state machine.
Dynamic data with server-side rendering
The problem
Once the calendars were hooked up to availability queries, Next.js began flagging their pages as dynamic, which slowed loading considerably.
How I solved it
Public pages are statically generated for speed, then invalidated on demand whenever a reservation or price changes. Each change also sends a PostgreSQL NOTIFY, which a single listener fans out to browsers over server-sent events, so availability and pricing update live without a page reload.
Moving the staff off Excel
The problem
The staff ran their reservations in Excel. I needed to port that workflow to the site so it would feel familiar, while being easier to use and better suited to the new system.
How I solved it
I built a spreadsheet-inspired component in the admin panel: infinitely scrollable, with colors representing reservation states.
Dynamic media
The problem
A month after launch, the client asked to update the images. I needed a way for media changes to happen without a developer or a redeploy.
How I solved it
I used the disk storage that comes free with Liara's plans instead of object storage, to keep maintenance costs down. Staff upload or replace content through the admin panel, and database tables keep track of which file belongs to which slot.
Parts worth a closer look
Here are a few pieces I'm proudest of.
Overview of the admin panel.
System
Admin panel
The admin panel is the hidden backbone of the site. Besides managing bookings and media, it lets staff adjust pricing, manage discounts, view charts of how the hotel is performing, and more.
Manages room prices and discounts
Blocks dates from booking at the staff's discretion
Manages the site's images and videos
Manages staff accounts and roles
Charts the hotel's performance
The admin calendar.
System
Admin calendar
A closer look on the component in the admin panel that replaced Excel for the staff.
An infinitely scrollable Iranian calendar
Color-coded reservation states and built-in tools for managing bookings
Includes many quality of life tools
The Rasht Map component
Component
Rasht map
A visual component on the homepage that shows the hotel's location.
A canvas rendering of Rasht's actual map
Thousands of heavily optimized paths, rendered smoothly while rotating
Points of interest for tourists, each with a description
What I learned
This was my first freelance project. I learned a lot, and I was glad to put what I'd studied into practice.
Planning the project
Looking back, I would plan each piece in more detail. The gallery page, for example, was an unplanned late addition, and better upfront scoping would have let me give a more accurate roadmap.
Fitting software to a client's business
I learned to study how a particular business operates and to find the best way to bring it into the digital world.
Solidifying my understanding of SSR vs CSR
After running into the dynamic data problem, I researched and experimented with several approaches. I now feel confident in how server-side and client-side rendering work.
Commercial work with databases
This was my first serious work with databases, so I had to learn more about SQL and PostgreSQL. I feel knowledgeable now, but I'm looking forward to learning more.
Overall, Kazheh means a lot to me as my first client project and one of the works I'm proudest of. The development process was interesting, I'm happy with how everything turned out, and I learned a lot that I'll keep building on.