PropertyLah is clone of PropertyGuru, the most popular real estate portal in Singapore.
This purpose of this project is build a backend API to demonstrate the following:
- Structure backend code with N-Tier Architecture
- Implement API using Express
- Implement ORM using Sequelize
- Implement one middleware as a group
- Connect ORM to PostgresSQL database and map objects to tables
- Deploy to Heroku
- Each learner to implement at least one API endpoint
The project uses N-Tier Architecture and the base files and folder structure are as follows:
|- controllers
| |- answerController.js
| |- articleController.js
| |- propertyController.js
| |- questionController.js
| |- userController.js
|- routes
| |- answerRoute.js
| |- articleRoute.js
| |- propertyRoute.js
| |- questionRoute.js
| |- userRoute.js
|- models
| |- answerModel.js
| |- articleModel.js
| |- propertyModel.js
| |- questionModel.js
| |- userModel.js
|- services
| |- answerService.js
| |- articleService.js
| |- propertyService.js
| |- questionService.js
| |- userService.js
|- node_modules
|- app.js
|- server.js
|- config.env
Enviroment variables are configured in config.env.
To start in dev environment
npm run
Prod Environment
npm run start:prod
dev environment will sync sequelize models to SQL tables before starting the server. The correspondng DB username and password will also be used, depending on the env.
To be updated.
Production and Development DB Name: propertylah_db
All table names to use lowercase, singular nouns e.g. user
, property
, etc.
All field names to use snake case and lowercase e.g. first_name
, last_name
, etc.
All primary keys to be named id
to prevent ambiguity.
All foreign keys to named relative to the table being referenced e.g. an answer referencing a question should have the foreign key question_id
Routes have already been configured in the respective routes files. You can proceed to add more endpoints if needed.
POST /api/v1/users/
GET /api/v1/users/:id
GET /api/v1/users
PATCH /api/v1/users/:id
DELETE /api/v1/users/:id
POST /api/v1/users/signup
POST /api/v1/users/login
PATCH /api/v1/users/updatePassword
POST /api/v1/users/logout
POST /api/v1/properties/
GET /api/v1/properties/:id
GET /api/v1/properties
PATCH /api/v1/properties/:id
DELETE /api/v1/properties/:id
POST /api/v1/questions/
GET /api/v1/questions/:id
GET /api/v1/questions
PATCH /api/v1/questions/:id
DELETE /api/v1/questions/:id
POST /api/v1/answers/
GET /api/v1/answers/:id
GET /api/v1/answers
PATCH /api/v1/answers/:id
DELETE /api/v1/answers/:id
POST /api/v1/articles/
GET /api/v1/articles/:id
GET /api/v1/articles
PATCH /api/v1/articles/:id
DELETE /api/v1/articles/:id
- Create a new branch from master, or fork the master repo.
- Do a PR when completed.
- Note: remember to pull latest code before doing a PR
For more info: https://www.atlassian.com/continuous-delivery/continuous-integration/trunk-based-development
To implement unit tests using Jest.
To implement logging using winston logger.
To add security middleware
To be implemented using Github actions