This is a nifty MVP housing app. It's fully responsive and works on mobile devices.
src/routes
+page.svelte
(this is how it works in Kit)src/lib/components
$lib/components/Button.svelte
instead of ../../../../lib/components/Button.svelte
All of these are covered in Svelte docs.
useState
, it's because all variables (let
/var
) are reactive by default in Svelte components. This is a huge win for simplicity. You can read more about it here.useEffect
in React. EXAMPLEWhy isn't all data displayed on any home details page?
EXTRA
BEYOND MVP: About
There're a lot of things that can be done to improve the app, even without extending its functionality as per requirements. I did half of the things I wanted to do on the backend, but they're incomplete and never made it in. They were primarily done on the second day (frontend+mock without DB was done by the first, see commits & deploy in frontend-mock branch which only had sparse fixes). src/lib/gql/fauna/setup.fql
has incomplete/planned work, and none of it was used to setup the database. Only check if you're interested, but better to just let me explain them if you're curious and want to save time.
Backend resources not mentioned because they're not the focus of this MVP.
I opted not to because according to the scenario it is an MVP and when you're tight on time for such a simple thing, manual testing scenarios are typically the go-to. Plus there is no indication of the critical parts to test for. I would add tests if I had more time. Playwright for e2e or Svelte testing library (the React testing library equivalent for Svelte)
While the requirements were an MVP, it is decoupled, globally distributed/consistent, and could handle 10 million users, no sweat or maintenance required. Building on top of this base wouldn't be an issue, as there weren't any major shortcuts taken. However, a few things I would work on if I had more time and I knew I would be able to see it in production:
Unless–of course–more critical user features are demanded first. Some of these items are just nice-to-haves. You could think of it as a wishlist and I would prioritize them based on the business needs.
Once you've installed dependencies with npm install
(or pnpm install
or yarn
), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
Note that this project was built on Node v17. While Node v16 will work, it is not recommended as some things may not work as expected (e.g. seed script).
To create a production version of the app:
npm run build
After of which you can preview the production build with npm run preview
.
This specific app uses static adapter as it is frontend focused. There're fullstack adapters available as well. Check out the docs for more info.
The gist of it is: create a Fauna database and upload the schema in src/lib/gql/fauna/schema.gql
. Make a server key and then seed the database as per below.
To seed data, fill in your Fauna API key for const WRITE_KEY
in scripts/mock/seed.js
. Run npm run seed
. It uses Node experimental fetch
so you will need at least v17.5 to run it. It will seed the data in mock-homes.json
to the database.
Note: Some work has been done in the database for city search autocomplete and range price filtering queries. The queries are imperative and take a while to write/figure out but not to read. And everything needs to be tested to some degree (though quick as it's through shell). They aren't worth the time in an MVP, but I started work on them to get the technical groundwork for how it could be extended, thinking it would be viable if it was 90% done after the second day was over (I started backend work on that day). They never made it in but definitely lots of notes in this codebase (and lots of thoughts in my mind) to talk about.