- Usage
- Problem Statement
- Approach
- Idea / Solution
- Dependencies
- Future Scope
- Technology Stack
- Deployment
Upon running npm start
, the server is running and listens on localhost:3000. Queries can be made using either the card_id or user_mobile parameters.
To search using the card_id: http://localhost:3000/get_card_status?card_id=ZYW7631
To search using the mobile number: http://localhost:3000/get_card_status?user_mobile=534534534
The challenge is to process data provided by various companies in separate CSV files. This data is fragmented, and comprehensive information about a user's card is not readily available. To support customer service agents and for internal tracking purposes, an endpoint /get_card_status needs to be created. This endpoint should accept either the userβs phone number or the card ID and return the status of the card.
- PostgreSQL - Database: Utilized for data storage as per the requirement to implement a persistent database.
- Express - Server Framework: Chosen for its flexibility, modularity, and support for middlewares. Its active community, extensive documentation, and supports majorly every service.
- Node.js - Server Environment: Selected for its efficient request handling, enabling the use of JavaScript/TypeScript for both frontend and backend development. Node.js boasts a vast ecosystem of open-source libraries and packages, making it highly scalable.
- Prisma - Database Toolkit: Employed for its support of multiple database services, connection pooling capabilities, and auto-generated CRUD operations. Prisma also facilitates real-time data synchronization.
The project relies on dependencies such as Express, CSV, Moment, and pg. Using neon.tech for a postgres database
- Security Enhancements: Implementation of role-based access control, regular auditing and patching of dependencies, and utilization of encryption techniques to safeguard sensitive data.
- Automated CSV Upload: Instead of manual CSV file loading, an endpoint could be developed to enable file uploads, automatically updating the database.
- Using a Serverless backend: We can shift the backend to server-less using cloudflare workers.
To run the application using Docker, follow these steps:
-
Build the Docker image using the provided Dockerfile:
docker-compose build
-
Run the docker image
docker-compose up
Deployed on Render js using the github repo
https://csv-endpoint.onrender.com/
Deployed on Render js using the docker image
https://basic-csv-app.onrender.com
As the services used are of free tier, might take time to boot up.