Skip to content

FANIMAN/go-hfinder-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# HomeFinder AI Backend

HomeFinder Backend is a RESTful API built with Go (Golang) and Gin that powers a home rental and reservation platform.  
It handles user authentication, home listings, reservations, and owner approvals, with a foundation ready for AI/ML-powered features.

---

## Features

- User authentication (Register & Login)
- Home listing management (CRUD)
- Reservation system
- Owner approval flow for reservations
- AI/ML-ready architecture (for smart recommendations and decision support)
- Clean MVC-style project structure
- Fast and lightweight API using Gin

---

## AI / ML Capabilities 

This backend is designed to support AI/ML-driven functionalities, such as:

- Smart home recommendations based on user behavior
- Demand and availability prediction
- Dynamic pricing suggestions
- Reservation approval insights for owners

> While the current version focuses on core functionality, the architecture allows seamless integration of AI/ML models and services.

---

## Tech Stack

- **Language:** Go (Golang)
- **Web Framework:** Gin
- **Database:** PostgreSQL
- **Database Driver:** pgx / pgxpool
- **Authentication:** JWT-based middleware
- **AI/ML:** Model-based recommendations and analytics (planned)

---

## Project Structure

home-finder-backend/ ├── controllers # Request handlers (business logic) │ ├── home.go │ ├── reservation.go │ └── user.go ├── db # Database connection and configuration │ └── db.go ├── middleware # Authentication and role-based access control │ ├── auth.go │ └── owner.go ├── models # Data models │ ├── home.go │ ├── reservation.go │ └── user.go ├── routes # API routes │ └── routes.go ├── main.go # Application entry point ├── go.mod ├── go.sum ├── reflex.conf # Development hot-reload config └── runner.conf


---

## API Endpoints

### Authentication

| Method | Endpoint    | Description         |
|------|-------------|---------------------|
| POST | `/register` | Register a new user |
| POST | `/login`    | Login user          |

### Homes

| Method | Endpoint           | Description       |
|------|--------------------|-------------------|
| GET  | `/homes`           | Get all homes     |
| GET  | `/homes/:home_id`  | Get home by ID    |
| POST | `/homes`           | Create a home     |
| PUT  | `/homes/:home_id`  | Update a home     |
| DELETE | `/homes/:home_id` | Delete a home     |

### Reservations

| Method | Endpoint                                                   | Description            |
|------|------------------------------------------------------------|------------------------|
| POST | `/reservations`                                           | Create a reservation  |
| PUT  | `/reservations/:home_id/:reservation_id/approve`           | Approve reservation   |

---

## Running the Project

### Prerequisites

- Go 1.20+
- A running PostgreSQL database
- `DATABASE_URL` environment variable set

### Start the server

```bash
go run main.go

The server will start on:

http://localhost:8080

Middleware

  • Auth Middleware: JWT-based authentication
  • Owner Middleware: Ensures only home owners can approve or manage reservations

Development Notes

  • Runs in Gin debug mode by default Switch to production mode:

    export GIN_MODE=release
  • Hot reload supported via reflex.conf


Future Improvements

  • ML-based pricing optimization
  • Personalized home recommendations
  • Advanced search and filtering
  • Analytics and insights dashboard

About

Go backend for a home rental platform with authentication, reservations, and AI-ready architecture

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages