A Node.js application for tracking personal expenditures, including modes of payment, investments, loans, credit cards, and bill payments. This application is built with a modern tech stack including Express, MongoDB, and follows Domain-Driven Design (DDD) principles with comprehensive logging and testing.
- User management (create, read, update, delete)
- Account management
- Track expenditures across different categories
- Logging with Winston
- Testing with Mocha and Chai
- Node.js
- Express.js
- MongoDB
- Mongoose
- Mocha and Chai for testing
- Winston for logging
-
Clone the repository: bash git clone https://github.com/your-username/personal-expenditures.git cd personal-expenditures
-
Install dependencies: bash npm install
-
Set up environment variables: Create a
.env
file in the root directory and add your MongoDB URI: env MONGODB_URI=mongodb://localhost:27017/personal_expenditures
-
Start the server: bash npm start
The server will start on
http://localhost:3000
.
-
Run tests: bash npm test
This will run the tests located in the
test
directory using Mocha and Chai.
-
Create User:
POST /api/users/auth/register
- Request Body:
{ "name": "John Doe", "email": "[email protected]", "password": "password123" }
- Response:
201 Created
- Request Body:
-
Login User:
POST /api/users/auth/login
- Request Body:
{ "email": "[email protected]", "password": "password123" }
- Response:
200 Created
- Request Body:
-
Get All Users:
GET /api/users
- Response:
200 OK
, returns an array of users
- Response:
-
Get User:
GET /api/users/:id
- Response:
200 OK
, returns user
- Response:
-
Create Account:
POST /api/accounts
- Request Body:
{ "name": "Savings", "type": "bank" }
- Response:
201 Created
- Request Body:
-
Get All Accounts:
GET /api/accounts
- Response:
200 OK
, returns an array of accounts
- Response:
The application uses Winston for logging. Logs are written to:
error.log
: Logs error messagescombined.log
: Logs all messages
In development, logs are also output to the console.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature-name
) - Commit your changes (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin feature/your-feature-name
) - Open a pull request
This project is licensed under the MIT License. See the LICENSE file for details.