Skip to content
mbonetePublic

About

Long-term rentals in Spain, listed by their owners. Next.js Server Actions, SQLite, Drizzle, Auth.js.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Doorplate

Long-term rentals in Spain, posted by the people who own them. Renters search by city, rent, bedrooms and size, and write to the owner directly; owners list a flat with photos and read the enquiries they get. No agency in between.

Built with Next.js 16 (App Router, Server Components, Server Actions), SQLite + Drizzle, Auth.js and Tailwind + Radix (shadcn/ui). Formerly called Homely.

What it does

  • Browse and filter: city, maximum rent, minimum bedrooms and floor area, sorted by newest, rent or size. Filters live in the URL, so every search can be bookmarked or shared and works without JavaScript.
  • Listing page: rent, bedrooms, bathrooms and m² before the description; photo grid with an all-photos viewer.
  • Enquiries: a renter writes to the owner (name, email, move-in date, message) without an account. The owner reads them per listing and replies from their own email.
  • Saved flats for signed-in users, and Share (the phone's share sheet, or copy link on desktop).
  • Owners create, edit and delete listings with multiple photos.

Getting started

npm install
cp .env.example .env.local   # then set your own AUTH_SECRET
npm run db:migrate
npm run db:seed              # 8 demo listings, 4 enquiries, one demo owner
npm run dev

Open http://localhost:3000 and log in as the demo owner, Lucía Ferrer:

  • email: demo@example.com
  • password: doorplate-demo

She owns two listings with enquiries waiting, and has two flats saved.

Scripts

Command What it does
npm run dev Development server on :3000
npm run build Production build
npm run start Serve the production build
npm run db:generate Generate a Drizzle migration from db/schema.js
npm run db:migrate Apply pending migrations to data/doorplate.db
npm run db:seed Wipe the data and load the demo listings
npm run db:studio Browse the database in Drizzle Studio

To start from scratch: rm -rf data && npm run db:migrate && npm run db:seed.

How it's built

app/
├── page.jsx                  # Landing: search + newest listings
├── ads/page.jsx              # Browse with filters (URL search params)
├── ads/[id]/                 # Listing page, edit form, owner's enquiries
├── adform/                   # New listing (signed in)
├── saved/                    # Saved flats (signed in)
├── users/[id]/               # Account and "My listings"
├── uploads/[file]/route.js   # Serves owner photo uploads from data/uploads
└── login/, signup/
components/                   # Listing card, photo grid, enquiry form, forms, UI primitives
db/
├── schema.js                 # users, ads, ad_images, enquiries, saved_ads
├── migrations/               # Generated SQL
└── seed.js                   # Demo data
lib/
├── ads.js                    # Queries for Server Components
├── actions/                  # Server Actions: listings, enquiries, saved, auth
└── format.js                 # Rent, dates, fact lines
proxy.js                      # Route protection (Auth.js)
  • Reads: Server Components query SQLite through Drizzle (lib/ads.js). No client-side data fetching.
  • Writes: Server Actions validate with Zod and check ownership on the server. Forms keep what you typed when validation fails.
  • Auth: Auth.js Credentials provider, bcrypt-hashed passwords, JWT session cookie. proxy.js protects posting, editing, enquiries, saved flats and account pages, and sends visitors back where they were after logging in.
  • Photos: owner uploads are stored in data/uploads/ (next to the database, gitignored) and served by a route handler, because Next.js only serves files that were in public/ at build time. Demo photos ship in public/listings/. Both go through next/image.

SQLite and photos on local disk mean Doorplate runs on one server with a persistent disk (a VPS or a container with a volume), not on serverless hosting.

Running it on a server

The Dockerfile and compose.yaml run Doorplate on one server.

cp .env.example .env.production   # then set your own AUTH_SECRET, and DEMO=true for a public demo
docker compose up -d --build
docker compose exec doorplate node db/seed.js   # demo data

The container applies new migrations when it starts. It listens on 127.0.0.1:3000 only, so it sits behind a reverse proxy such as nginx. A listing form can carry up to 40 MB of photos, so the proxy's body size limit has to allow that (client_max_body_size 40m in nginx). The database and uploaded photos live in the data volume, which survives rebuilds. To update, git pull && docker compose up -d --build.

Running the seed again resets everything, uploaded photos included, so a public demo can be reset on a schedule.

Photos

Demo photos are real photographs from Unsplash, used under the Unsplash License; see docs/PHOTO-CREDITS.md. They don't show the places named in the listings: titles, owners, addresses and prices are demo data.

About

Long-term rentals in Spain, listed by their owners. Next.js Server Actions, SQLite, Drizzle, Auth.js.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages