Skip to content

sorravit-te/Rice-Inspection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rice Inspection App

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.


Key Features

The application covers all 4 required views and their core functionalities:

  • Create Inspection: Features strict input validation, dynamic standard fetching ([GET] /standard), and supports .json file 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 updatedAt timestamp tracking.

Tech Stack

The project is built with modern web technologies, focusing on type safety, performance, and clean architecture:

Frontend

React Vite TypeScript React Router Axios

  • 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.

Backend & Infrastructure

Node.js Fastify TypeScript Prisma SQLite Docker

  • 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.json with standards.json prior to saving (POST /history).
  • Database Storage: SQLite database managed with Prisma ORM for robust data persistence.
  • Docker: Containerized deployment for a seamless setup experience.

How to Run

1. Running with Docker (Recommended)

The easiest and fastest way to test the application is by using Docker.

  1. Make sure you have Docker and Docker Compose installed.
  2. Run the following command in the root directory:
    docker compose up -d --build
  3. Open your browser:

💡Note: The backend SQLite database (dev.db) is mapped to ./backend/data via Docker volumes, ensuring that your data persists even if the container restarts.

2. Alternative: Running Locally (Without Docker)

If you prefer to run it manually, ensure you have Node.js installed.

Backend (Terminal 1)

cd backend
npm install
npm run dev

Frontend (Terminal 2)

cd frontend
npm install
npm run dev

API Reference

The 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.

About

My submission for the EASYRICE Full-Stack Developer Junior Exam

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages