Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/deploy-vercel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Deploy to Vercel

on:
push:
branches:
- main

permissions:
contents: read

jobs:
deploy-public:
name: Deploy public app (Astro)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm install --legacy-peer-deps
working-directory: apps/public
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow uses npm install for deployments, but the repository doesn’t include a lockfile (package-lock.json). That makes deployments non-deterministic and can lead to “works yesterday, breaks today” builds. Consider committing a lockfile and switching these steps to npm ci for reproducible deploys.

Copilot uses AI. Check for mistakes.

Comment on lines +23 to +25
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow installs dependencies inside apps/public, but the repo is configured as an npm workspaces monorepo at the root (package.json has workspaces). Installing from a workspace folder bypasses workspace hoisting and can produce a different dependency graph than a root install. Consider installing from the repo root (single install) and then building the target app(s).

Copilot uses AI. Check for mistakes.
- name: Build public app
run: npm run build
working-directory: apps/public
env:
PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }}

- name: Deploy public app to Vercel
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_PUBLIC }}
working-directory: apps/public
vercel-args: '--prod'
Comment on lines +26 to +38
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These jobs run npm run build:* locally, but the subsequent vercel-action invocation does not pass --prebuilt, so Vercel will rebuild from source on its infrastructure and ignore the artifacts produced in the prior build steps. If you want the local build to be what gets deployed, switch to a prebuilt flow; otherwise consider removing the local build steps (or at least avoid relying on their env like PUBLIC_API_URL, which won’t affect the Vercel-side build).

Copilot uses AI. Check for mistakes.

Comment on lines +23 to +39
deploy-admin:
name: Deploy admin app (Angular)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install dependencies
run: npm install --legacy-peer-deps
working-directory: apps/admin

Comment on lines +51 to +53
- name: Build admin app
run: npm run build
working-directory: apps/admin

- name: Deploy admin app to Vercel
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_ADMIN }}
working-directory: apps/admin
vercel-args: '--prod'
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Web3 wallet integration via RainbowKit, Wagmi and Viem in `apps/public`
- Vercel deployment configuration (`vercel.json`) for `apps/public` (Astro SSR) and `apps/admin` (Angular)
- GitHub Actions workflow for automated Vercel deployment on push to `main`
- `bootstrap.ps1` PowerShell script for one-command local development setup

## [0.1.0] - 2026-03-11

### Added

- Monorepo structure with `apps/public` (Astro SSR frontend), `apps/admin` (Angular dashboard), `node` (API server) and `workers` directories
- `apps/public` Astro 5 frontend with identity claim, profile and timeline pages
- `apps/admin` Angular 19 admin dashboard isolated from the public frontend
- Node.js API server (`node/socialai.node.js`) with REST endpoints
- Background workers for AI, Ethereum, Farcaster, Reddit, Solana and search indexing
- Solidity smart contracts in `contracts/` (core, interfaces, libraries, storage, verifiers)
- PostgreSQL database schema (`db/schema.sql`)
- CI workflow (`.github/workflows/ci.yml`) running lint, typecheck and build on every PR
- `ARCHITECTURE.md`, `IMPLEMENTATION.md` and `SECURITY.md` project documentation
- `docs/` directory with API, deployment, development, installation, testing and troubleshooting guides
- MIT licence

