Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6b65e65
Renamed readme
taskifbin Aug 12, 2026
3434112
Database setup
taskifbin Aug 13, 2026
c10f931
Add .env.example for team setup
taskifbin Aug 13, 2026
ab6bfa7
Square Rounded logo
taskifbin Aug 13, 2026
d6bf5de
Square Rounded logo
taskifbin Aug 13, 2026
9b24bc9
fixed path
taskifbin Aug 13, 2026
e605b39
Fixed logo alignment issue, centered the logo
taskifbin Aug 14, 2026
78ba29e
Database Schema
taskifbin Aug 14, 2026
1c1a968
Updated Docker and nginx file for API
taskifbin Aug 14, 2026
142cc0e
Removed all environment files from uploading
taskifbin Aug 14, 2026
16e4990
Added API feature
taskifbin Aug 14, 2026
adea41a
feat: implement wallet create/view and balance check
MH-Rohan-JU Aug 15, 2026
ab07db7
initial moneycontroller
NaosinLineya Aug 15, 2026
0b70d5c
initial moneyroutes
NaosinLineya Aug 15, 2026
2ab8175
Create dummy
NaosinLineya Aug 15, 2026
45acc59
initial moneyService
NaosinLineya Aug 15, 2026
56d81bb
Delete api/src/services/dummy
NaosinLineya Aug 15, 2026
ef3b5ca
Docker updated for neon ading server
taskifbin Aug 15, 2026
1ebde0f
Docker updated for neon ading server
taskifbin Aug 15, 2026
df7e3e2
Implement : History, Request Money CRUD, Merchant Payment Gateway
shihab3point14 Aug 15, 2026
e667633
Merge branch 'devs' of https://github.com/MicroWeb-II/payNEXT into devs
shihab3point14 Aug 15, 2026
888d4d5
DB for Server Cnn
taskifbin Aug 15, 2026
fb3fec9
Client server api
taskifbin Aug 16, 2026
4b16710
Client server
taskifbin Aug 16, 2026
6fe7de4
Added Caddyfile
taskifbin Aug 29, 2026
e2405f2
updated docker-compose for caddyfile
taskifbin Aug 29, 2026
ca15423
Updated nginx.conf for caddyfile
taskifbin Aug 29, 2026
877b681
Updated Readme file
taskifbin Aug 29, 2026
ca26bd8
Role added
MH-Rohan-JU Sep 4, 2026
1d00c6e
removed feature json
taskifbin Sep 9, 2026
b4e079d
Added Asset filed
taskifbin Sep 9, 2026
18929cf
Removed Txt
taskifbin Sep 9, 2026
9af2824
Feat: Added rate limitting function and depedencies
taskifbin Sep 9, 2026
21d9179
Modified the controller/auth.js and routes/authroutes.js for rate lim…
taskifbin Sep 9, 2026
537b016
Added Ratelimiting and fixed the controller/authcontroller.js and app.js
taskifbin Sep 9, 2026
b244ffb
FIxed routes/authroutes.js file typo
taskifbin Sep 9, 2026
451061d
feat: Added security feature sanitization
taskifbin Sep 9, 2026
e202a19
Security Documentation for readers
taskifbin Sep 9, 2026
f00285e
Added to prevent injection attacks
MH-Rohan-JU Sep 10, 2026
e87dcd0
Added route validators
MH-Rohan-JU Sep 10, 2026
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
19 changes: 19 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ==========================================
# payNEXT Environment Variables Template
# ==========================================
# COPY THIS FILE AND RENAME IT TO .env
# Command: cp .env.example .env

# Remote Shared Database
DATABASE_URL=postgresql://USER:PASSWORD@HOST:5432/paynext_db?sslmode=require

# Optional split variables if your backend uses them
DB_HOST=your-db-host.supabase.com
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=change_me
DB_NAME=postgres
DB_SSL=true

