Skip to content

Commit ca7df1c

Browse files
authored
Merge pull request #2 from intelliDean/rev
observability added and cleanup up
2 parents 304c07c + 338f31b commit ca7df1c

80 files changed

Lines changed: 1624 additions & 1198 deletions

Some content is hidden

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

.env.example

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,42 @@
1-
# Environment Variables Template
2-
# Copy this file to .env and fill in your actual values
3-
# NEVER commit .env to version control
4-
5-
# Database Configuration
6-
DATABASE_URL=postgresql://username:password@localhost/payego
7-
8-
# JWT Configuration
9-
JWT_SECRET=your_jwt_secret_min_32_characters_long_change_this_in_production
10-
JWT_EXPIRATION_HOURS=2
11-
121
# Server Configuration
13-
HOST=127.0.0.1
2+
HOST=0.0.0.0
143
PORT=8080
15-
APP_URL=http://localhost:8080
16-
APP_ENV=development
17-
18-
# CORS Configuration (comma-separated list)
19-
CORS_ORIGINS=http://localhost:5173,http://localhost:3000
20-
21-
# Payment Gateway Keys
22-
# Stripe: Get from https://dashboard.stripe.com/test/apikeys
23-
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key_here
24-
25-
# PayPal: Get from https://developer.paypal.com/dashboard/applications
26-
PAYPAL_CLIENT_ID=your_paypal_client_id_here
27-
PAYPAL_SECRET=your_paypal_secret_here
28-
29-
# Paystack: Get from https://dashboard.paystack.com/#/settings/developer
30-
PAYSTACK_SECRET_KEY=sk_test_your_paystack_secret_key_here
31-
32-
# Logging Configuration
4+
APP_PORT=8081
5+
CORS_ORIGINS=*
336
RUST_LOG=info
7+
8+
# Database Configuration
9+
# Internal URL for Docker: postgres://postgres:password@db:5432/payego
10+
# External URL for Local Development: postgres://postgres:password@localhost:5434/payego
11+
DATABASE_URL=postgres://postgres:password@localhost:5434/payego
12+
DB_USER=postgres
13+
DB_PASSWORD=password
14+
DB_NAME=payego
15+
DB_PORT=5434
16+
17+
# Security
18+
JWT_SECRET=your_32_character_long_secret_here_min_length
19+
JWT_EXPIRATION_HOURS=24
20+
ISSUER=payego-api
21+
AUDIENCE=payego-client
22+
23+
# Stripe Details
24+
STRIPE_SECRET_KEY=sk_test_...
25+
STRIPE_WEBHOOK_SECRET=whsec_...
26+
STRIPE_API_URL=https://api.stripe.com
27+
28+
# Paystack Details
29+
PAYSTACK_SECRET_KEY=sk_test_...
30+
PAYSTACK_WEBHOOK_SECRET=your_paystack_webhook_token
31+
PAYSTACK_API_URL=https://api.paystack.co
32+
33+
# PayPal Details
34+
PAYPAL_CLIENT_ID=your_paypal_client_id
35+
PAYPAL_SECRET=your_paypal_secret
36+
PAYPAL_API_URL=https://api-m.sandbox.paypal.com
37+
38+
# Other Configs
39+
APP_URL=http://localhost:8080
40+
FEE_BPS=100
41+
EXCHANGE_API_URL=https://api.exchangerate-api.com/v4/latest
42+
DEFAULT_COUNTRY=Nigeria

