Skip to content

igidio/bdi-backend

Repository files navigation

bdi-backend

A robust backend system designed for the management and administration of cemetery spaces. This project was developed as a technical proof of concept to demonstrate scalable architecture in managing spatial inventories, reservations, and user assignments within a defined sector/park structure.

Features

  • Structural Management: Define and organize cemetery layouts through Parks and Sectors (Heads).
  • Space Inventory (Details): Granular control over individual spaces (graves/niches) including coordinates (row/column), pricing, and types (Border, Center, Path).
  • Status Tracking: Real-time status management for every space (Available, Sold, Reserved, Not Available).
  • Reservation System: Logic to link users to specific spaces, handling availability checks and assignment.
  • User Management: Basic structure for managing client data.
  • Modular Architecture: Built with NestJS modules for high maintainability and separation of concerns.

Technologies Used

  • Framework: NestJS (Node.js)
  • Language: TypeScript
  • Database: PostgreSQL
  • ORM: TypeORM
  • Containerization: Docker & Docker Compose
  • Package Manager: NPM

    Note: Please check package.json for the full list of dependencies.

Getting Started

Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Node.js (v16 or higher)
  • npm (v9 or higher)
  • Docker & Docker Compose (for the database) (Optional)

Installation

  1. Clone the repository:

    git clone https://github.com/igidio/bdi-backend.git
    cd bdi-backend
    
  2. Install the dependencies:

    npm install
  3. Environment Configuration: Rename the template environment file and configure your variables:

    cp .template.env .env
  4. Database Setup: If you have Docker installed, configure the file 📄 docker-compose.yaml with the appropriate settings for your PostgreSQL instance. Then, run the following command to start the PostgreSQL database:

    docker-compose up -d
  5. Run Database Migrations and Seeds: Ensure your database is running and execute the migrations and seeds to set up the schema:

    # Run TypeORM migrations
    npm run typeorm:generate
    # Run seeders to populate initial data
    npm run seed:fresh
  6. Start the Application:

    npm run start:dev

If everything is set up correctly, the application should now be running on http://localhost:3000.

Extra: if you want to use husky for git hooks and commit lints, run:

npx husky init

Project Structure

  • 📁 src/
    • 📁 head/: Manages the macro structure (Parks/Sectors).
    • 📁 detail/: Manages individual units/spaces and their coordinates.
    • 📁 reservation/: Handles the logic for booking spaces.
    • 📁 user/: User entity management.
    • 📁 database/: Database configuration and connection logic.

Scripts

  • npm run start:dev: Start the application in development mode with hot-reloading.
  • npm run build: Compile the TypeScript code into JavaScript.
  • npm run typeorm:generate: Generate database migrations based on entity changes.
  • npm run typeorm:migrate: Run pending migrations to update the database schema.
  • npm run typeorm:drop: Drop the database schema (use with caution).
  • npm run seed:fresh: Run seeders to populate the database with initial data.
  • npm run seed: Run seeders without dropping the database.

License

This project is licensed under the MIT License - see the 📄LICENSE.md file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published