This guide will help you set up the frontend application for the Home Energy Analysis Tool (H.E.A.T.) project. Please follow these instructions carefully.
Git LFS is required to manage large files in the repository. Choose one of the methods below to install it:
Method 1: Using Homebrew (Recommended)
brew install git-lfs
git lfs install
Method 2: Manual Installation
- Download the Git LFS installer from git-lfs.com.
- Unzip the downloaded file and navigate to the extracted folder:
cd ~/Downloads/git-lfs-<version>
- Run the installation script:
./install.sh git lfs install
- Confirm the installation with:
git lfs install
For more details, visit the official documentation.
-
Fork the repository
Go to the home-energy-analysis-tool repository and click the "Fork" button at the top right to create your own copy of the repository. -
Clone your forked repository
After forking, clone your fork to your local machine using the following command (replaceyour-username
with your GitHub username):git clone [email protected]:your-username/home-energy-analysis-tool.git
-
Navigate to the project directory
Change into theheat-stack
directory within the project:cd home-energy-analysis-tool/heat-stack
-
Copy the example environment file
Copy the example environment file into a new.env
file:cp .env.example .env
The project requires Node.js version 18 to avoid engine errors with node v19+. Use Node Version Manager (NVM) for managing Node.js versions (nvm is preinstalled in coding spaces).
- Download and install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
- Restart your terminal. Ensure NVM is installed by running:
nvm --version
- Install Node.js version 18:
nvm install 18
- Use Node.js version 18:
nvm use 18
-
Install project dependencies:
npm install
-
Build the rules engine into the
public/pyodide-env
folder:npm run buildpy
-
Setup the SQLite Database:
npm run setup
-
Start the development server:
npm run dev
If you encounter errors during this process, try the following steps:
- Delete the
node_modules
folder andpackage-lock.json
file:rm -rf node_modules package-lock.json
- Reinstall dependencies:
npm install
- Run the development server again:
npm run dev
If using GitHub Codespaces, follow these steps:
-
Navigate to the project directory:
cd home-energy-analysis-tool/heat-stack
-
Create an environment file:
cp .env.example .env
-
Use Node.js version 18:
nvm use 18
-
Install dependencies and build:
npm install npm run buildpy npm run dev
-
Disable auto-save in VSCode (this is to avoid auto recompiling and page refresh while making changes):
- Go to File > Preferences > Settings.
- Search for "Auto Save" and uncheck it.
- For reference, see this Stack Overflow post.
If the version of Pyodide changes or you encounter issues with the Pyodide environment:
- Copy the necessary Pyodide files:
cp ./node_modules/pyodide/* public/pyodide-env/
- Ensure the correct
numpy
wheel file is in thepublic/pyodide-env
folder. If missing:- Download the latest Pyodide release from Pyodide releases.
- Extract the file and locate the
numpy
wheel file. - Copy it into the
public/pyodide-env
folder.
- Check the Pyodide version:
Ensure the
npm list pyodide
numpy
file matches the version.
If you encounter a loader error, run:
npm run postinstall
- The
npm audit fix
command can resolve minor dependency issues. - For a clean setup, ensure sufficient disk space (at least 1GB).
Below is a table summarizing the available scripts in the project:
Script | Description |
---|---|
npm run build |
Runs all build-related tasks. |
npm run build:icons |
Generates icons for the project. |
npm run build:remix |
Builds the Remix application using Vite. |
npm run build:server |
Builds the server files. |
npm run predev |
Prepares the environment before starting development (e.g., generates icons). |
npm run dev |
Starts the development server. |
npm run prisma:studio |
Launches the Prisma Studio UI for database management. |
npm run format |
Formats the codebase using Prettier. |
npm run lint |
Lints the codebase using ESLint. |
npm run setup |
Runs setup tasks including building, migrations, and Playwright setup. |
npm run start |
Starts the application in production mode. |
npm run start:mocks |
Starts the application with mock data in production mode. |
npm run test |
Runs unit tests and builds the Python rules engine. |
npm run buildpy |
Builds the Python rules engine and copies it to the public/pyodide-env folder. |
npm run coverage |
Runs tests and generates a coverage report. |
npm run test:e2e |
Runs end-to-end tests interactively. |
npm run test:e2e:run |
Runs end-to-end tests in CI mode. |
npm run test:e2e:install |
Installs dependencies for Playwright end-to-end tests. |
npm run typecheck |
Checks TypeScript types. |
npm run validate |
Validates the project by running linting, type-checking, and testing. |
This is an opinionated project starter and reference that allows teams to ship their ideas to production faster and on a more stable foundation based on the experience of Kent C. Dodds and contributors.
npx create-epic-app@latest
"The Epic Stack" by Kent C. Dodds
Read the docs (please 🙏).
- 🆘 Join the discussion on GitHub and the KCD Community on Discord.
- 💡 Create an idea discussion for suggestions.
- 🐛 Open a GitHub issue to report a bug.
Want to talk about the Epic Stack in a blog post or talk? Great! Here are some assets you can use in your material: EpicWeb.dev/brand
You rock 🪨