Skip to content

RaniduNethma/HotCat-Backend

Repository files navigation

HotCat Logo

HotCat - Backend

Smart Orders, Happier Tables.

Welcome to the backend of the HotCat project!

What is HotCat?

HotCat is a restaurant management web application designed to streamline dining experiences. Built with a Node.js & Express backend, React frontend, and postgreSQL database, it enables smart order handling, menu management, and efficient customer–restaurant interactions. The goal is to deliver a seamless, tech-powered dining experience.

Prerequisites

Before you can start using this project, make sure you have the following installed on your local machine:

  • Node.js
  • npm
  • postgreSQL

Getting Started

Follow these steps to get started with the HotCat backend:

  1. Clone this repository to your local machine:

    git clone https://github.com/YOUR_USERNAME/HotCat-Backend.git
    cd HotCat-Backend
  2. Install the dependencies:

    npm install
  3. Copy .env.example file as .env:

    cp .env.example .env  #For Linux and macos
  4. Replace the environment variables in the newly created .env file with your configurations.

  5. Start the server:

    npm start
  6. Run Tests:

    npm test
  7. Open your web browser and navigate to http://localhost:${server_port} to access the running server.

Project Structure

Here's an overview of the project structure:

📦 HotCat-backend/
├── 📂 prisma/
│   ├── 📂 migrations/
│   │   └─ 📂 _init/
│   │      └─ 📄 migration.sql               # SQL file generated by Prisma containing initial database schema setup
│   └─ 📄 schema.prisma                      # Prisma schema defining database models, relations, and datasource
│   
├── 📂 src/
│   ├── 📂 configs/
│   │   ├── 📄 dbConfig.ts                   # Database connection setup using Prisma Client
│   │   ├── 📄 envConfig.ts                  # Loads and validates environment variables from `.env`
│   │   └── 📄 redisConfig.ts                # Govern the behavior of the redis server
│   │
│   ├── 📂 controllers/                      
│   │   ├── 📄 auth.controller.ts            # Handles authentication requests & responses
│   │   ├── 📄 category.controller.ts        # Handles product category related requests & responses
│   │   ├── 📄 order.controller.ts           # Handles order related requests & responses
│   │   ├── 📄 priceList.controller.ts       # Handles priceList related requests & responses
│   │   ├── 📄 product.controller.ts         # Handles product related requests & responses
│   │   └── 📄 table.controller.ts           # Handles table related requests & responses
│   │
│   ├── 📂 middlewares/
│   │   ├── 📄 auth.middleware.ts            # Verify JWT tokens and Authentication
│   │   ├── 📄 authorize.middleware.ts       # Authorization roles
│   │   └── 📄 validation.middleware.ts      # Verifying data integrity
│   │
│   ├── 📂 routes/
│   │   ├── 📄 auth.route.ts                 # Defines authentication endpoints
│   │   ├── 📄 category.route.ts             # Defines category related API endpoints
│   │   ├── 📄 order.route.ts                # Defines order related API endpoints
│   │   ├── 📄 priceList.route.ts            # Defines priceList related API endpoints
│   │   ├── 📄 product.route.ts              # Defines product related API endpoints
│   │   └── 📄 table.route.ts                # Defines table related API endpoints
│   │
│   ├── 📂 services/
│   │   ├── 📄 auth.services.ts              # Business logic for authentication and token generation
│   │   ├── 📄 category.services.ts          # Business logic for product category data operations
│   │   ├── 📄 order.services.ts             # Business logic for order data operations
│   │   ├── 📄 priceList.service.ts          # Business logic for price lists data operations
│   │   ├── 📄 product.service.ts            # Business logic for product data operations
│   │   └── 📄 table.services.ts             # Business logic for table data operations
│   │
│   ├── 📂 types/
│   │   ├── 📄 express.d.ts                  # Extends Express Request types for custom properties
│   │   └── 📄 types.ts                      # Defines reusable TypeScript interfaces and type aliases   
│   │
│   ├── 📂 utils/
│   │   └── 📄 jwt.util.ts                   # Creating and verifying JWT access/refresh tokens
│   │
│   ├── 📄 app.ts                            # Initializes Express app, applies middleware, and sets up routes
│   └── 📄 server.ts                         # Starts the server and listens on the configured port
│   
├── 📄 .env.example                          # Template of environment variables required for the project
├── 📄 .gitignore                            # Specifies files and folders to exclude from version control
├── 📄 .prettierignore                       # Lists files ignored by Prettier formatter
├── 📄 jest.config.ts                        # Configuration file for Jest testing framework
├── 📄 LICENSE                               # License information for the project (MIT)
├── 📄 package.json                          # Project metadata, scripts, and dependencies list
├── 📄 prisma.config.ts                      # Configuration file for prisma ORM
├── 📄 README.md                             # Project overview, setup guide, and documentation
└── 📄 tsconfig.json                         # TypeScript compiler configuration file

Releases

No releases published

Packages

 
 
 

Contributors