This repository is my submission for the EASYRICE Full-Stack Developer Junior Exam. The project covers both Frontend and Backend requirements, focusing on the core calculation logic and providing an easy setup process using Docker.
The application covers all 4 required views and their core functionalities:
- Create Inspection: Features strict input validation, dynamic standard fetching (
[GET]/standard), and supports.jsonfile uploads for accurate raw data calculation. - Result (View by ID): Displays the computed Composition (Shape) and Defect Rice (Type) in percentage and weight based on the backend algorithm.
- History (Dashboard): Lists past inspections with partial ID search, date range filtering, and record deletion (
[DELETE]/history). - Edit Result: Allows updating optional parameters (Note, Price, Date, Sampling Point) with automatic
updatedAttimestamp tracking.
The project is built with modern web technologies, focusing on type safety, performance, and clean architecture:
- React & Vite: For a fast and optimized development environment.
- TypeScript: Ensuring type safety across the application.
- React Router v7: Managing navigation across the 4 primary views.
- Axios & Datepicker: Handling API integration and date selection interfaces.
- Node.js & Fastify: For a high-performance and low-overhead server.
- TypeScript: Sharing types and interfaces with the frontend.
- Algorithmic Calculation: Implements the logic required to calculate rice categories by comparing
raw.jsonwithstandards.jsonprior to saving (POST /history). - Database Storage: SQLite database managed with Prisma ORM for robust data persistence.
- Docker: Containerized deployment for a seamless setup experience.
The easiest and fastest way to test the application is by using Docker.
- Make sure you have Docker and Docker Compose installed.
- Run the following command in the root directory:
docker compose up -d --build
- Open your browser:
- Frontend UI: http://localhost:8080
- Backend API: http://localhost:5555
💡Note: The backend SQLite database (
dev.db) is mapped to./backend/datavia Docker volumes, ensuring that your data persists even if the container restarts.
If you prefer to run it manually, ensure you have Node.js installed.
Backend (Terminal 1)
cd backend
npm install
npm run devFrontend (Terminal 2)
cd frontend
npm install
npm run devThe backend provides a RESTful API to manage the inspection lifecycle:
| Method | Endpoint | Description |
|---|---|---|
[GET] |
/standard |
Fetches the list of grading standards for the dropdown. |
[GET] |
/history |
Retrieves all history with search queries (ID) filtering. |
[GET] |
/history/:id |
Retrieves specific inspection details and calculations by ID. |
[POST] |
/history |
Processes the raw JSON grains, calculates defects, and stores data. |
[PUT] |
/history/:id |
Updates optional metadata of an existing inspection result. |
[DELETE] |
/history |
Deletes one or multiple history records based on selected IDs. |