Skip to content

Commit 1e29b2f

Browse files
authored
Merge pull request #3 from KunalKumar-1/makefile
feat: added makefile
2 parents db4f116 + f855ff2 commit 1e29b2f

File tree

3 files changed

+129
-1
lines changed

3 files changed

+129
-1
lines changed

.air.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ tmp_dir = "tmp"
2828
stop_on_error = false
2929

3030
[color]
31-
app = ""
31+
app = "cyan"
3232
build = "yellow"
3333
main = "magenta"
3434
runner = "green"

Makefile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
.PHONY: help install deps migrate up down dev run build clean test
2+
3+
help: ## Show this help message
4+
@echo 'Usage: make [target]'
5+
@echo ''
6+
@echo 'Available targets:'
7+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
8+
9+
install: ## Install Go dependencies
10+
go mod download
11+
go mod tidy
12+
13+
deps: install ## Alias for install
14+
15+
migrate-up: ## Run database migrations
16+
@echo "Running migrations..."
17+
go run cmd/migrate/main.go up
18+
19+
migrate-down: ## Rollback database migrations
20+
@echo "Rolling back migrations..."
21+
go run cmd/migrate/main.go down
22+
23+
dev: ## Start development server with Air
24+
@echo "Starting development server with Air..."
25+
air
26+
27+
run: ## Run the application
28+
@echo "Starting application..."
29+
go run cmd/api/main.go
30+
31+
build: ## Build the application
32+
@echo "Building application..."
33+
go build -o bin/api cmd/api/main.go
34+
35+
clean: ## Clean build artifacts
36+
@echo "Cleaning..."
37+
rm -rf tmp/
38+
rm -rf bin/
39+
go clean
40+
41+
test: ## Run tests
42+
@echo "Running tests..."
43+
go test -v ./...
44+
45+
.DEFAULT_GOAL := help

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Evently - Event Management API
2+
3+
A Go-based event management API built with Gin, SQLite, and JWT authentication.
4+
5+
## Prerequisites
6+
7+
- Go 1.24.5 or higher
8+
- Air (for live reload during development)
9+
- SQLite3
10+
11+
## Getting Started
12+
13+
### 1. Install Dependencies
14+
15+
```bash
16+
# Install Go dependencies
17+
go mod download
18+
19+
# Install Air (optional but recommended for development)
20+
go install github.com/cosmtrek/air@latest
21+
```
22+
23+
### 2. Environment Setup
24+
25+
Create a `.env` file in the root directory:
26+
27+
```env
28+
PORT=8080
29+
JWT_SECRET=your-secret-key-here
30+
DATABASE_URL=./data.db
31+
```
32+
33+
### 3. Run Database Migrations
34+
35+
```bash
36+
go run cmd/migrate/main.go up
37+
```
38+
39+
### 4. Run the Application
40+
41+
**Option A: Using Air (Recommended for Development)**
42+
43+
```bash
44+
air
45+
```
46+
47+
**Option B: Using Go directly**
48+
49+
```bash
50+
go run cmd/api/main.go
51+
```
52+
53+
The API will be available at `http://localhost:8080`
54+
55+
## Project Structure
56+
57+
```
58+
.
59+
├── cmd/
60+
│ ├── api/ # Main API application
61+
│ └── migrate/ # Database migrations
62+
├── internals/
63+
│ ├── database/ # Database models and queries
64+
│ └── env/ # Environment configuration
65+
├── server/ # Server configurations
66+
├── data.db # SQLite database
67+
├── .air.toml # Air configuration
68+
└── go.mod # Go modules
69+
70+
```
71+
72+
## API Endpoints
73+
74+
- Authentication endpoints
75+
- Event management endpoints
76+
77+
## Development
78+
79+
The project uses Air for live reload during development. Any changes to `.go` files will automatically rebuild and restart the server.
80+
81+
## License
82+
83+
MIT

0 commit comments

Comments
 (0)