-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·58 lines (48 loc) · 1.47 KB
/
setup.sh
File metadata and controls
executable file
·58 lines (48 loc) · 1.47 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
#!/usr/bin/env bash
# Sendify — one-shot local setup
# Installs Node (via nvm) if missing, installs deps, starts Postgres+Redis, seeds DB, runs dev server.
set -euo pipefail
cd "$(dirname "$0")"
bold() { printf "\033[1m%s\033[0m\n" "$*"; }
green() { printf "\033[32m%s\033[0m\n" "$*"; }
yellow() { printf "\033[33m%s\033[0m\n" "$*"; }
bold "▶ Sendify setup"
# ── Node via nvm if not present
if ! command -v node >/dev/null 2>&1; then
yellow "node not found — installing via nvm"
if [ ! -d "$HOME/.nvm" ]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
fi
export NVM_DIR="$HOME/.nvm"
# shellcheck source=/dev/null
. "$NVM_DIR/nvm.sh"
nvm install 22
nvm use 22
fi
green "✓ node $(node --version)"
# ── Dependencies
bold "▶ Installing dependencies"
if command -v pnpm >/dev/null 2>&1; then
pnpm install
else
npm install
fi
# ── Local services
if command -v docker >/dev/null 2>&1; then
bold "▶ Starting Postgres + Redis via Docker"
docker compose up -d
else
yellow "docker not found — start Postgres on :5432 and Redis on :6379 manually"
fi
# ── .env
if [ ! -f .env ]; then
cp .env.example .env
yellow "Created .env from template — edit it before running production tasks"
fi
# ── Prisma
bold "▶ Generating Prisma client + pushing schema"
npx prisma generate
npx prisma db push
npx tsx prisma/seed.ts
green "✓ Setup complete"
bold "▶ Run: npm run dev (then open http://localhost:3000)"