Azap is a full-featured payment application built with Node.js, Express, EJS, and Bootstrap. It integrates the Paystack payment gateway for sending and receiving money, offers a USD exchangers marketplace with Mapbox integration, provides loan request functionality, and includes user authentication with email verification. The app also generates QR codes for receiving payments, sends transaction receipts as PDFs, and has a placeholder for future NFC functionality.
- Authentication: User registration with email verification, login, and logout.
- Payments: Fund wallet and send money using the Paystack payment gateway.
- Wallet Management: Track and manage wallet balance.
- USD Exchangers Marketplace: List exchangers with rates, contacts, and locations displayed on a Mapbox map.
- Loan Requests: Request and view loan status.
- Email Notifications: Sends verification pins and transaction receipts via email.
- PDF Receipts: Generates and emails PDF receipts for transactions.
- QR Codes: Each user has a unique QR code for receiving payments.
- NFC Placeholder: Marked as "Coming Soon" in the dashboard.
- Frontend: Responsive UI with Bootstrap 5.
- Node.js: v16.x or higher
- MongoDB: Local instance or cloud service (e.g., MongoDB Atlas)
- Paystack Account: For payment gateway integration (Paystack)
- Mapbox Account: For map integration (Mapbox)
- Gmail Account: For email notifications (with App Password if 2FA is enabled)
Azap/
├── config/
│ └── db.js # MongoDB connection config
├── controllers/
│ ├── auth.js # Authentication logic
│ ├── payment.js # Payment and exchanger logic
│ └── loan.js # Loan request logic
├── models/
│ ├── user.js # User schema
│ ├── transaction.js # Transaction schema
│ └── loan.js # Loan schema
├── public/
│ ├── css/ # Custom CSS (if any)
│ ├── js/ # Custom JS (if any)
│ └── images/ # Static images
├── routes/
│ ├── auth.js # Auth routes
│ ├── payment.js # Payment routes
│ └── loan.js # Loan routes
├── utils/
│ ├── email.js # Email sending utility
│ ├── pdf.js # PDF generation utility
│ └── qr.js # QR code generation utility
├── views/
│ ├── partials/ # EJS partials (header, footer)
│ ├── auth/ # Login, register, verify pages
│ ├── dashboard.ejs # Main dashboard
│ ├── payment.ejs # Payment page
│ ├── exchangers.ejs # Exchangers marketplace with Mapbox
│ └── loan.ejs # Loan request and status page
├── .env # Environment variables
├── package.json # Dependencies and scripts
├── README.md # This file
└── server.js # Main server file
-
Clone the Repository
git clone https://github.com/yourusername/Azap.git cd Azap -
Install Dependencies
npm install
-
Set Up Environment Variables Create a
.envfile in the root directory and add the following:MONGO_URI=mongodb://localhost/Azap PAYSTACK_SECRET=sk_test_your_paystack_secret_key SESSION_SECRET=your_session_secret EMAIL_USER=your_email@gmail.com EMAIL_PASS=your_app_password PORT=3000 MAPBOX_TOKEN=pk.your_mapbox_access_token_hereMONGO_URI: Your MongoDB connection string.PAYSTACK_SECRET: Your Paystack secret key (from Paystack Dashboard).SESSION_SECRET: A random string for session encryption.EMAIL_USER: Your Gmail address.EMAIL_PASS: An App Password (generate from Google Account if 2FA is enabled).MAPBOX_TOKEN: Your Mapbox access token (from Mapbox Dashboard).
-
Start MongoDB Ensure MongoDB is running locally or use a cloud service like MongoDB Atlas.
-
Run the Application
npm start
The app will start on
http://localhost:3000.
- Register: Go to
http://localhost:3000/auth/register, enter your email and password, and verify your account with the pin sent to your email. - Login: Visit
http://localhost:3000/auth/loginto log in. - Dashboard: View your wallet balance and QR code at
http://localhost:3000/dashboard. - Payments: Fund your wallet or send money at
http://localhost:3000/payment. - Exchangers: Browse the USD exchangers marketplace with a Mapbox map at
http://localhost:3000/payment/exchangers. - Loans: Request a loan or view loan status at
http://localhost:3000/loan. - Logout: End your session at
http://localhost:3000/auth/logout.
- Paystack: Handles wallet funding and payment verification. The callback URL is set to
http://localhost:3000/payment/verifyfor local development. - Mapbox: Displays exchanger locations on a map in the exchangers marketplace.
- Nodemailer: Sends verification emails and transaction receipts via Gmail SMTP.
- Database: Uses MongoDB with Mongoose for data persistence.
- Session Management: Uses
express-sessionwith memory storage (considerconnect-mongofor production). - Frontend: Built with EJS and Bootstrap 5, with Mapbox GL JS for maps.
- Security: Add HTTPS, CSRF protection, and input validation for production use.
- NFC: Currently a placeholder ("Coming Soon") as it requires hardware integration.
- "Missing credentials for 'PLAIN'": Ensure
EMAIL_USERandEMAIL_PASSare set correctly in.env. Use an App Password if Gmail 2FA is enabled. - "req.session.user is undefined": Verify
SESSION_SECRETis set and the user is logged in before accessing protected routes. - Mapbox Not Loading: Check that
MAPBOX_TOKENis valid and correctly included in.env. - Paystack Errors: Ensure
PAYSTACK_SECRETis correct and test payments work in Paystack’s test mode.
- Production Session Store: Use
connect-mongofor persistent sessions. - Exchanger Database: Replace mock exchanger data with a real MongoDB model.
- NFC Integration: Implement NFC payment functionality with hardware support.
- Webhooks: Add Paystack webhook support for robust payment verification.
- User Profiles: Expand user features (e.g., profile editing, transaction history).
Feel free to fork this repository, submit issues, or create pull requests. Contributions are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or support, reach out to samijiyemi@gmail.com.