The Budget Planner is a full-stack web application designed to help users manage their finances, create budgets, track transactions, and collaborate with others in real-time. The project is structured as a monorepo with separate frontend, backend, and database components.
The backend is built on Node.js with Express.js as the web framework. The server runs on port 5000 in development mode and integrates Socket.IO for real-time communication capabilities. The Express application includes comprehensive route handlers for authentication, budgets, transactions, users, reports, invitations, notifications, and categories. Global middleware handles CORS configuration and error handling to ensure secure cross-origin requests and proper error propagation.
User authentication is implemented using JSON Web Tokens (JWT) with the secret stored in environment variables. The JWT middleware verifies tokens from the Authorization header in "Bearer TOKEN" format and attaches the decoded user payload to requests. Authentication logic handles user registration, login, profile retrieval, password reset, and forgot password functionality. Login endpoints return a JWT token along with complete user information including avatar URLs.
The application uses PostgreSQL as its relational database, connecting via a connection pool with SSL support configured for production environments. The connection string specifies the user "postgres" with the associated password. Database initialization creates the necessary schema, while migrations are managed through sequential SQL file execution. Migration scripts read files from the migrations directory alphabetically and execute them in order, ensuring consistent database schema versioning across environments.
Socket.IO is configured with CORS settings pointing to the frontend URL and includes JWT authentication middleware to verify socket connections. Users join private notification rooms based on their user ID, enabling targeted real-time notifications. The socket system registers event handlers for budget and user events, with a centralized socket manager coordinating all real-time operations.
The backend is configured through environment variables including Node environment (development), server port, PostgreSQL connection details, JWT secret for token signing, and frontend URL for CORS. Email credentials are provided for the mail service, allowing the application to send notifications and password reset emails through Gmail's SMTP service.
The frontend is built with React and Tailwind CSS, running on port 3000 during development. CORS middleware allows requests from the frontend origin with proper credential support, enabling seamless communication between the frontend and backend services.
Tech Stack