Category: Software Development
Software Development related
-
Next.js (App Router) with MUI v6.4.6
I was working on a project that uses Next.js (App Router v15.2.0) and MUI (v6.4.6).
It took me quite a while to understand how to integrate MUI and Next.js. For example, I was unfamiliar on how to integrate dark mode and light mode in a Next.js application with MUI.
Thus, here is a GitHub repository that implemented MUI free react template with Next.js (with dark mode and light mode toggle implemented) for everybody reference if they are curious on how to use Next.js with MUI.
To be honest, all the implementation details can be found in the MUI documentation (plus some Googling & ChatGPT) but it took me a while to understand the mechanics behind it and how to apply it correctly.
The project is deployed at Vercel:
https://nextjs-ts-with-mui-free-templates.vercel.app/
GitHub repository:
https://github.com/kuanjiahong/nextjs-ts-with-mui-free-templates
Some issues I am still figuring it out:
- The CSS styling in production environment is different than development environment
-
Django – Dockerfile and docker-compose.yaml
The below files can be used as a reference on how to deploy Django application in a container.
Dockerfile
docker-compose.yaml
-
Raspberry Pi 5: File Upload Server
At local machine
GitHub Repository:
https://github.com/kuanjiahong/file-upload-server
Pull the repository into your local machine
git clone https://github.com/kuanjiahong/file-upload-server.gitCompile the TypeScript file to JavaScript file
npm run buildTransfer the built files to your Raspberry Pi 5. There are a few options to do it but I will be using the
scpcommandscp -r dist/ <username>@<pi_ip_address>:<destination-path>And also to transfer the package.json file
scp package.json <username>@<pi_ip_address>:<destination-path>At Your Raspberry Pi 5 Machine
Install Node.js.
refer to Raspberry Pi 5: Install Node post on how to install Node.js
Set
NODE_ENV=productionexport NODE_ENV=productionInstall node modules
npm install --omit=devCreate a
uploadsdirectorymkdir uploadsStart server
node index.jsConnecting to the server from local network:
You can connect to the server that is running in the Raspberry Pi 5 by visiting
http://[pi-ip-address]:[port-number]Connecting to the server from the internet:
You will have to set up port forwarding at your router to allow remote devices from the internet to connect with your server that is hosted in your local network. It is not recommended to simply expose your home network public IP address. Make sure you read up all related resources and security concerns before exposing your server to the internet.
-
Raspberry Pi 5: Install Node
Reference: https://nodejs.org/en/download/package-manager
# installs nvm (Node Version Manager) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash # download and install Node.js (you may need to restart the terminal) nvm install 22 # verifies the right Node.js version is in the environment node -v # should print `v22.12.0` # verifies the right npm version is in the environment npm -v # should print `10.9.0`