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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Dependencies
**/node_modules
node_modules
dist
dist-ssr
*.local

# Environment files
**/.env
**/.env.backup

# Editor directories and files
.vscode/*
!.vscode/extensions.json
Expand All @@ -22,3 +28,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Project specific
api-frontend
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
111 changes: 51 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,64 @@
# React + TypeScript + Vite
# Boardling

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
A modern web application with Zcash blockchain integration.

Currently, two official plugins are available:
## Project Structure

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
```
├── backend/ # Node.js backend API
├── api-frontend/ # React frontend application (renamed from frontend)
├── config/ # Configuration files
│ └── zcash/ # Zcash node configurations
├── docs/ # Documentation
│ ├── api/ # API documentation
│ ├── architecture/ # Architecture documentation
│ ├── rpc/ # RPC documentation
│ └── zcash-setup/ # Zcash setup guides and scripts
└── Blockchain/ # Blockchain-related code
```

## React Compiler
## Quick Start

The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
### Zcash Setup
For Zcash blockchain integration:
```bash
cd docs/zcash-setup
./quick-install-zcash.sh
```

## Expanding the ESLint configuration
### Backend
```bash
cd backend
npm install
npm start
```

If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
### Frontend
```bash
cd api-frontend
npm install
npm start
```

```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
## Documentation

// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
- **Zcash Setup**: See `docs/zcash-setup/README.md` for complete Zcash infrastructure setup
- **API Documentation**: See `docs/api/` for backend API documentation
- **Architecture**: See `docs/architecture/` for system architecture

// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```
## Configuration

You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
- Zcash configurations: `config/zcash/`
- Backend environment: `backend/.env`
- Frontend configuration: `api-frontend/src/config/`

```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
## Services

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```
- **Backend API**: Node.js with Express
- **Frontend**: React application
- **Zcash Node**: Zebra (modern implementation)
- **Zcash Indexer**: Zaino (unified RPC interface)

## Development

The project uses a modern Zcash stack with Zebra + Zaino for optimal performance and developer experience.
41 changes: 40 additions & 1 deletion backend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,43 @@ MONGODB=mongodb+srv://daviddlovesoyaya_db_user:J7LGqoM6yz36ufse@cluster0.e3uww1n
PORT=3001
NODE_ENV=development
JWT_SECRET=eyJhbGciOiJIUzI1NiIsImtpZCI6Ind2bnI4eGNmWFZXMFdreDkiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3J3YXNvdHBvamZjempsZ3Z4c2xlLnN1cGFiYXNlLmNvL2F1dGgvdjEiLCJzdWIiOiJlZDJjNmM3Zi1kYTAwLTQ1ZDgtYTMyZi1lODc4Zjg3NWE0NTciLCJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNzU4MjE3NTc2LCJpYXQiOjE3NTgyMTM5NzYsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsInBob25lIjoiIiwiYXBwX21ldGFkYXRhIjp7InByb3ZpZGVyIjoiZW1haWwiLCJwcm92aWRlcnMiOlsiZW1haWwiXX0sInVzZXJfbWV0YWRhdGEiOnsiZW1haWxfdmVyaWZpZWQiOnRydWV9LCJyb2xlIjoiYXV0aGVudGljYXRlZCIsImFhbCI6ImFhbDEiLCJhbXIiOlt7Im1ldGhvZCI6InBhc3N3b3JkIiwidGltZXN0YW1wIjoxNzU4MjEzOTc2fV0sInNlc3Npb25faWQiOiIzYjIxZGViZi0zNGRiLTRlMjYtYTJjNy00YjM3NDg4M2Y0NTEiLCJpc19hbm9ueW1vdXMiOmZhbHNlfQ.d3QmKnszfcbe7REM3M6TG5gI8vtBL6XONU0-bB2etVc
JWT_LIFETIME=1d
JWT_LIFETIME=1d


# Server Configuration
PORT=3000
NODE_ENV=production

# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASS=admin
DB_NAME=broadlypaywall


# Zcash RPC Configuration
# Option 1: Public RPC service (for testing/development)
# ZCASH_RPC_URL=https://zcash-mainnet.chainstacklabs.com
# ZCASH_RPC_USER=
# ZCASH_RPC_PASS=

# Option 2: Local Zebra node (uncomment when ready)
ZCASH_RPC_URL=http://localhost:8232
ZCASH_RPC_USER=yourrpcuser
ZCASH_RPC_PASS=yourlongpassword

# Option 3: Local Zaino indexer (uncomment when ready)
# ZCASH_RPC_URL=http://localhost:8233
# ZCASH_RPC_USER=
# ZCASH_RPC_PASS=

# Platform Treasury Address (for fee collection)
PLATFORM_TREASURY_ADDRESS=t1UnEx5GLUk7Dn1kVCzE5ZCPEYMCCAtqPEN

# Security
API_RATE_LIMIT=100
CORS_ORIGIN=http://localhost:3000

# Monitoring
LOG_LEVEL=info
36 changes: 35 additions & 1 deletion backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,38 @@ ZCASH_RPC_PASSWORD=your-rpc-password

# MongoDB Configuration
MONGO_URI=mongodb://localhost:27017
MONGO_DB=boardling
MONGO_DB=boardling# Server Configuration
PORT=3000
NODE_ENV=production

# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_USER=youruser
DB_PASS=yourpass
DB_NAME=zcashpaywall

# Zcash RPC Configuration
ZCASH_RPC_URL=http://127.0.0.1:8232
ZCASH_RPC_USER=yourrpcuser
ZCASH_RPC_PASS=yourlongpassword

# Platform Treasury Address (for fee collection)
PLATFORM_TREASURY_ADDRESS=t1YourPlatformTreasury1111111111111111111

# Security
API_RATE_LIMIT=100
CORS_ORIGIN=http://localhost:3000

# Monitoring
LOG_LEVEL=info

# SDK Configuration
# Default base URL for SDK clients (optional - defaults to server URL)
SDK_DEFAULT_BASE_URL=http://localhost:3000
# Public API URL for external clients (optional)
PUBLIC_API_URL=https://api.yourdomain.com
# Default timeout for SDK requests in milliseconds
SDK_DEFAULT_TIMEOUT=30000
# API version
API_VERSION=v1
72 changes: 72 additions & 0 deletions backend/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Development files
.env*
.env.local
.env.example
nodemon.json
tsconfig.json

# Server-specific files
src/routes/
src/config/
src/middleware/
src/utils/logger.js
src/utils/helpers.js
src/index.js
scripts/
logs/

# Test files
src/sdk/test/
**/*.test.js
coverage/

# Build tools
babel.config.js
jest.config.js

# Documentation (keep only essential docs)
docs/BACKEND_DOCS.md
docs/USER_AND_PAYMENT_SCHEMA_DOCS.md

# Git and IDE files
.git/
.gitignore
.vscode/
.idea/
*.swp
*.swo

# OS files
.DS_Store
Thumbs.db

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Coverage directory used by tools like istanbul
coverage/
.nyc_output

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity
21 changes: 21 additions & 0 deletions backend/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Broadling Paywall Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading