This is the backend for the scrapper_zameen application. It provides RESTful APIs to support the frontend application and manages the core business logic and data storage.
These instructions will help you set up and run the backend project on your local machine for development and testing purposes.
Make sure you have the following software installed on your machine:
- Clone the repository to your local machine:
git clone https://github.com/Muhammad-Abdullah012/scrapper_zameen_backend.git
cd scrapper_zameen_backend
- Install the project dependencies using pnpm:
pnpm install
- Create a .env file in the root directory of the project and configure your environment variables. You can use the .env.example file as a template:
cp .env.example .env
- Edit the .env file and provide the necessary configuration values.
To start the project in development mode, run the following command:
pnpm dev
The server will start using the port specified in your .env file. By default, you can access it at http://localhost:5000 if PORT
is set to 5000 in .env
file.
To run the tests, use the following command:
pnpm test
You can also run the project using Docker and Docker Compose.
You'll need to clone and run the following projects (if using docker):
To build and start the Docker containers in development mode, run the following command:
pnpm deploy:dev
This command is defined in the package.json file and uses Docker Compose to build and start the containers.
To stop the Docker containers, use the following command:
docker compose down
The API documentation is available via Swagger. Once the server is running, you can access the Swagger UI at:
### If server is running on port 5000 (depends on PORT in .env)
http://localhost:5000/api-docs
Here is a brief overview of the project's folder structure:
│
├──📂 .vscode
│ ├── launch.json
│ └── settings.json
|
|──📂 migrations
| └── migraion-files
│
├──📂 src
│ ├──📂 config
│ │ |── index.ts
| | |── config.js
| | └── sequelize.ts
│ │
│ ├──📂 controllers
│ │ ├── auth.controller.ts
| | ├── property.controller.ts
│ │ └── users.controller.ts
│ │
│ ├──📂 dtos
│ │ └── users.dto.ts
│ │
│ ├──📂 exceptions
│ │ └── HttpException.ts
│ │
│ ├──📂 http
│ │ ├── auth.http
│ │ └── users.http
│ │
│ ├──📂 interfaces
│ │ ├── auth.interface.ts
│ │ ├── routes.interface.ts
│ │ └── users.interface.ts
│ │
│ ├──📂 middlewares
│ │ ├── auth.middleware.ts
│ │ ├── error.middleware.ts
| | ├── pagination.middleware.ts
│ │ └── validation.middleware.ts
│ │
│ ├──📂 models
│ │ └── users.model.ts
│ │
│ ├──📂 routes
│ │ ├── auth.route.ts
| | ├── property.route.ts
│ │ └── users.route.ts
│ │
│ ├──📂 services
│ │ ├── auth.service.ts
| | ├── property.service.ts
│ │ └── users.service.ts
│ │
│ ├──📂 test
│ │ ├── auth.test.ts
| | ├── property.test.ts
│ │ └── users.test.ts
│ │
│ ├──📂 utils
│ │ ├── logger.ts
│ │ └── vaildateEnv.ts
│ │
│ ├── app.ts
│ └── server.ts
│
├── .dockerignore
├── .editorconfig
├── .env.development.local
├── .env.production.local
├── .env.test.local
├── .eslintignore
├── .eslintrc
├── .gitignore
├── .huskyrc
├── .lintstagedrc.json
├── .prettierrc
├── .swcrc
├── docker-compose.yml
├── Dockerfile.dev
├── Dockerfile.prod
├── ecosystem.config.js
├── jest.config.js
├── Makefile
├── nginx.conf
├── nodemon.json
├── package-lock.json
├── package.json
├── swagger.yaml
└── tsconfig.json