Skip to content

πŸ’Ό Budgetly API – A secure, scalable backend for the Budgetly app: a personal finance tracker for students and individuals, powered by Node.js, Express, MongoDB, and OpenAI. Supports expense/income tracking, AI financial insights, JWT authentication, and clean RESTful APIs.

License

Notifications You must be signed in to change notification settings

Shaan3274/Budgetly-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Ό Budgetly API

Backend server for the Budgetly personal finance app β€” track expenses, incomes, and get AI-powered spending insights. Built with Node.js, Express, MongoDB, and OpenAI API.


πŸš€ Features

  • πŸ” JWT Authentication (Register/Login)
  • πŸ’Έ Track income and expenses in one schema
  • πŸ“Š AI-generated budget insights and savings suggestions
  • 🧠 Logs all user AI queries for future reference
  • 🧾 REST API with clean endpoints
  • 🌐 CORS and environment-based config

🧱 Tech Stack

Layer Tool
Server Node.js + Express.js
Auth JWT
Database MongoDB + Mongoose
AI Engine OpenAI API
Middleware CORS, dotenv

πŸ“ Folder Structure

/budgetly-api
β”œβ”€β”€ index.js
β”œβ”€β”€ package.json
β”œβ”€β”€ .env
β”œβ”€β”€ /routes
β”‚   └── authRoutes.js
β”‚   └── transactionsRoutes.js
β”‚   └── aiPromptRoutes.js
β”œβ”€β”€ /controllers
β”‚   └── authController.js
β”‚   └── transactionsController.js
β”‚   └── aiPromptsController.js
β”œβ”€β”€ /middleware
β”‚   └── verifyJWT.js
β”œβ”€β”€ /models
β”‚   └── User.js
β”‚   └── Transaction.js
β”‚   └── AIPrompt.js

πŸ§ͺ API Endpoints

Method Endpoint Description
POST /api/register Register a new user
POST /api/login Login and get token
GET /api/transactions Get user's transactions
POST /api/transactions Add new income/expense
PUT /api/transactions Edit income/expense
POST /api/ai/generate Get AI insight response

βš™οΈ Environment Variables

Create a .env file in the root with the following:

PORT=3000
MONGO_URI=your_mongo_connection_string
JWT_SECRET=your_very_secure_jwt_secret
OPENAI_API_KEY=sk-xxxxxx

▢️ Running the Project

npm install
npm run dev

Make sure MongoDB is running locally or provide a MongoDB Atlas URI.


πŸ” JWT Auth Middleware

This backend uses JWT for protected routes. Send the token in headers like so:

Authorization: Bearer <your-token>

πŸ“Œ Roadmap

  • Auth & basic transactions
  • AI integration (OpenAI)
  • Budget summaries by month
  • Expense category analytics
  • Email reports (SendGrid)
  • Push notifications (via Firebase FCM)

🀝 License

MIT β€” feel free to fork, learn, and build your own budget tracker!


🧠 Author

Shan Ayub β€” LinkedIn

For full project UI & wireframes, see the frontend repo: budgetly-app

About

πŸ’Ό Budgetly API – A secure, scalable backend for the Budgetly app: a personal finance tracker for students and individuals, powered by Node.js, Express, MongoDB, and OpenAI. Supports expense/income tracking, AI financial insights, JWT authentication, and clean RESTful APIs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published