# API Secrets
JWT_SECRET=choose_your_own_local_jwt_secret
69 changes: 31 additions & 38 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@ name: payNEXT CI/CD

on:
push:
branches:
- devs
- release
- main
branches: [devs, release, main]
pull_request:
branches:
- release
- main
branches: [release, main]
workflow_dispatch:

concurrency:
Expand All @@ -20,43 +15,38 @@ jobs:
validate:
name: Validate Project
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Check required files
run: |
echo "Checking required payNEXT files..."
test -f docker-compose.yml
test -f web/Dockerfile
test -f web/nginx.conf
test -f web/public/index.html
echo "All required files exist."
test -f db/init.sql

- name: Validate Docker Compose file
run: |
docker compose -f docker-compose.yml config > /dev/null
echo "Docker Compose file is valid."
run: docker compose -f docker-compose.yml config > /dev/null

deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest

needs: validate

if: github.ref == 'refs/heads/main'

environment:
name: production

env:
env:
SERVER_IP: ${{ secrets.SERVER_IP }}
SSH_USER: ${{ secrets.SSH_USER }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}

DB_HOST: ${{ secrets.DB_HOST }}
DB_USER: ${{ secrets.DB_USER }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Setup SSH
run: |
Expand All @@ -67,33 +57,36 @@ jobs:
ssh-keyscan -H "$SERVER_IP" >> ~/.ssh/known_hosts

- name: Create deployment folder on server
run: |
ssh "$SSH_USER@$SERVER_IP" "mkdir -p /opt/paynext"
run: ssh "$SSH_USER@$SERVER_IP" "mkdir -p /opt/paynext"

- name: Package application files
- name: Build server .env on the runner
run: |
tar --exclude='./.git' --exclude='./.github' -czf paynext.tgz docker-compose.yml web

- name: Copy package to server
{
echo "DB_HOST=$DB_HOST"
echo "DB_PORT=5432"
echo "DB_USER=$DB_USER"
echo "DB_PASSWORD=$DB_PASSWORD"
echo "DB_NAME=$DB_NAME"
echo "DB_SSL=true"
echo "JWT_SECRET=$JWT_SECRET"
} > server.env

- name: Copy app and .env to server
run: |
tar --exclude='./.git' --exclude='./.github' -czf paynext.tgz docker-compose.yml web db
scp paynext.tgz "$SSH_USER@$SERVER_IP":/tmp/paynext.tgz
scp server.env "$SSH_USER@$SERVER_IP":/opt/paynext/.env
rm -f server.env paynext.tgz

- name: Deploy using Docker
run: |
ssh "$SSH_USER@$SERVER_IP" << 'EOF'
set -e

cd /opt/paynext

docker compose down --remove-orphans || true

rm -rf web docker-compose.yml

rm -rf web db docker-compose.yml
tar -xzf /tmp/paynext.tgz

rm /tmp/paynext.tgz

rm -f /tmp/paynext.tgz
docker compose up -d --build

docker image prune -f
EOF
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ node_modules/
*.log
.DS_Store
dist/
build/
build/get-docker.sh

# Block all .env files everywhere
**/.env
.env
.agents
skills-lock.json
13 changes: 13 additions & 0 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
paynextt.me, www.paynextt.me {

encode zstd gzip

handle /api/* {
reverse_proxy api:3000
}

handle {
reverse_proxy web:80
}

}
113 changes: 102 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,114 @@
<div align="center">

<img src="assets/payNEXT_logo.png" alt="Project Logo" width="180"/>

# payNEXT

payNEXT is a digital wallet platform.
**payNEXT is a next-generation digital wallet platform.**

</div>

## 📖 About The Project

payNEXT is a digital wallet platform developed for Web Programming Lab II.

The project uses an MVC-based backend and provides API-driven features for common wallet operations, including:

- Wallet balance management
- Transaction history
- Peer-to-peer money requests
- Merchant payments
- User authentication

## Local Development
The application runs as a Docker-based multi-container system.

The frontend is served using Docker and Nginx.
## ✨ Features

## Deploy
- 💳 **Digital Wallet**: Manage wallet balances and transactions.
- 🔒 **Automatic HTTPS**: Caddy manages HTTPS and Let's Encrypt certificates.
- 🐳 **Docker Support**: Run the application and its services with Docker Compose.

This project uses GitHub Actions to deploy to the server.
## 🛠️ Tech Stack

When changes are pushed to the `main` branch, GitHub Actions will:
- **Frontend**: HTML, CSS, JavaScript
- **Web Server**: Nginx
- **Backend**: Node.js, Express.js
- **Architecture**: MVC
- **Database**: PostgreSQL 16
- **Reverse Proxy**: Caddy v2
- **SSL/TLS**: Let's Encrypt
- **Containerization**: Docker, Docker Compose
- **CI/CD**: GitHub Actions

1. Copy files to the server
2. Build the Docker image
3. Restart the payNEXT web container
## 🏗️ Architecture

## Server
payNEXT uses four main services:

1. **Caddy**
- Receives incoming web traffic.
- Redirects HTTP traffic to HTTPS.
- Manages Let's Encrypt certificates.
- Routes `/api/*` requests to the backend.
- Routes frontend requests to Nginx.

2. **Web**
- Runs Nginx.
- Serves the frontend files.
- Handles client-side routing.

3. **API**
- Runs the Node.js and Express.js backend.
- Handles authentication and wallet operations.
- Processes transactions and money requests.
- Communicates with PostgreSQL.

4. **Database**
- Runs PostgreSQL 16.
- Stores users, wallets, transactions, money requests, and other application data.

The request flow looks like this:

```text
http://104.214.170.158
User
Caddy
├── / ──────────► Nginx
│ │
│ ▼
│ Frontend
└── /api/* ─────► Node.js
PostgreSQL
```

## 🚀 Getting Started

### Prerequisites

Install these tools before running the project:

- [Docker](https://www.docker.com/get-started)
- [Docker Compose](https://docs.docker.com/compose/)
- [Git](https://git-scm.com/)

### Stopping the Application

Stop the containers with:

```bash
docker compose down
```

To also remove Docker volumes:

```bash
docker compose down -v
```

Use the `-v` option only when you want to remove the stored local database data.

payNEXT - Powering Your Next Move. Next Generation Digital Wallet.
27 changes: 27 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 🔐 Security Measures in payNEXT

This document outlines the security implementations in the payNEXT architecture.

## 1. Transport Layer Security

- **HTTPS Enforcement:** Caddy automatically provisions Let's Encrypt SSL certificates and redirects all HTTP traffic to HTTPS.
- **Security Headers:** `helmet.js` is configured globally to set secure HTTP headers (HSTS, X-Frame-Options, etc.).

## 2. Access Control & Rate Limiting

- **Rate Limiting:** Authentication endpoints (`/api/v1/auth/login`, `/register`) are restricted to 5 requests per 15 minutes per IP to prevent brute-force attacks.
- **CORS:** Strict origin whitelisting is enforced. Only `https://paynextt.me` and `http://localhost:8080` are permitted.

## 3. Input Validation & Injection Prevention

- **SQL Injection:** All PostgreSQL queries use parameterized inputs via the `pg` library.
- **XSS & Data Sanitization:** `express-validator` is used to trim, escape, and validate all incoming user inputs before processing.

## 4. Infrastructure & Load Balancing

- **Reverse Proxy:** Caddy acts as the single entry point, routing `/api/*` to the backend and `/` to the Nginx frontend.
- **Load Balancing:** The API service can be scaled horizontally (`docker-compose up --scale api=2`). Caddy distributes traffic across instances using a `round_robin` policy.

## 5. How to Test

See the repository wiki or run the provided `curl` commands in `TESTING.md` to verify rate limiting, CORS, and header configurations.
Binary file added assets/payNEXT_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions db/db_schema.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading