A full-stack wallet application built with Next.js, Prisma, and PostgreSQL. This application allows users to manage their balances, perform P2P transfers, and handle on-ramp transactions.
graph TD
subgraph Frontend
UI[Next.js UI]
API[API Routes]
end
subgraph Backend
DB[(PostgreSQL)]
PR[Prisma ORM]
end
subgraph Authentication
AUTH[Auth System]
end
subgraph Features
P2P[P2P Transfer]
ONRAMP[On-Ramp]
BAL[Balance]
end
UI --> API
API --> PR
PR --> DB
AUTH --> API
API --> P2P
API --> ONRAMP
API --> BAL
P2P --> PR
ONRAMP --> PR
BAL --> PR
style Frontend fill:#f9f,stroke:#333,stroke-width:2px
style Backend fill:#bbf,stroke:#333,stroke-width:2px
style Authentication fill:#bfb,stroke:#333,stroke-width:2px
style Features fill:#fbb,stroke:#333,stroke-width:2px
-
Frontend Layer
- Next.js UI components handle user interactions
- API Routes process requests and communicate with the backend
-
Backend Layer
- Prisma ORM manages database operations
- PostgreSQL stores all application data
-
Authentication Layer
- Handles user authentication and authorization
- Secures API endpoints
-
Feature Layer
- P2P Transfer: Manages peer-to-peer transactions
- On-Ramp: Handles external fund deposits
- Balance: Manages user account balances
- Node.js (v18 or higher)
- npm or yarn
- PostgreSQL database (or Neon.tech account for hosted PostgreSQL)
- Git
├── apps/
│ ├── bank_webhook_handler/ # Bank webhook processing service
│ │ ├── src/ # Source code
│ │ └── package.json # Service dependencies
│ ├── user-app/ # User-facing Next.js application
│ │ ├── app/ # Next.js app directory
│ │ ├── api/ # API routes
│ │ └── package.json # App dependencies
│ └── merchant-app/ # Merchant dashboard application
│ ├── app/ # Next.js app directory
│ ├── api/ # API routes
│ └── package.json # App dependencies
├── packages/
│ ├── db/ # Database package with Prisma
│ │ ├── prisma/ # Database schema and migrations
│ │ └── src/ # Database utilities
│ ├── ui/ # Shared UI components
│ │ ├── components/ # Reusable components
│ │ └── styles/ # Global styles
│ └── web/ # Shared web utilities
│ ├── api/ # Shared API utilities
│ └── lib/ # Common functions
├── package.json # Root package.json
├── turbo.json # Turborepo configuration
├── tsconfig.json # TypeScript configuration
└── README.md
-
Clone the repository
git clone <repository-url> cd <project-directory>
-
Install dependencies
npm install
-
Set up environment variables
Create a
.envfile in thepackages/dbdirectory:DATABASE_URL="your_postgresql_database_url"Create a
.envfile in thepackages/webdirectory:NEXT_PUBLIC_API_URL="http://localhost:3000" -
Set up the database
cd packages/db npx prisma generate npx prisma db push -
Start the development server
cd ../web npm run dev
The application will be available at http://localhost:3000
- User authentication
- Balance management
- P2P transfers
- On-ramp transactions
- Merchant integration
- Real-time balance updates
The application uses the following main models:
- User: Stores user information and authentication details
- Balance: Manages user balances
- p2pTransfer: Handles peer-to-peer transfers
- OnRampTransaction: Manages on-ramp transactions
- Merchant: Stores merchant information
If you encounter any issues:
-
Prisma Client Generation Issues
- Make sure you're in the correct directory (
packages/db) - Run
npx prisma generatewith administrator privileges - Check if the database URL is correct in your
.envfile
- Make sure you're in the correct directory (
-
Database Connection Issues
- Verify your database credentials
- Ensure your database is running and accessible
- Check if your IP is whitelisted (if using a hosted database)
-
Build Issues
- Clear the
.nextcache:rm -rf .next - Remove
node_modulesand reinstall dependencies - Check for any TypeScript errors
- Clear the
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.