[Unreleased]: https://github.com/SMSDAO/SocialAi/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/SMSDAO/SocialAi/releases/tag/v0.1.0
12 changes: 11 additions & 1 deletion apps/public/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@
"preview": "astro preview"
},
"dependencies": {
"astro": "^5.15.8"
"@rainbow-me/rainbowkit": "^2.2.7",
"@tanstack/react-query": "^5.66.9",
"@wagmi/core": "^2.16.5",
"astro": "^5.15.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "^2.23.10",
"wagmi": "^2.14.11"
Comment on lines +12 to +19
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wagmi already depends on @wagmi/core. Pinning @wagmi/core separately at a higher version than wagmi (2.16.5 vs 2.14.11) can lead to duplicate installations and subtle runtime/type mismatches. Prefer removing the direct @wagmi/core dependency unless you truly need it, or align versions so wagmi and @wagmi/core resolve to the same release.

Copilot uses AI. Check for mistakes.
},
"devDependencies": {
"@astrojs/node": "^8.0.0",
"@astrojs/react": "^4.2.1",
"@types/node": "^20.10.5",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding @astrojs/react alone isn’t sufficient to use React components in Astro—astro.config.mjs must also register the React integration. Without that, .astro files won’t be able to render React components as intended. Please wire up the integration in the Astro config to match this dependency change.

Copilot uses AI. Check for mistakes.
"typescript": "^5.3.3"
Comment on lines 21 to 27
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Astro app is on astro v5, but the adapter/integration versions added here (@astrojs/node ^8 and @astrojs/react ^4) look like older majors and may be incompatible with Astro 5. Align the @astrojs/* package versions with the Astro major to avoid build/runtime issues (especially for SSR).

Copilot uses AI. Check for mistakes.
}
}
40 changes: 40 additions & 0 deletions bootstrap.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SocialAi Bootstrap Script
# Run this script from the repository root to set up and start the project locally.
# .\bootstrap.ps1

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script assumes it’s executed from the repo root, but nothing enforces that. Add a Set-Location $PSScriptRoot (or equivalent) at the start so relative paths like apps/public and node/socialai.node.js resolve correctly regardless of the caller’s current directory.

Suggested change
$ErrorActionPreference = 'Stop'
$ErrorActionPreference = 'Stop'
Set-Location -Path $PSScriptRoot

Copilot uses AI. Check for mistakes.

Write-Host "=== SocialAi Bootstrap ===" -ForegroundColor Cyan

# 1. Install all workspace dependencies
Write-Host "`n[1/3] Installing dependencies..." -ForegroundColor Yellow
npm install
if ($LASTEXITCODE -ne 0) {
Write-Host "npm install failed, retrying with --legacy-peer-deps..." -ForegroundColor Yellow
npm install --legacy-peer-deps
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After retrying npm install --legacy-peer-deps, the script doesn’t check $LASTEXITCODE again. Since external commands won’t throw under $ErrorActionPreference = 'Stop', a failed second install would still print “Dependencies installed” and continue. Add an explicit exit-code check after the retry (and abort on failure).

Suggested change
npm install --legacy-peer-deps
npm install --legacy-peer-deps
if ($LASTEXITCODE -ne 0) {
Write-Host "npm install failed even with --legacy-peer-deps. Aborting." -ForegroundColor Red
exit $LASTEXITCODE
}

Copilot uses AI. Check for mistakes.
}
Write-Host "Dependencies installed." -ForegroundColor Green

# 2. Initialise the database (requires a running PostgreSQL instance and psql on PATH)
Write-Host "`n[2/3] Initialising database..." -ForegroundColor Yellow
if (Get-Command psql -ErrorAction SilentlyContinue) {
npm run db:init
Write-Host "Database initialised." -ForegroundColor Green
} else {
Write-Host "psql not found – skipping db:init. Install PostgreSQL and re-run, or run 'npm run db:init' manually." -ForegroundColor Yellow
}

# 3. Start all applications concurrently
Write-Host "`n[3/3] Starting applications..." -ForegroundColor Yellow
Write-Host " - Public frontend : http://localhost:4321" -ForegroundColor Cyan
Write-Host " - Admin dashboard : http://localhost:4200" -ForegroundColor Cyan
Write-Host " - API / Node server: http://localhost:3000" -ForegroundColor Cyan
Write-Host ""

# Run each app in its own PowerShell window so they all stay visible
Start-Process powershell -ArgumentList '-NoExit', '-Command', 'Set-Location apps/public; npm run dev'
Start-Process powershell -ArgumentList '-NoExit', '-Command', 'Set-Location apps/admin; npm start'
Start-Process powershell -ArgumentList '-NoExit', '-Command', 'node node/socialai.node.js'

Write-Host "All applications started. Close the individual windows to stop them." -ForegroundColor Green
30 changes: 30 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": 2,
"builds": [
{
"src": "apps/public/astro.config.mjs",
"use": "@vercel/astro",
"config": {
"installCommand": "npm install --legacy-peer-deps"
}
},
{
"src": "apps/admin/package.json",
"use": "@vercel/static-build",
"config": {
"distDir": "apps/admin/dist/socialai-admin/browser",
"buildCommand": "npm run build:admin"
}
Comment on lines +12 to +17
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildCommand is set to npm run build:admin, but when using @vercel/static-build with src: apps/admin/package.json, the build command is typically executed relative to that package. build:admin is defined in the repo root package.json, not in apps/admin/package.json, so this will likely fail. Prefer a command available in apps/admin (e.g., its build script), or change the builder src/working directory so the command runs where it’s defined.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +17
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The admin build config looks inconsistent with the Angular app’s configured outputPath. apps/admin/angular.json sets outputPath to dist/socialai-admin, but this Vercel config assumes apps/admin/dist/socialai-admin/browser. Update distDir (and any related routes) to match the actual build output, otherwise the deployment will serve a non-existent directory.

Copilot uses AI. Check for mistakes.
}
],
"routes": [
{
"src": "/admin(.*)",
"dest": "/apps/admin/dist/socialai-admin/browser$1"
},
{
"src": "/(.*)",
"dest": "/apps/public/$1"
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These routes destinations point to source directories (/apps/public/$1) and to an admin dist path that doesn’t match the Angular outputPath. On Vercel, routes should generally target built outputs/functions rather than workspace paths. Rework routing to target the actual build artifacts produced by each builder (and align the admin path with the real dist directory), otherwise requests may 404 in production.

Suggested change
"dest": "/apps/admin/dist/socialai-admin/browser$1"
},
{
"src": "/(.*)",
"dest": "/apps/public/$1"
"dest": "/$1"
},
{
"src": "/(.*)",
"dest": "/$1"

Copilot uses AI. Check for mistakes.
}
]
Comment on lines +2 to +19
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vercel.json is in the repo root, but the GitHub Actions workflow deploys using working-directory: apps/public / apps/admin, so Vercel CLI will not read this root-level config. This makes the build/dist settings here ineffective for those deployments. Consider either moving/duplicating vercel.json into each app directory, or updating the workflow to deploy from the repo root (or relying solely on Vercel project settings for each app).

Suggested change
"version": 2,
"builds": [
{
"src": "apps/public/astro.config.mjs",
"use": "@vercel/astro",
"config": {
"installCommand": "npm install --legacy-peer-deps"
}
},
{
"src": "apps/admin/package.json",
"use": "@vercel/static-build",
"config": {
"distDir": "dist/socialai-admin",
"buildCommand": "npm run build"
}
}
]
"version": 2

Copilot uses AI. Check for mistakes.
}
Loading