A Go-based backend service built with Echo framework and SQLite database.
- RESTful API endpoints
- Health check monitoring
- SQLite database with migrations
- Echo web framework
- Clean architecture pattern
- Live reloading with Air
- Go 1.22 or higher
- SQLite3
- Make (for build automation)
- Air (for live reloading)
.
├── .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
- Clone the repository:
git clone https://github.com/yourusername/home-fi-go.git
cd home-fi-go
- Copy
.env.example
to.env
and configure:
cp .env.example .env
- Install Air for live reloading (optional):
go install github.com/cosmtrek/air@latest
# Build the application
make build
# Run the application
make run
# Run tests
make test
# Live reload during development
make watch
Method | Endpoint | Description |
---|---|---|
GET | / | Hello world |
GET | /health | Health check |
Run the test suite:
make test