Skip to content

Commit adacbb5

Browse files
authored
Merge branch 'main' into feat/wallet-ux
2 parents 34b94de + ab6f044 commit adacbb5

1,179 files changed

Lines changed: 16491 additions & 3958 deletions

File tree

Some content is hidden

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

.github/workflows/canary.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Canary Deployment
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main, dev]
7+
8+
jobs:
9+
canary-10:
10+
name: Canary Phase 1 (10%)
11+
runs-on: ubuntu-latest
12+
environment: canary-10 # Links to the environment
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Deploy 10%
16+
run: bash scripts/deploy_canary.sh ${{ github.sha }} 10
17+
- name: Automated Health Check
18+
run: bash scripts/canary_monitor.sh
19+
20+
canary-50:
21+
name: Canary Phase 2 (50%)
22+
needs: canary-10
23+
runs-on: ubuntu-latest
24+
environment: canary-50
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: Deploy 50%
28+
run: bash scripts/deploy_canary.sh ${{ github.sha }} 50
29+
- name: Automated Health Check
30+
run: bash scripts/canary_monitor.sh
31+
32+
production-rollout:
33+
name: Full Production Rollout (100%)
34+
needs: canary-50
35+
runs-on: ubuntu-latest
36+
# This environment has "Required Reviewers" set in GitHub UI
37+
environment: production
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: Deploy 100%
41+
run: bash scripts/deploy_canary.sh ${{ github.sha }} 100
42+
43+
rollback:
44+
name: Auto-Rollback
45+
if: failure()
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Revert to Stable
49+
run: bash scripts/deploy_canary.sh "stable-version" 100

.github/workflows/ci.yml

