About • Starting • API Routes • Technologies • Features
The Expense Tracker API is a RESTful service designed to help users efficiently manage and monitor their personal or business finances. It offers features for tracking expenses and categorizing spending.
This project is my solution for Expense tracker from roadmap.sh website.
- Node.js (v22 or above)
- Neon Database
- TypeScript
- Clone the repository
git clone https://github.com/isaqueDaSilva/Expense-Tracker-API.git
cd Expense-Tracker-API- Install Dependencies
npm install- Configure environment variables Create a `.env` file on root of the project based on `.env.example`:
DATABASE_URL=postgres://your_user:your_password@localhost:5432/expense_tracker
PORT=3000
HOSTNAME='127.0.0.1'
JWT_ACCESS_SECRET=secret_for_access_jwt_token
JWT_REFRESH_SECRET=secret_for_refresh_jwt_token
JWT_ISSUER=secret_for_jwt_issuer_identifier- Perform database migrations
npm run migrate- Start server
npm run build| Route | Method | Description |
|---|---|---|
| /auth/signup | POST | Create a new account |
| /auth/signin | POST | Log in |
| /token/verify | GET | Verify access token |
| /token/refresh | PUT | Refresh access token |
| /auth/signout | DELETE | Log out |
| /auth/delete-account | DELETE | Deletes user account |
| Route | Method | Description |
|---|---|---|
| /category/create | POST | Create a new category |
| /category/all/:page | GET | List categories (paginated) |
| /category/get/:id | GET | Get a category by ID |
| /category/:id/update | PATCH | Updates a category |
| /category/:id/delete | DELETE | Deletes a category |
| Route | Method | Description |
|---|---|---|
| /task/create | POST | Creates a new expense |
| /task/all/:page | GET | List expenses (paginated) |
| /task/all/:category/:page | GET | List expenses by categories (paginated) |
| /task/byDate/:page | GET | List expenses by date range (paginated) |
| /task/get/:id | GET | Gets an expense by ID |
| /task/update/:id | PATCH | updates an expense |
| /task/:id/delete | DELETE | deletes an expense |
POST /task/create
{
"title": "Monthly Purchases",
"description": "Monthly market",
"value": 500.00,
"date": "2025-10-06",
"category": "category-uuid"
}POST /category/create
{
"title": "Food"
}- TypeScript
- Node.js
- PostgreSQL (via Neon Serverless)
- Zod (Validations)
- JSON Web Token (Authentication)
- bcrypt (password hash)
- ✅ Secure authentication with JWT
- ✅ Complete expense and category CRUD
- ✅ Expense categorization
- ✅ Date and category filters
- ✅ Results pagination
- ✅ Standard category system
- ✅ Robust data validation
- ✅ Route protection
- ✅ Token refresh
- Passwords stored with bcrypt hash
- JWT tokens with expiration
- Token refresh system
- Data validation with Zod
- SQL injection protection
- Token deactivation system
- Users: Account Management
- Categories: Expense Management
- Expenses: Expense Tracking
- Tokens: Session Control