Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zmekonnen251/property-manegament-backend

This project is the backend part of the Property Management System. It provides a comprehensive API for managing property operations, such as room reservations, user management, and property details. Built with Express.js and PostgreSQL, this API serves as the backbone of the property management platform, ensuring efficient data handling, security,
https://github.com/zmekonnen251/property-manegament-backend

api authentication authorization exressjs javascript jwt postgr rest-api squel

Last synced: 1 day ago
JSON representation

This project is the backend part of the Property Management System. It provides a comprehensive API for managing property operations, such as room reservations, user management, and property details. Built with Express.js and PostgreSQL, this API serves as the backbone of the property management platform, ensuring efficient data handling, security,

Awesome Lists containing this project

README

        

# Property Management Website API

This project is the **backend** part of the Property Management System. It provides a comprehensive API for managing property operations, such as room reservations, user management, and property details. Built with **Express.js** and **PostgreSQL**, this API serves as the backbone of the property management platform, ensuring efficient data handling, security, and scalability.

## Features

- **User Authentication & Authorization**: Role-based access control using JWT.
- **Room Reservation System**: Manage room availability and bookings.
- **Property Management**: Support for managing multiple properties.
- **File Upload**: Handle image uploads for rooms and users using **Cloudinary** and **Multer**.
- **Automated Scheduling**: Task scheduling with **node-schedule**.
- **PDF Reporting**: Generate PDFs for invoices, reports, etc., using **jsPDF**.
- **Email Notifications**: Send notifications with **EmailJS**.
- **Logging**: Centralized logging using **Winston** with daily log rotation.

## Tech Stack

- **Express.js**: Backend framework for building the API.
- **PostgreSQL**: Relational database for storing data.
- **Sequelize**: ORM for database interactions.
- **JWT**: For user authentication and authorization.
- **Cloudinary**: For image storage and management.
- **Multer**: For handling file uploads.

## Installation

To run the backend API locally:

1. **Clone the repository**:

```bash
git clone https://github.com/zmekonnen251/property-mangement-website-api.git
```
2. **Navigate to the project directory**:

```bash
cd property-mangement-website-api
```
3. **Install the dependencies**:

```bash
npm install
```
4. **Create a `.env` file** in the root directory with the following:

```bash
PORT=5000
DATABASE_URL=your_postgres_database_url
JWT_SECRET=your_jwt_secret
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
```
5. **Run database migrations and seed the database**:

```bash
npm run seedDb
```
6. **Start the server**:

```bash
npm run dev
```
The API will be running at `http://localhost:5000`.

## Available Scripts

- `npm start`: Start the production server.
- `npm run dev`: Start the development server using nodemon.
- `npm run lint`: Lint the code using ESLint.
- `npm run format`: Format the code using Prettier.
- `npm run lint:fix`: Fix linting errors automatically.
- `npm run seedDb`: Seed the database with sample data.

## Folder Structure

```bash
property-mangement-website-api/
├── config/ # Configuration files (e.g., database, cloudinary)
├── controllers/ # API route controllers
├── models/ # Sequelize models and database schema
├── routes/ # Express route definitions
├── middlewares/ # Express middlewares (auth, error handling)
├── services/ # Business logic and helper functions
├── utils/ # Utility functions (e.g., error handling, logging)
├── server.js # Main server file
└── .env # Environment variables
```

## Key Dependencies

- **Express.js**: ^4.18.2
- **Sequelize**: ^6.32.1
- **pg (PostgreSQL)**: ^8.12.0
- **bcryptjs**: For password hashing.
- **jsonwebtoken**: For user authentication.
- **Cloudinary**: For image upload and storage.
- **Winston**: For logging with daily rotation.
- **Multer**: For file uploads.

## Database Setup

This project uses PostgreSQL as the database. Ensure that PostgreSQL is installed and running. Update the `.env` file with your database URL.

```bash
DATABASE_URL=your_postgres_database_url
```
Migrations are handled via `sequelize-cli`.

```bash
npx sequelize-cli db:migrate
```
## Code Quality

- **ESLint**: Linting with Airbnb's style guide.
- **Prettier**: Code formatting for consistency.

To run the linter:

```bash
npm run lint
```
To format the code:

```bash
npm run format
```
## License

This project is licensed under the [ISC License](https://opensource.org/licenses/ISC).

## Acknowledgements

- [Express.js](https://expressjs.com/)
- [Sequelize](https://sequelize.org/)
- [PostgreSQL](https://www.postgresql.org/)
- [JWT](https://jwt.io/)
- [Cloudinary](https://cloudinary.com/)
- [Multer](https://www.npmjs.com/package/multer)
- [Winston](
https://www.npmjs.com/package/winston)
- [EmailJS](https://www.emailjs.com/)
- [jsPDF](https://www.npmjs.com/package/jspdf)
- [node-schedule](https://www.npmjs.com/package/node-schedule)

## Contact
Zelalem Mekonnen
- [Email](mailto:[email protected])
- [LinkedIn](https://www.linkedin.com/in/zelalem-g-mekonnen)
- [Portfolio](https://zmekonnen251.github.io)