Prerequisites
Before you begin, make sure you have the following installed:- Node.js 18+ — verify with
node --version - npm 9+ — included with Node.js; verify with
npm --version - A running backend server at
http://localhost:8000(see Backend setup)
Tech stack overview
The frontend is a React 19 single-page application built with Vite 6 and styled with Tailwind CSS 4.| Package | Version | Purpose |
|---|---|---|
| React | 19.0.0 | UI framework |
| Vite | 6.3.1 | Build tool and dev server |
| Tailwind CSS | 4.1.5 | Utility-first CSS |
| React Router DOM | 7.6.0 | Client-side routing |
| Axios | 1.9.0 | HTTP client |
| @emailjs/browser | 4.4.1 | Email sending |
| @paypal/react-paypal-js | 8.8.3 | PayPal payments |
| Formik + Yup | 2.4.6 / 1.6.1 | Form handling and validation |
| Radix UI | various | Accessible component primitives |
Setup steps
Install dependencies
package.json, including React, Vite, Tailwind CSS, and all UI libraries.Configure environment variables
There is no See the Environment variables page for a full description of each variable.
.env.example file in the repository. Create a .env file in the frontend/ directory with the following variables:.env
The PayPal client ID is currently loaded as a hardcoded
<script> tag in index.html rather than an environment variable. To update it, edit the client-id query parameter in the PayPal SDK script tag in frontend/index.html.Build for production
To compile an optimised static build:frontend/dist/. Preview the production build locally with:
Vite configuration
Thevite.config.js file configures the build tool with the following settings:
vite.config.js
There is no proxy configuration in
vite.config.js. API requests to the backend use the absolute URL configured in VITE_BACKEND_URL. The Axios instance in src/api/axiosInstance.js defaults to http://127.0.0.1:8000/ if the variable is not set.Path aliases
The following import aliases are available throughout the codebase:| Alias | Resolves to |
|---|---|
@ | src/ |
@components | src/components/ |
@api | src/api/ |
@assets | src/assets/ |
@context | src/context/ |
@hooks | src/hooks/ |
@pages | src/pages/ |
@utils | src/utils/ |
API communication
All authenticated requests use the Axios instance insrc/api/axiosInstance.js. It automatically:
- Attaches the JWT access token from the
accessTokencookie to every request - On a
401or403response, attempts a silent token refresh using therefreshTokencookie - Redirects to
/loginif the refresh token is missing or expired
src/api/axiosInstance.js
Linting
The project uses ESLint with thereact-hooks and react-refresh plugins. Run the linter with:
Troubleshooting
CORS errors in the browser
CORS errors in the browser
If you see CORS errors, confirm that the backend’s
DJANGO_CORS_ALLOWED_ORIGINS includes your Vite dev server origin (default: http://localhost:5173). See Backend setup and Environment variables.Module not found errors
Module not found errors
If imports using the
@components or @api aliases fail, confirm you are running npm install from inside the frontend/ directory and that vite.config.js has not been modified.PayPal SDK not loading
PayPal SDK not loading
The PayPal SDK is loaded via a
<script> tag in frontend/index.html. If the PayPal buttons do not render, open the browser console and check for script errors. Verify that the client-id in index.html is a valid sandbox or live PayPal client ID.Email sending fails
Email sending fails
If invoice emails are not sent, verify that your EmailJS service ID, template ID, and public key in
.env are correct. The sendInvoiceEmail function in src/services/emailInvoiceService.js will fall back to template_cho3xqg if the primary template is not found.