-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
113 lines (100 loc) · 3.36 KB
/
Makefile
File metadata and controls
113 lines (100 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
.PHONY: help install dev start stop restart clean logs db-up db-down backend frontend
help:
@echo "Smart Document Processing System - Make Commands"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " install Install all dependencies (Go modules + pnpm packages)"
@echo " dev Start database, backend, and frontend (development mode)"
@echo " start Start database, backend, and frontend"
@echo " stop Stop all running services"
@echo " restart Restart all services"
@echo " clean Stop services and clean up"
@echo " db-up Start only the database"
@echo " db-down Stop only the database"
@echo " backend Start only the backend server"
@echo " frontend Start only the frontend dev server"
@echo " logs Show logs from all running services"
@echo ""
install:
@echo "Installing Go dependencies..."
cd backend && go mod tidy
@echo "Installing pnpm dependencies..."
cd frontend && pnpm install
@echo "✓ Dependencies installed successfully"
dev: db-up
@echo "Starting Smart Document Processing System..."
@echo ""
@echo "Starting backend on http://localhost:8080"
@echo "Starting frontend on http://localhost:5173"
@echo "Database: PostgreSQL on localhost:5432"
@echo ""
@echo "Press Ctrl+C to stop all services"
@echo ""
ifeq ($(OS),Windows_NT)
@powershell -Command "Start-Process powershell -ArgumentList '-NoExit', '-Command', 'Set-Location backend; air'"
@cd frontend && pnpm dev
else
@cd backend && air & cd frontend && pnpm dev
endif
start: db-up
@echo "Starting Smart Document Processing System..."
@echo ""
@echo "Starting backend on http://localhost:8080"
@echo "Starting frontend on http://localhost:5173"
@echo "Database: PostgreSQL on localhost:5432"
@echo ""
@echo "Press Ctrl+C to stop all services"
@echo ""
ifeq ($(OS),Windows_NT)
@powershell -Command "Start-Process powershell -ArgumentList '-NoExit', '-Command', 'Set-Location backend; go run cmd/server/main.go'"
@cd frontend && pnpm dev
else
@cd backend && go run cmd/server/main.go & cd frontend && pnpm dev
endif
db-up:
@echo "Starting PostgreSQL database..."
cd backend && docker-compose up -d db
@echo "⏳ Waiting for database to be ready..."
ifeq ($(OS),Windows_NT)
@powershell -Command "Start-Sleep -Seconds 5"
else
@sleep 5
endif
@echo "✓ Database is ready"
db-down:
@echo "Stopping PostgreSQL database..."
cd backend && docker-compose down
@echo "✓ Database stopped"
backend:
@echo "Starting backend server on http://localhost:8080"
cd backend && go run cmd/server/main.go
frontend:
@echo "Starting frontend dev server on http://localhost:5173"
cd frontend && pnpm dev
stop:
@echo "Stopping all services..."
ifeq ($(OS),Windows_NT)
@powershell -Command "Get-Process | Where-Object {$$_.CommandLine -like '*air*' -or $$_.CommandLine -like '*pnpm*'} | Stop-Process -Force" 2>nul || true
else
@pkill -f "air" || true
@pkill -f "go run cmd/server/main.go" || true
@pkill -f "pnpm dev" || true
endif
cd backend && docker-compose down || true
@echo "✓ All services stopped"
restart: stop
ifeq ($(OS),Windows_NT)
@powershell -Command "Start-Sleep -Seconds 2"
else
@sleep 2
endif
@$(MAKE) start
clean: stop
@echo "Cleaning up..."
cd backend && docker-compose down -v || true
@echo "✓ Cleanup complete"
logs:
cd backend && docker-compose logs -f
.DEFAULT_GOAL := help