Lines changed: 72 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,85 +6,121 @@ on:
66
pull_request:
77
branches: [main, dev]
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
913
jobs:
14+
changes:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
backend: ${{ steps.filter.outputs.backend }}
18+
frontend: ${{ steps.filter.outputs.frontend }}
19+
contracts: ${{ steps.filter.outputs.contracts }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: dorny/paths-filter@v3
23+
id: filter
24+
with:
25+
filters: |
26+
backend:
27+
- 'backend/**'
28+
frontend:
29+
- 'frontend/**'
30+
contracts:
31+
- 'contracts/**'
32+
1033
backend:
34+
needs: changes
35+
if: ${{ needs.changes.outputs.backend == 'true' }}
1136
name: Backend (Node.js ${{ matrix.node-version }})
1237
runs-on: ubuntu-latest
1338
strategy:
1439
matrix:
1540
node-version: [20, 22]
41+
defaults:
42+
run:
43+
working-directory: backend
1644
steps:
17-
- name: Checkout code
18-
uses: actions/checkout@v4
19-
20-
- name: Setup Node.js ${{ matrix.node-version }}
45+
- uses: actions/checkout@v4
46+
- name: Setup Node.js
2147
uses: actions/setup-node@v4
2248
with:
2349
node-version: ${{ matrix.node-version }}
2450
cache: 'npm'
2551
cache-dependency-path: backend/package-lock.json
2652

2753
- name: Install dependencies
28-
run: npm install
29-
working-directory: backend
30-
31-
- name: Run ESLint
32-
run: npm run lint
33-
working-directory: backend
54+
run: npm ci
3455

35-
- name: Run tests
36-
run: npm run test
37-
working-directory: backend
56+
- name: Lint & Test
57+
run: |
58+
npm run lint
59+
npm run test
3860
3961
- name: Build
4062
run: npm run build
41-
working-directory: backend
4263

4364
frontend:
65+
needs: changes
66+
if: ${{ needs.changes.outputs.frontend == 'true' }}
4467
name: Frontend (Node.js ${{ matrix.node-version }})
4568
runs-on: ubuntu-latest
4669
strategy:
4770
matrix:
4871
node-version: [20, 22]
72+
defaults:
73+
run:
74+
working-directory: frontend
4975
steps:
50-
- name: Checkout code
51-
uses: actions/checkout@v4
76+
- uses: actions/checkout@v4
5277

53-
- name: Setup Node.js ${{ matrix.node-version }}
78+
- name: Setup Node.js
5479
uses: actions/setup-node@v4
5580
with:
5681
node-version: ${{ matrix.node-version }}
5782
cache: 'npm'
5883
cache-dependency-path: frontend/package-lock.json
5984

60-
- name: Install dependencies
61-
run: npm install
62-
working-directory: frontend
85+
- name: Cache Next.js build
86+
uses: actions/cache@v4
87+
with:
88+
path: ${{ github.workspace }}/frontend/.next/cache
89+
key: ${{ runner.os }}-nextjs-${{ hashFiles('frontend/package-lock.json') }}-${{ hashFiles('frontend/src/**') }}
90+
restore-keys: |
91+
${{ runner.os }}-nextjs-${{ hashFiles('frontend/package-lock.json') }}-
6392
64-
- name: Run ESLint
65-
run: npm run lint
66-
working-directory: frontend
93+
- name: Install dependencies
94+
run: npm ci
6795

68-
- name: Run tests
69-
run: npm run test
70-
working-directory: frontend
96+
- name: Lint & Test
97+
run: |
98+
npm run lint
99+
npm run test
71100
72101
- name: Build
73102
run: npm run build
74-
working-directory: frontend
75103

76104
contracts:
105+
needs: changes
106+
if: ${{ needs.changes.outputs.contracts == 'true' }}
77107
name: Smart Contracts (Rust)
78108
runs-on: ubuntu-latest
79-
container: rust:1.88
80109
steps:
81-
- name: Checkout code
82-
uses: actions/checkout@v4
110+
- uses: actions/checkout@v4
83111

84-
- name: Build contracts
85-
run: cargo build --release
86-
working-directory: contracts
112+
- name: Install Rust toolchain
113+
uses: dtolnay/rust-toolchain@stable
114+
with:
115+
targets: wasm32-unknown-unknown
87116

88-
- name: Check contracts
89-
run: cargo check
90-
working-directory: contracts
117+
- name: Rust Cache
118+
uses: Swatinem/rust-cache@v2
119+
with:
120+
workspaces: "contracts -> target"
121+
122+
- name: Build & Check
123+
working-directory: contracts
124+
run: |
125+
cargo build --target wasm32-unknown-unknown --release
126+
cargo check

CONTRIBUTING.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Contributing to AgenticPay
2+
3+
Thanks for your interest in contributing to AgenticPay. This guide covers the expectations for code style, commits, pull requests, and testing so contributions are easy to review and merge.
4+
5+
## Project Structure
6+
7+
- `frontend/`: Next.js web application
8+
- `backend/`: Express.js API server
9+
- `contracts/`: Soroban smart contracts written in Rust
10+
11+
When possible, keep changes focused to a single area of the codebase. If a change spans multiple areas, call that out clearly in your pull request.
12+
13+
## Getting Started
14+
15+
1. Fork the repository and clone your fork.
16+
2. Create a branch from `main`.
17+
3. Install dependencies in the area you plan to change:
18+
19+
```bash
20+
cd backend && npm install
21+
cd frontend && npm install
22+
cd contracts && cargo build
23+
```
24+
25+
4. Configure any required environment variables described in [README.md](./README.md).
26+
27+
## Code Style Guidelines
28+
29+
### General
30+
31+
- Match the existing structure and naming patterns in the files you touch.
32+
- Prefer small, focused pull requests over large mixed changes.
33+
- Do not commit secrets, API keys, or `.env` files.
34+
- Add or update tests when behavior changes.
35+
36+
### Frontend and Backend
37+
38+
- Use TypeScript for application code and keep types accurate.
39+
- Run ESLint before opening a pull request.
40+
- Avoid introducing `any` unless there is a clear reason and it is documented in the code.
41+
- Remove unused imports, variables, and dead code before submitting.
42+
- Keep components, routes, and services narrowly scoped to one responsibility.
43+
44+
Useful commands:
45+
46+
```bash
47+
cd frontend && npm run lint
48+
cd frontend && npm test
49+
50+
cd backend && npm run lint
51+
cd backend && npm test
52+
```
53+
54+
### Smart Contracts
55+
56+
- Follow existing Rust and Soroban patterns in `contracts/src/lib.rs`.
57+
- Keep contract interfaces explicit and deterministic.
58+
- Build and test contract changes before submitting.
59+
60+
Useful commands:
61+
62+
```bash
63+
cd contracts && cargo test
64+
cd contracts && cargo build --target wasm32-unknown-unknown --release
65+
```
66+
67+
## Commit Message Format
68+
69+
Use a short, imperative commit message in this format:
70+
71+
```text
72+
type: brief summary
73+
```
74+
75+
Recommended commit types:
76+
77+
- `feat`: new functionality
78+
- `fix`: bug fixes
79+
- `docs`: documentation updates
80+
- `refactor`: code changes that do not change behavior
81+
- `test`: adding or updating tests
82+
- `chore`: maintenance work
83+
84+
Examples:
85+
86+
```text
87+
docs: add contributing guide
88+
fix: handle missing invoice validation
89+
feat: add project payment status badge
90+
```
91+
92+
Try to keep the summary under 72 characters and make each commit represent one logical change.
93+
94+
## Pull Request Process
95+
96+
1. Create a descriptive branch name such as `feat/payment-status` or `docs/contributing-guide`.
97+
2. Make your changes in the smallest reasonable scope.
98+
3. Run the relevant lint, test, and build commands for the areas you changed.
99+
4. Push your branch and open a pull request against `main`.
100+
5. In the pull request description, include:
101+
- a short summary of the change
102+
- linked issue or task reference, if available
103+
- testing notes describing what you ran
104+
- screenshots or recordings for UI changes, if applicable
105+
6. Respond to review feedback with follow-up commits unless a maintainer asks for a squash or rebase.
106+
107+
## Testing Requirements
108+
109+
Every contribution should be verified before review.
110+
111+
- Frontend changes: run `npm run lint` and `npm test` in `frontend/`.
112+
- Backend changes: run `npm run lint` and `npm test` in `backend/`.
113+
- Contract changes: run `cargo test` and `cargo build --target wasm32-unknown-unknown --release` in `contracts/`.
114+
- Cross-cutting changes: run checks for every affected area.
115+
- If automated coverage is not practical, include clear manual verification steps in the pull request.
116+
117+
Pull requests may be sent back for updates if they do not include appropriate validation for the code they change.
118+
119+
## Questions and Support
120+
121+
If you are unsure about an implementation detail, open an issue or start a discussion before investing heavily in a large change. Early alignment helps us review and merge contributions faster.

ENV_VARS.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Environment Variables
2+
3+
## Backend
4+
5+
| Variable | Description | Default |
6+
| -------------------- | ----------------------------------- | ------- |
7+
| PORT | Server port | 3001 |
8+
| CORS_ALLOWED_ORIGINS | Allowed origins for CORS | \* |
9+
| JOBS_ENABLED | Enable/disable background jobs | true |
10+
| STELLAR_NETWORK | Stellar network (testnet or public) | testnet |
11+
12+
## Frontend
13+
14+
| Variable | Description | Default |
15+
| ----------------------- | -------------------- | ---------------------------- |
16+
| NEXT_PUBLIC_API_URL | Backend API base URL | http://localhost:3001/api/v1 |
17+
| NEXT_PUBLIC_BACKEND_URL | Backend URL fallback | http://localhost:3001/api/v1 |
18+
19+
## Environment Files
20+
21+
- `.env.development` — local development
22+
- `.env.staging` — staging environment
23+
- `.env.production` — production environment
24+
25+
## Notes
26+
27+
- Never commit `.env` files containing real secrets to version control
28+
- Copy the appropriate file and rename to `.env` when running locally

0 commit comments

Comments
 (0)