https://github.com/rafaumeu/dt-money-api
π°π DT Money JSON Server on Vercel: Serverless financial transactions API. Full CRUD, pagination & filters. Easy GitHub deploy, flexible endpoints for seamless money management. Build powerful financial apps fast! πΈβ¨
https://github.com/rafaumeu/dt-money-api
Last synced: 3 months ago
JSON representation
π°π DT Money JSON Server on Vercel: Serverless financial transactions API. Full CRUD, pagination & filters. Easy GitHub deploy, flexible endpoints for seamless money management. Build powerful financial apps fast! πΈβ¨
- Host: GitHub
- URL: https://github.com/rafaumeu/dt-money-api
- Owner: rafaumeu
- License: mit
- Created: 2024-12-13T14:32:45.000Z (6 months ago)
- Default Branch: feature-transport
- Last Pushed: 2025-01-15T15:37:17.000Z (5 months ago)
- Last Synced: 2025-01-26T19:16:54.581Z (4 months ago)
- Language: JavaScript
- Homepage: https://dt-money-api-sigma.vercel.app
- Size: 41 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
I'll convert the document into a well-formatted Markdown README for the DT Money JSON Server deployment to Vercel.
# DT Money - JSON Server Deployment to Vercel π°π
## Deployment Overview
This project demonstrates how to deploy the DT Money project's JSON Server to Vercel, enabling a live, hosted fake REST API for financial transactions.
## Project Structure
- **Database**: Transactions data from `server.json`
- **API Endpoint**: Provides RESTful access to financial transactions
- **Deployment**: Hosted on Vercel## Features
- β Full CRUD operations for transactions
- β Pagination support
- β Sorting and filtering capabilities
- β Serverless deployment## Deployment Steps
### Prerequisites
- GitHub Account
- Vercel Account
- Node.js installed### Deployment Process
#### 1. Prepare Repository
```bash
# Clone the repository
git clone https://github.com/rafaumeu/dt-money.git
cd dt-money
```#### 2. Create Vercel Configuration Files
- `db.json`: Database snapshot
- `api/server.js`: JSON Server configuration
- `vercel.json`: Deployment settings#### 3. Install Dependencies
```bash
npm install json-server
```#### 4. Configure Vercel Deployment
- Log in to Vercel
- Import GitHub repository
- Set framework preset to "Other"
- Deploy project## API Endpoints
### Transactions
- `GET /api/transactions`: List all transactions
- `GET /api/transactions?_page=1&_limit=10`: Paginated transactions
- `GET /api/transactions?q=search_term`: Search transactions
- `POST /api/transactions`: Create new transaction
- `PUT /api/transactions/:id`: Update transaction
- `DELETE /api/transactions/:id`: Delete transaction## Example Queries
### Fetch Transactions
```javascript
// Fetch first page with 10 items, sorted by date
fetch('https://your-vercel-deployment.vercel.app/api/transactions?_page=1&_limit=10&_sort=createdAt&_order=desc')
```### Create Transaction
```javascript
fetch('https://your-vercel-deployment.vercel.app/api/transactions', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
description: 'Freelance Work',
price: 3000,
type: 'income',
category: 'ServiΓ§os',
createdAt: new Date().toISOString()
})
})
```## Frontend Configuration
Update `src/lib/axios.ts`:
```typescript
export const api = axios.create({
baseURL: process.env.NODE_ENV === 'production'
? 'https://your-vercel-deployment.vercel.app/api'
: 'http://localhost:3333'
})
```## Best Practices
- Always use environment variables for API URLs
- Implement proper error handling
- Add authentication for production (future enhancement)## Technologies
- JSON Server
- Vercel
- TypeScript## Troubleshooting
- Ensure CORS settings are correctly configured
- Check Vercel logs for deployment issues
- Verify API endpoint URLs## Contributing
1. Fork the project
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Open a Pull Request## License
This project is licensed under the MIT License.
---
Developed with π by Rafael Dias Zendron
Powered by Vercel π