This guide explains how to set up and configure the Praxia Frontend application for development.
Before setting up the Praxia Frontend, ensure you have the following installed:
- Node.js 18 or later
- npm or yarn
- Git
- Access to the Praxia Backend API (running locally or deployed)
The application uses environment variables for configuration. Create a .env.local file in the project root for development.
Create a .env.local file in the project root with the following variables:
| Variable | Description | Example |
|---|---|---|
NEXT_PUBLIC_API_URL |
API URL for your backend | http://localhost:8000/api |
# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:8000/api
Note: Replace the API URL with your actual backend endpoint. If you're running the Praxia Backend locally, use http://localhost:8000/api. For a deployed backend, use your production API URL.
-
Clone the repository:
git clone https://github.com/AmariahAK/Praxia_Frontend.git cd praxia_frontend -
Install dependencies:
npm install
-
Create a
.env.localfile based on the example above:touch .env.local
Then add your environment variables to the file.
-
Start the development server:
npm run dev
-
Open
http://localhost:3000in your browser to see the application.
npm run dev- Start the development servernpm run build- Build the application for productionnpm run start- Start the production servernpm run lint- Run ESLint for code quality checks
If the frontend cannot connect to the backend:
- Verify
NEXT_PUBLIC_API_URLin your.env.localfile is correct - Ensure the backend is running and accessible at the specified URL
- Check that there are no CORS issues between frontend and backend
- Test the API endpoint directly in your browser or with a tool like Postman
If environment variables aren't being recognized:
- Ensure your
.env.localfile is in the project root directory - Restart the development server after making changes to
.env.local - Verify variable names start with
NEXT_PUBLIC_for client-side access - Check that there are no syntax errors in your
.env.localfile
If port 3000 is already in use:
- Stop any other applications running on port 3000
- Or specify a different port:
npm run dev -- -p 3001
If you encounter Node.js compatibility issues:
- Ensure you're using Node.js 18 or later
- Consider using a Node.js version manager like nvm:
nvm install 18 nvm use 18
If you encounter issues not covered here:
- Check the browser console for error messages
- Review the terminal output for build errors
- Ensure your backend API is running and accessible
- Verify all environment variables are correctly set
- Use the browser's developer tools to inspect network requests to the API
- The application will automatically reload when you make changes to the code
- Check the Next.js documentation for additional configuration options
- Use TypeScript's type checking to catch errors early in development