Glofox is a SaaS platform for boutique fitness studios, gyms, and wellness centers that allows owners to manage their classes and bookings efficiently.
- Create and manage fitness classes
- Set class capacity, start date, and end date
- Retrieve class details and listings
- Create bookings for members
- Book specific classes or general appointments
- View bookings by date or ID
- Go 1.23 or higher
- Git
- Clone the repository
git clone https://github.com/sanjaykishor/Glofox.git
cd Glofox- Install dependencies
go mod download# Run the application
go run ./cmd/glofox/main.go# Build the application
make build
# Run the application
make run# Build the Docker image
docker build -t glofox .
# Run the container
docker run -p 8080:8080 glofoxThe API server runs on port 8080 by default.
http://localhost:8080/api/v1
- URL:
/classes - Method:
POST - Request Body:
{
"name": "Yoga Class",
"start_date": "2025-04-25",
"end_date": "2025-04-26",
"capacity": 15
}- Success Response (201 Created):
{
"success": true,
"message": "Class created successfully",
"data": {
"id": "c0e3bcde-1d22-4c7b-a788-15c8f815b35d",
"name": "Yoga Class",
"start_date": "2025-04-25T00:00:00Z",
"end_date": "2025-04-26T00:00:00Z",
"capacity": 15
}
}- Error Response (400 Bad Request):
{
"success": false,
"error": "invalid start date format, use YYYY-MM-DD"
}- URL:
/classes - Method:
GET - Success Response (200 OK):
{
"success": true,
"data": [
{
"id": "c0e3bcde-1d22-4c7b-a788-15c8f815b35d",
"name": "Yoga Class",
"start_date": "2025-04-25T00:00:00Z",
"end_date": "2025-04-26T00:00:00Z",
"capacity": 15
},
{
"id": "f8a9d724-5c31-4b9d-8c0e-7d45d0aab123",
"name": "HIIT Training",
"start_date": "2025-04-26T00:00:00Z",
"end_date": "2025-04-27T00:00:00Z",
"capacity": 10
}
]
}- URL:
/classes/:id - Method:
GET - Success Response (200 OK):
{
"success": true,
"data": {
"id": "c0e3bcde-1d22-4c7b-a788-15c8f815b35d",
"name": "Yoga Class",
"start_date": "2025-04-25T00:00:00Z",
"end_date": "2025-04-26T00:00:00Z",
"capacity": 15
}
}- Error Response (404 Not Found):
{
"success": false,
"error": "class not found"
}- URL:
/bookings - Method:
POST - Request Body:
{
"name": "USER A",
"date": "2025-04-25",
"class_id": "c0e3bcde-1d22-4c7b-a788-15c8f815b35d"
}- Success Response (201 Created):
{
"success": true,
"message": "Booking created successfully",
"data": {
"id": "d7a8e931-2b41-5f6c-9d0e-8f12a3b45c67",
"member_name": "USER A",
"class_id": "c0e3bcde-1d22-4c7b-a788-15c8f815b35d",
"date": "2025-04-25T00:00:00Z",
"created_at": "2025-04-24T14:30:45Z"
}
}- Error Response (400 Bad Request):
{
"success": false,
"error": "invalid date format, use YYYY-MM-DD"
}- URL:
/bookings - Method:
GET - Success Response (200 OK):
{
"success": true,
"data": [
{
"id": "d7a8e931-2b41-5f6c-9d0e-8f12a3b45c67",
"member_name": "USER A",
"class_id": "c0e3bcde-1d22-4c7b-a788-15c8f815b35d",
"date": "2025-04-25T00:00:00Z",
"created_at": "2025-04-24T14:30:45Z"
},
{
"id": "e8b9f042-3c52-6d7e-0e1f-9g23b4c56d78",
"member_name": "Jane Smith",
"class_id": "f8a9d724-5c31-4b9d-8c0e-7d45d0aab123",
"date": "2025-04-25T00:00:00Z",
"created_at": "2025-04-24T15:45:12Z"
}
]
}- URL:
/bookings/:id - Method:
GET - Success Response (200 OK):
{
"success": true,
"data": {
"id": "d7a8e931-2b41-5f6c-9d0e-8f12a3b45c67",
"member_name": "USER A",
"class_id": "c0e3bcde-1d22-4c7b-a788-15c8f815b35d",
"date": "2025-04-25T00:00:00Z",
"created_at": "2025-04-24T14:30:45Z"
}
}- Error Response (404 Not Found):
{
"success": false,
"error": "booking not found"
}- URL:
/bookings/date/:date - Method:
GET - URL Example:
/bookings/date/2025-04-15 - Success Response (200 OK):
{
"success": true,
"data": [
{
"id": "d7a8e931-2b41-5f6c-9d0e-8f12a3b45c67",
"member_name": "USER A",
"class_id": "c0e3bcde-1d22-4c7b-a788-15c8f815b35d",
"date": "2025-04-25T00:00:00Z",
"created_at": "2025-04-24T14:30:45Z"
},
{
"id": "f9c0e143-4d65-7g86-1h2i-3j45k6l78m90",
"member_name": "USER B",
"class_id": "a1b2c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p",
"date": "2025-04-25T00:00:00Z",
"created_at": "2025-04-24T09:15:30Z"
}
]
}- Error Response (400 Bad Request):
{
"success": false,
"error": "invalid date format, use YYYY-MM-DD"
}# Run all tests
go test ./...
# Run with verbose output
go test -v ./...Glofox/
├── cmd/
│ └── glofox/ # Application entry point
├── internal/
│ ├── handler/ # HTTP handlers
│ ├── middleware/ # HTTP middleware
│ ├── repository/ # Data access layer
│ ├── router/ # HTTP router setup
│ ├── validation/ # Validation logic
│ └── service/ # Business logic
├── bin/ # Compiled binaries
├── Dockerfile # Docker build configuration
├── Makefile # Build automation
├── go.mod # Go module definition
└── README.md # Documentation
This project is licensed under the MIT License.