Skip to content

JobinBiju/Home-Fi-Go

Repository files navigation

Home-Fi Go

A Go-based backend service built with Echo framework and SQLite database.

Features

  • RESTful API endpoints
  • Health check monitoring
  • SQLite database with migrations
  • Echo web framework
  • Clean architecture pattern
  • Live reloading with Air

Prerequisites

  • Go 1.22 or higher
  • SQLite3
  • Make (for build automation)
  • Air (for live reloading)

Project Structure

.
├── .air.toml                # Configuration for live reloading with Air
├── .env                     # Environment variables
├── .env.example             # Example environment variables
├── .gitignore               # Git ignore rules
├── .vscode/                 # VSCode settings
│   └── settings.json
├── cmd/                     # Application entrypoints
│   └── api/
│       └── main.go          # Main entrypoint for the API
├── go.mod                   # Go module dependencies
├── go.sum                   # Go module checksums
├── internal/                # Private application code
│   ├── database/            # Database interface
│   │   └── database.go
│   ├── db/                  # Database models and migrations
│   │   ├── migrate_up.go
│   │   ├── migrations/      # SQL migration files
│   │   │   ├── 20241105085259_DeviceTable.down.sql
│   │   │   └── 20241105085259_DeviceTable.up.sql
│   │   ├── models/          # Generated database models
│   │   │   ├── db.go
│   │   │   ├── models.go
│   │   │   └── user.sql.go
│   │   └── queries/         # SQL query files
│   │       └── user.sql
│   ├── handler/             # HTTP handlers
│   └── server/              # HTTP server setup
│       ├── routes.go
│       └── server.go
├── Makefile                 # Build automation
├── README.md                # Project documentation
├── sqlc.yaml                # SQLC configuration
└── tests/                   # Integration tests
    └── handler_test.go

Getting Started

  1. Clone the repository:
git clone https://github.com/yourusername/home-fi-go.git
cd home-fi-go
  1. Copy .env.example to .env and configure:
cp .env.example .env
  1. Install Air for live reloading (optional):
go install github.com/cosmtrek/air@latest

Development

# Build the application
make build

# Run the application
make run

# Run tests
make test

# Live reload during development
make watch

API Endpoints

Method Endpoint Description
GET / Hello world
GET /health Health check

Testing

Run the test suite:

make test

About

Go backend for Home-Fi v2.

Topics

Resources

Stars

Watchers

Forks