A secure Node.js & Express REST API for the myWallet personal finance application.
- 🔐 JWT Authentication - Secure user registration and login
- 💼 Wallet Management - CRUD operations for multiple user wallets
- 💸 Transaction Engine - Automated balance updates and reversal logic
- 📁 Categories - Custom transaction categories with icons and colors
- 📊 Budgets & Savings - Monthly budget tracking and goal management
- 🛡️ Ownership Guard - Data isolation per user via middleware
- Node.js - Runtime environment
- Express.js - Web framework
- TypeScript - Type safety
- Prisma - ORM for database management
- PostgreSQL - Relational database
- JWT - Secure authentication
- Zod - Schema validation
- Helmet/CORS - Security headers
- Node.js 18+
- PostgreSQL instance running
npmoryarn
-
Clone and Navigate
cd myWalletBackend -
Install Dependencies
npm install
-
Configure Environment Create a
.envfile in the root directory:PORT=4000 DATABASE_URL="postgresql://user:password@localhost:5432/mywallet" JWT_SECRET="your_secure_secret_here"
-
Initialize Database
npx prisma db push npx prisma generate
-
Start Dev Server
npm run dev
The API will be available at
http://localhost:4000.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register a new user |
| POST | /api/auth/login |
Login and get JWT |
| GET | /api/wallets |
Get user wallets |
| POST | /api/transactions |
Create transaction (updates balance) |
| DELETE | /api/transactions/:id |
Delete transaction (reverts balance) |
| GET | /api/categories |
Get transaction categories |
myWalletBackend/
├── src/
│ ├── controllers/ # Request handlers & logic
│ ├── middlewares/ # Auth and security
│ ├── routes/ # Express router definitions
│ ├── utils/ # DB & shared helpers
│ └── index.ts # Entry point
├── prisma/ # Schema & migrations
└── .env # Configuration
Private / Proprietary.