Skip to content

Commit 620f9d9

Browse files
committed
init
0 parents  commit 620f9d9

File tree

130 files changed

+20259
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+20259
-0
lines changed

.env.example

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# =============================================================================
2+
# UNIFIED ENVIRONMENT CONFIGURATION
3+
# Copy this to .env and update with your actual values
4+
# All packages and apps use these variables via Turbo's loose mode
5+
# =============================================================================
6+
7+
# -----------------------------------------------------------------------------
8+
# GENERAL CONFIGURATION
9+
# -----------------------------------------------------------------------------
10+
NODE_ENV=development
11+
12+
# -----------------------------------------------------------------------------
13+
# WEB APP (VITE) - Must be prefixed with VITE_
14+
# -----------------------------------------------------------------------------
15+
VITE_API_URL=http://localhost:3001
16+
17+
# -----------------------------------------------------------------------------
18+
# API SERVER (NITRO)
19+
# -----------------------------------------------------------------------------
20+
NITRO_PORT=3001
21+
NITRO_HOST=localhost
22+
WEB_URL=http://localhost:5173
23+
24+
# -----------------------------------------------------------------------------
25+
# AUTHENTICATION (BETTER AUTH)
26+
# -----------------------------------------------------------------------------
27+
BETTER_AUTH_SECRET=your-super-secret-key-here-at-least-32-chars-long
28+
29+
# -----------------------------------------------------------------------------
30+
# DATABASE (PRISMA)
31+
# -----------------------------------------------------------------------------
32+
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
33+
34+
# -----------------------------------------------------------------------------
35+
# OPTIONAL: ADDITIONAL CONFIGURATION
36+
# -----------------------------------------------------------------------------
37+
# API_VERSION=v1
38+
# LOG_LEVEL=info
39+
# CORS_ORIGIN=http://localhost:5173
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Dependency Updates
2+
3+
on:
4+
schedule:
5+
# Run every Monday at 9 AM UTC
6+
- cron: '0 9 * * 1'
7+
workflow_dispatch:
8+
9+
env:
10+
NODE_VERSION: '22'
11+
PNPM_VERSION: '10.15.0'
12+
13+
jobs:
14+
update-dependencies:
15+
name: Update Dependencies
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ env.NODE_VERSION }}
27+
28+
- name: Setup pnpm
29+
uses: pnpm/action-setup@v3
30+
with:
31+
version: ${{ env.PNPM_VERSION }}
32+
33+
- name: Install dependencies
34+
run: pnpm install --frozen-lockfile
35+
36+
- name: Update dependencies
37+
run: pnpm update --latest
38+
39+
- name: Database generation
40+
run: pnpm db:generate
41+
42+
- name: Run tests after update
43+
run: pnpm test
44+
45+
- name: Type check after update
46+
run: pnpm type-check
47+
48+
- name: Lint after update
49+
run: pnpm lint
50+
51+
- name: Build after update
52+
run: pnpm build
53+
54+
- name: Check for changes
55+
id: changes
56+
run: |
57+
if git diff --quiet; then
58+
echo "has-changes=false" >> $GITHUB_OUTPUT
59+
echo "No dependency updates available"
60+
else
61+
echo "has-changes=true" >> $GITHUB_OUTPUT
62+
echo "Dependencies updated"
63+
fi
64+
65+
- name: Create Pull Request
66+
if: steps.changes.outputs.has-changes == 'true'
67+
uses: peter-evans/create-pull-request@v5
68+
with:
69+
token: ${{ secrets.GITHUB_TOKEN }}
70+
commit-message: 'chore: update dependencies'
71+
title: 'chore: automated dependency updates'
72+
body: |
73+
## Automated Dependency Updates
74+
75+
This PR contains automated updates to project dependencies.
76+
77+
### Changes
78+
- Updated npm packages to their latest versions
79+
- Regenerated lock files
80+
- All tests pass with updated dependencies
81+
82+
### Verification
83+
- ✅ Type checking passed
84+
- ✅ Linting passed
85+
- ✅ Tests passed
86+
- ✅ Build succeeded
87+
88+
This PR was automatically created by the dependency update workflow.
89+
branch: chore/dependency-updates
90+
delete-branch: true
91+
assignees: ${{ github.repository_owner }}
92+
labels: |
93+
dependencies
94+
automated
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
name: Northflank Integration
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Trunk-Based Deployment"]
6+
types: [completed]
7+
branches: [main]
8+
workflow_dispatch:
9+
inputs:
10+
force_deploy:
11+
description: 'Force deployment even if build artifacts are missing'
12+
required: false
13+
default: 'false'
14+
type: boolean
15+
16+
env:
17+
NODE_VERSION: '22'
18+
PNPM_VERSION: '10.15.0'
19+
20+
jobs:
21+
# Check if we should proceed with Northflank integration
22+
check-deployment-readiness:
23+
name: Check Deployment Readiness
24+
runs-on: ubuntu-latest
25+
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
26+
outputs:
27+
config-exists: ${{ steps.check-config.outputs.exists }}
28+
should-deploy: ${{ steps.should-deploy.outputs.deploy }}
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Check for Northflank config
34+
id: check-config
35+
run: |
36+
if [ -f ".northflank.json" ]; then
37+
echo "exists=true" >> $GITHUB_OUTPUT
38+
echo "✅ Northflank configuration found"
39+
else
40+
echo "exists=false" >> $GITHUB_OUTPUT
41+
echo "⚠️ No Northflank configuration found"
42+
echo "Run 'pnpm infra:setup' to create .northflank.json"
43+
fi
44+
45+
- name: Should deploy check
46+
id: should-deploy
47+
run: |
48+
if [ "${{ steps.check-config.outputs.exists }}" = "true" ] || [ "${{ github.event.inputs.force_deploy }}" = "true" ]; then
49+
echo "deploy=true" >> $GITHUB_OUTPUT
50+
else
51+
echo "deploy=false" >> $GITHUB_OUTPUT
52+
fi
53+
54+
# Prepare deployment instructions and verify builds
55+
prepare-northflank-deployment:
56+
name: Prepare Northflank Deployment
57+
runs-on: ubuntu-latest
58+
needs: check-deployment-readiness
59+
if: needs.check-deployment-readiness.outputs.should-deploy == 'true'
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
64+
- name: Setup Node.js
65+
uses: actions/setup-node@v4
66+
with:
67+
node-version: ${{ env.NODE_VERSION }}
68+
69+
- name: Setup pnpm
70+
uses: pnpm/action-setup@v3
71+
with:
72+
version: ${{ env.PNPM_VERSION }}
73+
74+
- name: Install dependencies
75+
run: pnpm install --frozen-lockfile
76+
77+
- name: Setup environment
78+
run: echo 'DATABASE_URL="postgresql://test:test@localhost:5432/test_db"' > .env
79+
80+
- name: Generate database types
81+
run: pnpm db:generate
82+
83+
- name: Build for Northflank
84+
run: |
85+
echo "🏗️ Building applications for Northflank deployment..."
86+
pnpm turbo build --filter=@repo/api
87+
pnpm turbo build --filter=@repo/web
88+
89+
- name: Verify build outputs
90+
run: |
91+
echo "## 🔍 Build Verification" >> $GITHUB_STEP_SUMMARY
92+
echo "" >> $GITHUB_STEP_SUMMARY
93+
94+
if [ -d "apps/api/.output" ]; then
95+
api_size=$(du -sh apps/api/.output | cut -f1)
96+
echo "✅ **API Build:** $api_size" >> $GITHUB_STEP_SUMMARY
97+
echo " - Location: \`apps/api/.output/\`" >> $GITHUB_STEP_SUMMARY
98+
echo " - Entry: \`apps/api/.output/server/index.mjs\`" >> $GITHUB_STEP_SUMMARY
99+
else
100+
echo "❌ **API Build:** Missing" >> $GITHUB_STEP_SUMMARY
101+
exit 1
102+
fi
103+
104+
echo "" >> $GITHUB_STEP_SUMMARY
105+
106+
if [ -d "apps/web/dist" ]; then
107+
web_size=$(du -sh apps/web/dist | cut -f1)
108+
echo "✅ **Web Build:** $web_size" >> $GITHUB_STEP_SUMMARY
109+
echo " - Location: \`apps/web/dist/\`" >> $GITHUB_STEP_SUMMARY
110+
echo " - Static files ready for deployment" >> $GITHUB_STEP_SUMMARY
111+
else
112+
echo "❌ **Web Build:** Missing" >> $GITHUB_STEP_SUMMARY
113+
exit 1
114+
fi
115+
116+
- name: Generate Northflank deployment guide
117+
run: |
118+
if [ -f ".northflank.json" ]; then
119+
PROJECT_NAME=$(cat .northflank.json | grep -o '"projectName":"[^"]*"' | cut -d'"' -f4)
120+
REPO_URL=$(cat .northflank.json | grep -o '"repoUrl":"[^"]*"' | cut -d'"' -f4)
121+
API_URL=$(cat .northflank.json | grep -o '"apiUrl":"[^"]*"' | cut -d'"' -f4)
122+
WEB_URL=$(cat .northflank.json | grep -o '"webUrl":"[^"]*"' | cut -d'"' -f4)
123+
else
124+
PROJECT_NAME="vitro-app"
125+
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
126+
API_URL="https://api-vitro-app.northflank.app"
127+
WEB_URL="https://web-vitro-app.northflank.app"
128+
fi
129+
130+
echo "## 🚀 Northflank Deployment Guide" >> $GITHUB_STEP_SUMMARY
131+
echo "" >> $GITHUB_STEP_SUMMARY
132+
echo "### 📋 Manual Setup Required" >> $GITHUB_STEP_SUMMARY
133+
echo "" >> $GITHUB_STEP_SUMMARY
134+
echo "1. **Go to [Northflank Dashboard](https://app.northflank.com)**" >> $GITHUB_STEP_SUMMARY
135+
echo "2. **Create Project:** \`$PROJECT_NAME\` in **US Central** region" >> $GITHUB_STEP_SUMMARY
136+
echo "3. **Add PostgreSQL Addon** (free tier available)" >> $GITHUB_STEP_SUMMARY
137+
echo "" >> $GITHUB_STEP_SUMMARY
138+
echo "### 🔧 Service Configuration" >> $GITHUB_STEP_SUMMARY
139+
echo "" >> $GITHUB_STEP_SUMMARY
140+
echo "#### API Service" >> $GITHUB_STEP_SUMMARY
141+
echo "- **Git Source:** \`$REPO_URL\`" >> $GITHUB_STEP_SUMMARY
142+
echo "- **Branch:** \`main\`" >> $GITHUB_STEP_SUMMARY
143+
echo "- **Build Command:** \`pnpm install && pnpm db:generate && pnpm turbo build --filter=@repo/api\`" >> $GITHUB_STEP_SUMMARY
144+
echo "- **Start Command:** \`node apps/api/.output/server/index.mjs\`" >> $GITHUB_STEP_SUMMARY
145+
echo "- **Port:** \`3001\`" >> $GITHUB_STEP_SUMMARY
146+
echo "- **Expected URL:** $API_URL" >> $GITHUB_STEP_SUMMARY
147+
echo "" >> $GITHUB_STEP_SUMMARY
148+
echo "#### Web Service" >> $GITHUB_STEP_SUMMARY
149+
echo "- **Git Source:** \`$REPO_URL\`" >> $GITHUB_STEP_SUMMARY
150+
echo "- **Branch:** \`main\`" >> $GITHUB_STEP_SUMMARY
151+
echo "- **Build Command:** \`pnpm install && pnpm turbo build --filter=@repo/web\`" >> $GITHUB_STEP_SUMMARY
152+
echo "- **Publish Directory:** \`apps/web/dist\`" >> $GITHUB_STEP_SUMMARY
153+
echo "- **Expected URL:** $WEB_URL" >> $GITHUB_STEP_SUMMARY
154+
echo "" >> $GITHUB_STEP_SUMMARY
155+
echo "### 🔑 Environment Variables" >> $GITHUB_STEP_SUMMARY
156+
echo "" >> $GITHUB_STEP_SUMMARY
157+
echo "#### API Service" >> $GITHUB_STEP_SUMMARY
158+
echo "- \`DATABASE_URL\`: From PostgreSQL addon" >> $GITHUB_STEP_SUMMARY
159+
echo "- \`BETTER_AUTH_SECRET\`: 32+ character secret" >> $GITHUB_STEP_SUMMARY
160+
echo "- \`NODE_ENV\`: \`production\`" >> $GITHUB_STEP_SUMMARY
161+
echo "- \`NITRO_PORT\`: \`3001\`" >> $GITHUB_STEP_SUMMARY
162+
echo "" >> $GITHUB_STEP_SUMMARY
163+
echo "#### Web Service" >> $GITHUB_STEP_SUMMARY
164+
echo "- \`VITE_API_URL\`: $API_URL" >> $GITHUB_STEP_SUMMARY
165+
echo "" >> $GITHUB_STEP_SUMMARY
166+
echo "### ✅ Deployment Verification" >> $GITHUB_STEP_SUMMARY
167+
echo "" >> $GITHUB_STEP_SUMMARY
168+
echo "- **Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
169+
echo "- **Triggered by:** ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY
170+
echo "- **Timestamp:** $(date -u)" >> $GITHUB_STEP_SUMMARY
171+
172+
- name: Upload build artifacts for Northflank
173+
uses: actions/upload-artifact@v4
174+
with:
175+
name: northflank-deployment-ready
176+
path: |
177+
apps/api/.output/
178+
apps/web/dist/
179+
.northflank.json
180+
retention-days: 30
181+
182+
# Future: This job can be enhanced to use Northflank CLI when available
183+
northflank-cli-deployment:
184+
name: Northflank CLI Deployment (Future)
185+
runs-on: ubuntu-latest
186+
needs: prepare-northflank-deployment
187+
if: false # Disabled until Northflank CLI is available
188+
steps:
189+
- name: Placeholder for future CLI deployment
190+
run: |
191+
echo "🚧 This job is reserved for future Northflank CLI integration"
192+
echo "💡 Currently, deployment requires manual setup via Northflank Dashboard"
193+
echo "📖 See the deployment guide in the previous job's summary"

0 commit comments

Comments
 (0)