This project is a React application built with Create React App and TypeScript. It serves as the user interface for the Any API backend.
To get the frontend running locally, follow these steps:
-
Navigate to the frontend directory:
cd frontend -
Install dependencies: This command installs all the necessary packages defined in
package.json. It is the standard way to manage dependencies for this project.npm install
-
Start the development server: This will run the app in development mode. Open http://localhost:3000 to view it in your browser. The page will reload when you make changes.
npm start
In the project directory, you can run:
npm start: Runs the app in development mode.npm test: Launches the test runner in interactive watch mode.npm run build: Builds the app for production to thebuildfolder.npm eject: Note: this is a one-way operation. Once youeject, you can’t go back! It removes the single build dependency from your project and copies all the configuration files and transitive dependencies into your project.
This project uses npm for package management. It's crucial to keep package.json and package-lock.json in sync to ensure consistent and reliable builds, especially in CI/CD environments like Cloudflare Pages.
When you need to change a package's version (e.g., downgrading TypeScript to fix a compatibility issue), you cannot just change the version in package.json. This will cause automated builds to fail because the package-lock.json file will be out of sync.
Follow these steps to correctly change a dependency version:
-
Modify
package.json: Change the version number of the desired package in thedependenciesordevDependenciessection of yourpackage.jsonfile. -
Delete the old lock file: Remove the
package-lock.jsonfile. This forcesnpmto resolve all dependencies from scratch based on the updatedpackage.json.rm package-lock.json
-
Re-install dependencies: Run
npm install. This will create a newpackage-lock.jsonfile that is perfectly in sync with the versions specified inpackage.json.npm install
-
Commit both files: Commit both the updated
package.jsonand the newly generatedpackage-lock.jsonto your repository. This is essential for your deployments to succeed.