Capstone Project for Computer Engineering, Chulalongkorn University
heater-api(Heater API): API Server that controls the Heater via GPIO with PID Logic (Python FastAPI app with RPi.GPIO)ls-api(Lingangu API): Lakeshore Management API (Python FastAPI app connecting USB Serial to Lakeshore Devices)rice-shower(Rice Shower): Data Collector for Lingangu API and Temperature API. It also serves as a TSDB query server for the dashboard app. (Bun + Elysia)simulator(Environment Simulator): Simulator for Foam Box, works as stub/mocks for lgg-api and heater-api (Bun + Elysia)web(Web Dashboard): Dashboard Application (Next.js)
api-client: API Client for each API services usingopenapi-generatorconfig: ESLint and TypeScript configurationstsdb: Database Schema for TimescaleDB
ui: React UI Component Library powered by Shadcn UI
.env.dev and .env.lab are located in the folder of each apps/packages,
most of them are already setup for local development,
for lab mode you may need to change some values (like IP addresses).
When you edit IP Addresses for lab mode, please do not commit the changes.
This repository has two languages and three runtimes: TypeScript (Node.js and Bun) and Python.
Use node.js with the version specified in .nvmrc file (currently lts/krypton or 24 LTS). Running node -v should output v24.x.x.
Recommend using nvm (Node Version Manager) to manage Node.js versions. Install nvm from nvm-sh/nvm.
Run corepack enable to enable Corepack, then run pnpm -v to verify that the version of pnpm matches the version specified in package.json.
Install Bun from bun.com.
Note that pnpm is still used as the package manager for Bun projects. You can run pnpm dev which will delegate to Bun.
Install Python with version specified in .python-version file (currently 3.13) and use uv (Universal Version Manager) to manage Python versions. Install uv from astral-sh/uv and run uv sync to install the dependencies.
Make sure you have Docker Desktop or Orbstack installed.
These are the container you will be running for local developments:
- timescaledb: TimescaleDB (A time-series database built on PostgreSQL)
- (Optional) grafana: Grafana (For testing SQL queries locally)
You can run these containers using docker-compose.yaml file provided in the root of this repository:
docker compose up -dGo to packages/tsdb, .env should already be setup for local development.
Then run pnpm db:migrate to setup the database schema.
Use command pnpm run dev to run all services with mock devices that connects
to the simulator. .env.dev is already set and should not require any changes.
Lab Mode is when you are using the real devices (Lakeshore 240 and Heater)
To run Lab Mode, make sure you filled in neccessary IPs in .env.lab files in each apps that requires it.
Then on laptop, run pnpm run lab:laptop and on Pi, run pnpm run lab:pi to start the services in Lab Mode.
To make uv work correctly on Raspberry Pi, you have to add RPi.GPIO to the .venv
by using command: (I forgot)
- Lingangu API Swagger will be available at
http://localhost:8000/docsor alternate scalar UI athttp://localhost:8000/scalar - Heater API Swagger will be available at
http://localhost:8001/docsor alternate scalar UI athttp://localhost:8001/scalar - Rice Shower API Docs will be available at
http://localhost:8100/openapi - Simulator API Docs will be available at
http://localhost:8101/openapi - Almond Eye Dashboard will be available at
http://localhost:3100
When making changes to the API Server (Lingangu API, Temperature API, or Rice Shower), the swagger files located at docs/** of that project will be automatically generated upon server start.
However, you still have to run pnpm codegen in the root of the repository to regenerate the API Client packages used in other projects.
Please make sure to do this step before creating a pull request.
