Git Product home page Git Product logo

sps-homework's Introduction

SPS

A full stack real estate web application , whith NestJS, ReactJS and MongoDB

Features

  1. FE with react in Typescript

    • tailwind
    • login page with protected routes
    • real authentication using credentials and jwt
    • listing page with search bar (type in search bar a price/property type to filter the results on the screen)
    • Infinite scroll as pagination
    • auto logout after token expir
    • zustand state management
  2. BE with nestJS in Typescript

    • authentication using JWT
    • REST API routes and guarded routes
    • Connection on online MondoDB
  3. Mongo db

    • local DB using docker
    • remote DB with Atlas

Left over

  1. I used RESTApi instead of graphQL
  2. Adding load indicator while fetching data
  3. Better manage http request to avoid redundants requests

Reasons Behind Technical Choices

  1. I invest a lot of time searching some houses pictures and host them online somewhere, and DB is hosted in Atlas in free account (only one user connection allowed)
  2. Password is not encrypted, I passed it as clear text in the API, thing that I won't do in Prod level, this is a shortcut for the demo.
  3. No cache management and ahead of time pictures loading
  4. I did some shortcut in FE implementation in sync. between FE and BE (I would have use something most robust like Redux toolKit or TanStack Query for Production level project...)

Installation

local Mongo

  1. docker pull mongo:latest
  2. docker run -d --name mongodb_sps -p 27017:27017 mongo
  3. docker ps
  4. docker exec –it mongodb mongosh [can use container_id instead of mongodb]
  5. db.runCommand({hello:1})
  6. copy both json file into the container to allow populating the db
  7. docker cp ./mongo/users.sps.json mongodb:/tmp/users.sps.json [can use container_id instead of mongodb]
  8. docker cp ./mongo/properties.sps.json mongodb:/tmp/properties.sps.json [can use container_id instead of mongodb]
  9. docker exec -it mongodb bash [can use container_id instead of mongodb]
  10. mongoimport --db sps --collection users --file /tmp/users.sps.json --jsonArray
  11. mongoimport --db sps --collection properties --file /tmp/properties.sps.json --jsonArray

Online mongo

  1. I use the free plan of mongo atlas which allows only one IP, -->so please send me your IP<-- to allow connection to the DB

FE

  1. make sure you run with node 18 and above
  2. git clone [email protected]:ah584d/sps-homework.git
  3. cd fe
  4. npm ci
  5. npm run dev
  6. open "http://localhost:5173/"

BE

  1. cd be
  2. npm ci
  3. npm run start:dev

REST API routes

non protected routes

  1. POST http://localhost:3001/auth/login
  2. POST http://localhost:3001/property
  3. POST http://localhost:3001/user

protected routes

  1. GET http://localhost:3001/user
  2. GET http://localhost:3001/user/:id
  3. GET http://localhost:3001/user/email/:email
  4. GET http://localhost:3001/property
  5. GET http://localhost:3001/property/:id>
  6. GET http://localhost:3001/property/user/:id/:pageIndex
  7. PUT http://localhost:3001/property/:id

Users for demo

  1. [email protected]/my_pass
  2. [email protected]/my_pass
  3. [email protected]/my_pass
  4. [email protected]/my_pass

Screenshots

sps-homework's People

Contributors

ah584d avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.