{"id":32928435,"url":"https://github.com/sushan766/fintrack-api","last_synced_at":"2026-04-11T02:37:45.148Z","repository":{"id":323465130,"uuid":"1093327386","full_name":"SushAN766/fintrack-api","owner":"SushAN766","description":"A secure and scalable Node.js + MySQL backend for managing personal finances — with authentication, multi-wallet tracking, budgeting, and monthly financial reports.","archived":false,"fork":false,"pushed_at":"2025-11-10T08:56:43.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-10T10:23:25.707Z","etag":null,"topics":["expressjs","jwt","mysql","nodejs","postman"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SushAN766.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-10T08:16:11.000Z","updated_at":"2025-11-10T08:56:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/SushAN766/fintrack-api","commit_stats":null,"previous_names":["sushan766/fintrack-api"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/SushAN766/fintrack-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SushAN766%2Ffintrack-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SushAN766%2Ffintrack-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SushAN766%2Ffintrack-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SushAN766%2Ffintrack-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SushAN766","download_url":"https://codeload.github.com/SushAN766/fintrack-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SushAN766%2Ffintrack-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283831385,"owners_count":26902062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-11T02:00:06.610Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expressjs","jwt","mysql","nodejs","postman"],"created_at":"2025-11-11T10:00:39.737Z","updated_at":"2025-11-11T10:01:39.606Z","avatar_url":"https://github.com/SushAN766.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Personal Finance Management Application \n\nA **Node.js + MySQL backend** that helps users manage personal finances effectively.  \nIt allows users to **track income and expenses**, manage **multiple wallets**, set **monthly budgets**, and generate **financial reports**.  \nBuilt with **Express.js** and **JWT authentication**, ensuring secure and reliable performance.\n\n---\n## Features\n\n- **Authentication:** Secure login \u0026 registration with JWT; passwords hashed using bcrypt.  \n- **Wallets:** Create, view, and delete multiple wallets with auto-updated balances.  \n- **Transactions:** Add, edit, delete income/expense records; filter by wallet or date.  \n- **Budgets:** Set monthly category budgets and get alerts when nearing limits.  \n- **Reports:** View total income, expenses, and savings summary for the month.\n---\n\n## Tech Stack\n\n| Category | Technology |\n|-----------|-------------|\n| Runtime | Node.js |\n| Framework | Express.js |\n| Database | MySQL |\n| Authentication | JWT (jsonwebtoken) |\n| Security | bcrypt, dotenv |\n| Testing | Postman |\n| Version Control | Git \u0026 GitHub |\n| Language | JavaScript (ES6+) |\n\n---\n\n## API Endpoints\n\n### Authentication\n| Method | Endpoint | Description |\n|--------|-----------|-------------|\n| POST | `/api/auth/register` | Register a new user |\n| POST | `/api/auth/login` | Log in and receive a JWT token |\n\n---\n\n### Wallets\n| Method | Endpoint | Description |\n|--------|-----------|-------------|\n| POST | `/api/wallets` | Create a new wallet |\n| GET | `/api/wallets` | Retrieve all wallets |\n| DELETE | `/api/wallets/:walletId` | Delete a specific wallet |\n\n---\n\n### Transactions\n| Method | Endpoint | Description |\n|--------|-----------|-------------|\n| POST | `/api/transactions` | Add a new income or expense transaction |\n| GET | `/api/transactions` | Retrieve transactions (supports wallet \u0026 date filters) |\n| DELETE | `/api/transactions/:transactionId` | Delete a transaction |\n\n---\n\n### Budgets\n| Method | Endpoint | Description |\n|--------|-----------|-------------|\n| POST | `/api/budgets` | Set a monthly budget for a category |\n| GET | `/api/budgets` | View all budgets for the current month |\n\n---\n\n### Report\n| Method | Endpoint | Description |\n|--------|-----------|-------------|\n| GET | `/api/report` | Get total income, expenses, and savings summary for the month |\n\n\n---\n\n## Folder Structure\n\n```\nPFM-BACKEND/\n├── helpers/\n│ └── budgets.js\n├── middleware/\n│ └── auth.js\n├── node_modules/\n├── postman/\n│ └── personal-finance-api.postman_collection.json\n├── routes/\n│ ├── auth.js\n│ ├── budgets.js\n│ ├── report.js\n│ ├── transactions.js\n│ └── wallets.js\n├── .env # private (ignored)\n├── .env.example # safe example for setup\n├── .gitignore\n├── app.js\n├── db.js\n├── package.json\n├── package-lock.json\n└── README.md\n```\n---\n\n## Environment Setup\n\n### 1. Clone the Repository\n```bash\ngit clone https://github.com/\u003cyour-username\u003e/finance-management-api.git\ncd finance-management-api\n```\n---\n\n### 2. Install Dependencies\nInstall all project dependencies using:\n\n```bash\nnpm install\n```\n---\n\n### 3. Configure Environment Variables\n\nCreate a `.env` file in the root directory (this file is ignored by GitHub):\n\n```env\nPORT=4000\nDB_HOST=localhost\nDB_USER=root\nDB_PASSWORD=your_mysql_password\nDB_NAME=pfm\nJWT_SECRET=your_secure_jwt_secret\nJWT_EXPIRES_IN=7d\n```\n\u003e ⚠️ **Note:** Do not upload your `.env` file to GitHub — it is ignored by `.gitignore` for security.\n\n---\n\n### 4. Create MySQL Database\n\nOpen your MySQL terminal or client and run the following commands:\n\n```sql\nCREATE DATABASE pfm;\nUSE pfm;\n```\n---\n\n### 5. Start the Server\n\nRun the development server using:\n\n```bash\nnpm run dev\n```\n---\n\n## Testing with Postman — Personal Finance API\n\n### Setup \u0026 Import\n\n1. **Open Postman** → Go to `File → Import`\n2. **Paste the file path:**\n`postman/personal-finance-api.postman_collection.json`\n\n3. **Set the environment variable:**\n`base_url = http://localhost:4000`\n\n---\n\n## Authentication\n\n### 1. Register User\n**Endpoint:**  \n`POST /api/auth/register`\n\n**Body:**\n```json\n{\n  \"email\": \"john@example.com\",\n  \"password\": \"123456\"\n}\n```\n---\n\n### 2.Login\n**Endpoint:**\n`POST /api/auth/login`\n**Response:**\n```json\n{\n  \"token\": \"eyJhbGciOiJIUzI1NiIs...\",\n  \"user\": { \"id\": 1, \"email\": \"john@example.com\" }\n}\n```\n---\n\n### 3. Use the Token\n**In Postman → Headers, set:**\n```\nAuthorization: Bearer \u003cyour_token_here\u003e\n```\n---\n\n### 4. Test All Endpoints\n\n| **Action**           | **Method** | **Endpoint**           |\n|-----------------------|------------|------------------------|\n| Create Wallet         | POST       | `/api/wallets`         |\n| Add Transaction       | POST       | `/api/transactions`    |\n| View Budgets          | GET        | `/api/budgets`         |\n| Get Monthly Report    | GET        | `/api/report`          |\n\n---\n\n## Sample Outputs\n**Create Wallet**\n```json\n{\n  \"id\": 1,\n  \"name\": \"Cash\",\n  \"balance\": 5000\n}\n```\n---\n\n**Add Transaction**\n```json\n{\n  \"success\": true\n}\n```\n---\n\n**Get Financial Report**\n```json\n{\n  \"month\": \"2025-11\",\n  \"income\": 0,\n  \"expense\": \"100.00\",\n  \"savings\": -100\n}\n```\n---\n\n## Security Practices\n\n- **JWT token authentication** for all protected routes  \n- **Passwords hashed** using `bcrypt`  \n- **SQL injection prevention** with prepared statements  \n- **Environment variables** stored in `.env`  \n- **.env** file ignored via `.gitignore`\n\n---\n\n\n## Postman Collection\n\n**Location:**  \n`postman/personal-finance-api.postman_collection.json`\n\nYou can import this collection directly into **Postman** for quick and easy testing.\n\n---\n\n\n## Tips\n\n- Ensure your backend server is running at:\nhttp://localhost:4000\n- Check that your database connection is active.\n- Re-login to generate a new token when the old one expires.\n\n---\n\n\n\u003cp align=\"center\"\u003e© 2025 \u003cb\u003ePersonal Finance API\u003c/b\u003e — Secure. Simple. Smart.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsushan766%2Ffintrack-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsushan766%2Ffintrack-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsushan766%2Ffintrack-api/lists"}