https://github.com/johnnyfr26/api.thinktech
Api build with nodeJs for financial management service
https://github.com/johnnyfr26/api.thinktech
api-rest fastify nodejs prisma-orm test-automation typescript
Last synced: about 2 months ago
JSON representation
Api build with nodeJs for financial management service
- Host: GitHub
- URL: https://github.com/johnnyfr26/api.thinktech
- Owner: johnnyFR26
- Created: 2025-02-22T20:06:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-03T21:43:22.000Z (over 1 year ago)
- Last Synced: 2025-03-03T22:28:56.298Z (over 1 year ago)
- Topics: api-rest, fastify, nodejs, prisma-orm, test-automation, typescript
- Language: TypeScript
- Homepage: https://api-thinktech.vercel.app
- Size: 45.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ Financial Management API
A robust financial management and expense control API built with **Fastify**, **Prisma**, **Zod**, **JWT**, and **Bcrypt**. This API allows secure authentication, user management, and financial transaction tracking to support financial management applications.
---
## ๐ Features
- **User Authentication:** Secure login with **JWT**.
- **Data Validation:** Strong validation using **Zod**.
- **Password Security:** Hashing and verification with **Bcrypt**.
- **Database ORM:** **Prisma** for robust and easy database management.
- **Fast and Lightweight:** Built with **Fastify** for performance.
- **Financial Management:** Manage income, expenses, and budget efficiently.
---
## ๐ ๏ธ Tech Stack
- **Node.js**
- **Fastify**
- **Prisma**
- **Zod**
- **JWT (JsonWebToken)**
- **Bcrypt**
- **PostgreSQL**
---
## ๐ Project Structure
```
financial-management-api/
โโ controllers/ # Business logic
โโ lib/ # External library configurations (e.g., Prisma client)
โโ middlewares/ # Authentication and validation middleware
โโ models/ # Interfaces of TS
โโ routes/ # API endpoints
โโ tests/ # Unit and integration tests
โโ index.ts # Application entry point
```
---
## ๐ฅ Getting Started
### 1. **Clone the repository:**
```sh
git clone https://github.com/johnnyFR26/api.thinktech.git
cd api.thinktech
```
### 2. **Install dependencies:**
```sh
npm install
```
### 3. **Set up environment variables:**
Create a `.env` file in the root directory with the following variables:
```env
DATABASE_URL="file:./dev.db" # For SQLite (or use a PostgreSQL connection string)
JWT_SECRET="your_secret_key"
```
### 4. **Run Prisma migrations:**
```sh
npx prisma migrate dev --name init
```
### 5. **Start the server:**
```sh
npm run dev
```
Access at: [http://localhost:3000](http://localhost:3000)
---
## ๐ฆ **API Endpoints**
### Authentication
- `POST /auth/login` - Authenticate a user and receive a JWT.
### User Management
- `GET /users` - Get all users.
- `POST /users` - Create a new user.
### Financial Transactions
- `GET /transactions` - Get all financial transactions.
- `POST /transactions` - Create a new transaction.
- `DELETE /transactions/:id` - Delete a transaction.
---
## ๐งช **Running Tests**
```sh
npm run test
```
---
## ๐ **Security Best Practices**
- Store secrets in environment variables.
- Hash passwords before saving to the database.
- Validate all input with **Zod**.
- Use HTTPS in production.
---
## ๐ **License**
This project is licensed under the MIT License.
---
## ๐จโ๐ป **Contributing**
Feel free to open issues or submit pull requests to help improve this project!