-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
100 lines (80 loc) · 3.36 KB
/
Makefile
File metadata and controls
100 lines (80 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
.PHONY: help install install-frontend install-backend install-cli \
build run dev migrate setup-env lint test \
deploy-railway deploy-railway-init deploy-railway-sync-env
# Default target
help:
@echo "Data Talks - Available commands:"
@echo ""
@echo " make install Install frontend and backend dependencies"
@echo " make install-frontend Install frontend (npm) dependencies"
@echo " make install-backend Install backend (uv) dependencies"
@echo " make install-cli Install the data-talks CLI via uv"
@echo " make build Build frontend for production"
@echo " make run Build frontend and start backend (http://localhost:8000)"
@echo " make dev Start backend + frontend dev server with hot reload"
@echo " (auto-frees :5173 + :8000-8005 from our own zombies first)"
@echo " make migrate Run database migrations"
@echo " make setup-env Copy backend/.env.example to backend/.env (if not exists)"
@echo " make lint Run frontend linter"
@echo " make test Run frontend tests"
@echo ""
@echo " make deploy-railway Deploy to Railway (project must be linked)"
@echo " make deploy-railway-init First-time setup: login, link/create project"
@echo " make deploy-railway-sync-env Push backend/.env to Railway variables"
# ------------------------------------------------------------------
# Install
# ------------------------------------------------------------------
install: install-frontend install-backend
install-frontend:
npm install
install-backend:
cd backend && uv sync
install-cli:
cd backend && uv sync
# ------------------------------------------------------------------
# Build & Run
# ------------------------------------------------------------------
build:
npm run build
run: build setup-env
cd backend && uv run data-talks run
dev: setup-env
@echo "Starting backend and frontend dev server..."
@echo "Freeing dev ports (only kills our own uvicorn/data-talks/vite processes)..."
@./scripts/free-dev-ports.sh
@(cd backend && uv run data-talks run) &
@echo "Waiting for backend to start..."
@for i in 1 2 3 4 5 6 7 8 9 10; do \
if [ -f backend/.backend_port ]; then break; fi; \
sleep 1; \
done
@BACKEND_PORT=$$(cat backend/.backend_port 2>/dev/null || echo 8000); \
echo "✅ Backend running on port $$BACKEND_PORT"; \
echo "🚀 Starting frontend (Vite will proxy /api → backend:$$BACKEND_PORT)..."; \
npm run dev
# ------------------------------------------------------------------
# Database
# ------------------------------------------------------------------
migrate: setup-env
cd backend && uv run alembic upgrade head
# ------------------------------------------------------------------
# Utilities
# ------------------------------------------------------------------
setup-env:
@if [ ! -f backend/.env ]; then \
cp backend/.env.example backend/.env; \
echo "Created backend/.env from .env.example — edit it to add your API keys."; \
fi
lint:
npm run lint
test:
npm test
# ------------------------------------------------------------------
# Deploy (Railway)
# ------------------------------------------------------------------
deploy-railway:
./scripts/deploy-railway.sh
deploy-railway-init:
./scripts/deploy-railway.sh --init
deploy-railway-sync-env:
./scripts/deploy-railway.sh --sync-env