This guide outlines the setup process for the Next.js client environment.
- Node.js (version v18.18.2)
- npm (usually comes with Node.js)
Execute the following command to install the required npm packages:
npm installDuplicate the .env.local.example file to a new file named .env.local, and populate it with your specific variables for the environment.
cp .env.local.example .env.localEdit the .env.local file to include necessary environment variables such as API endpoints.
To run the client in development mode with hot-reloading:
npm run devYour Next.js client will start on http://localhost:3001 by default.
To build the application for production usage:
npm run buildnpm startTo check that your client setup is functioning correctly, navigate to http://localhost:3001 in your web browser. You should see your Next.js application running.
If npm packages are causing issues, delete the node_modules folder and package-lock.json file and reinstall the dependencies with npm install. Ensure that .env.local is included in your .gitignore to prevent committing sensitive environment data to version control.