Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
64 changes: 64 additions & 0 deletions .github/workflows/deploy-vercel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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

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: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

Comment on lines +51 to +53
- name: Build admin app
run: npm run build: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'
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
node_modules/
.pnp
.pnp.js
package-lock.json
yarn.lock
pnpm-lock.yaml

Expand Down
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
2 changes: 2 additions & 0 deletions apps/public/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';
import react from '@astrojs/react';

// https://astro.build/config
export default defineConfig({
output: 'server',
adapter: node({
mode: 'standalone'
}),
integrations: [react()],
Comment on lines 7 to +11
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.

apps/public is configured with the Node adapter in standalone SSR mode. That output is meant to be run as a Node server process, and won’t match Vercel’s expected Astro-on-Vercel SSR output. If the goal is to deploy the public app to Vercel (as indicated by vercel.json and the workflow), switch the Astro adapter to the Vercel adapter (@astrojs/vercel) and add the corresponding dependency, so the build output is compatible with Vercel’s runtime.

Copilot uses AI. Check for mistakes.
server: {
port: 4321,
host: true
Expand Down
14 changes: 12 additions & 2 deletions 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/node": "^9.0.0",
"@astrojs/react": "^5.0.0",
"@types/node": "^20.10.5",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"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.
}
}
45 changes: 45 additions & 0 deletions bootstrap.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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.
Set-Location -Path $PSScriptRoot

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.
if ($LASTEXITCODE -ne 0) {
Write-Host "npm install failed even with --legacy-peer-deps. Aborting." -ForegroundColor Red
exit $LASTEXITCODE
}
}
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
20 changes: 20 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"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"
}
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.
}
]
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