.github/workflows/cd.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Log in to the Container registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Extract metadata (tags, labels) for Docker
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
34+
tags: |
35+
type=raw,value=latest
36+
type=sha,format=short
37+
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@v5
40+
with:
41+
context: .
42+
push: true
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/ci.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "main", "master" ]
6+
pull_request:
7+
branches: [ "main", "master" ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
SQLX_OFFLINE: true
12+
13+
jobs:
14+
backend:
15+
name: Backend (Rust)
16+
runs-on: ubuntu-latest
17+
services:
18+
postgres:
19+
image: postgres:15-alpine
20+
env:
21+
POSTGRES_USER: postgres
22+
POSTGRES_PASSWORD: password
23+
POSTGRES_DB: payego
24+
ports:
25+
- 5432:5432
26+
options: >-
27+
--health-cmd pg_isready
28+
--health-interval 10s
29+
--health-timeout 5s
30+
--health-retries 5
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Install Rust
36+
uses: dtolnay/rust-toolchain@stable
37+
with:
38+
components: clippy, rustfmt
39+
40+
- name: Cache Cargo registry
41+
uses: actions/cache@v3
42+
with:
43+
path: |
44+
~/.cargo/bin/
45+
~/.cargo/registry/index/
46+
~/.cargo/registry/cache/
47+
~/.cargo/git/db/
48+
target/
49+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
50+
51+
- name: Install dependencies
52+
run: sudo apt-get update && sudo apt-get install -y libpq-dev openssl libssl-dev pkg-config
53+
54+
- name: Install diesel_cli
55+
run: |
56+
if ! command -v diesel &> /dev/null; then
57+
cargo install diesel_cli --no-default-features --features postgres
58+
fi
59+
60+
- name: Install cargo-audit
61+
run: |
62+
if ! command -v cargo-audit &> /dev/null; then
63+
cargo install cargo-audit
64+
fi
65+
66+
- name: Check Formatting
67+
run: cargo fmt --all -- --check
68+
69+
- name: Linting
70+
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
71+
72+
- name: Run Tests
73+
env:
74+
DATABASE_URL: postgres://postgres:password@localhost:5432/payego
75+
TEST_DATABASE_URL: postgres://postgres:password@localhost:5432/payego
76+
APP_ENV: test
77+
JWT_SECRET: super_secret_testing_key_must_be_long_enough
78+
RUST_LOG: info
79+
run: cargo test --workspace
80+
81+
- name: Security Audit
82+
run: cargo audit
83+
84+
frontend:
85+
name: Frontend (React)
86+
runs-on: ubuntu-latest
87+
defaults:
88+
run:
89+
working-directory: ./payego_ui
90+
91+
steps:
92+
- uses: actions/checkout@v4
93+
94+
- name: Setup Node.js
95+
uses: actions/setup-node@v4
96+
with:
97+
node-version: '18'
98+
cache: 'npm'
99+
cache-dependency-path: payego_ui/package-lock.json
100+
101+
- name: Install Dependencies
102+
run: npm ci
103+
104+
- name: Lint
105+
run: npm run lint
106+
107+
- name: Test
108+
run: npm run test
109+
110+
- name: Build
111+
run: npm run build

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Contributing to Payego
2+
3+
Thank you for your interest in contributing to Payego! We welcome contributions from everyone.
4+
5+
## Development Workflow
6+
7+
1. **Fork and Clone**: Fork the repository and clone it locally.
8+
2. **Branching**: Create a new branch for your feature or bugfix.
9+
```bash
10+
git checkout -b feature/amazing-feature
11+
```
12+
3. **Backend Development**:
13+
- Code is in `src/`, `crates/`, and `bin/`.
14+
- Run tests: `cargo test`
15+
- Check linting: `cargo clippy`
16+
- Check formatting: `cargo fmt`
17+
4. **Frontend Development**:
18+
- Code is in `payego_ui/`.
19+
- Run dev server: `npm run dev`
20+
- Run tests: `npm run test`
21+
- Run linting: `npm run lint`
22+
23+
## Pull Request Process
24+
25+
1. Ensure all local tests pass.
26+
2. Commit your changes with clear, descriptive commit messages.
27+
3. Push to your fork and submit a Pull Request to the `main` branch.
28+
4. Our CI pipeline will automatically run to verify your changes.
29+
30+
## Code Style
31+
32+
- **Rust**: Follow standard Rust conventions (`rustfmt`).
33+
- **JavaScript/React**: Follow ESLint configuration in `payego_ui`.
34+
35+
## Architecture Guide
36+
37+
- **payego-api** (`crates/api`): HTTP handlers and routing.
38+
- **payego-core** (`crates/core`): Business logic and services.
39+
- **payego-primitives** (`crates/primitives`): Shared types, DTOs, and errors.
40+
- **payego-ui** (`payego_ui`): React frontend.
41+
42+
Happy Coding! 🚀

Cargo.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ axum-prometheus = "0.10.0"
4949
strum = { version = "0.26", features = ["derive"] }
5050
diesel-derive-enum = { version = "2.1", features = ["postgres"] }
5151
thiserror = "2.0.17"
52+
once_cell = "1.21.3"
5253

5354
# Workspace local dependencies
5455
payego-primitives = { path = "crates/primitives" }

0 commit comments

Comments
 (0)