odooXiit/
├── Frontendd/ # React frontend application
└── backend/ # Node.js/Express backend API
-
Navigate to the backend directory:
cd backend -
Install dependencies:
npm install -
Create a
.envfile in the backend directory with the following content:# Database Configuration DB_HOST=localhost DB_USER=your_postgres_username DB_PASSWORD=your_postgres_password DB_NAME=expense_management # Server Configuration PORT=8080 # JWT Secret (change this to a secure random string) JWT_SECRET=expense_management_secret_key -
Make sure PostgreSQL is running and the database specified in
DB_NAMEexists. -
Start the backend server:
npm start
-
Navigate to the frontend directory:
cd Frontendd -
Install dependencies:
npm install -
Start the development server:
npm run dev
The frontend and backend are integrated through RESTful API calls:
- Frontend runs on: http://localhost:5173
- Backend API runs on: http://localhost:8080
All API endpoints are prefixed with /api:
- Authentication:
/api/auth/signup,/api/auth/signin - Expenses:
/api/expenses
The frontend uses an apiClient utility to make HTTP requests to the backend with proper headers and error handling.
The application uses PostgreSQL with the following tables:
users: Stores user information (id, name, email, password, role)companies: Stores company information (id, name, currency)expenses: Stores expense information (id, description, amount, currency, category, date, status, receiptUrl, paidBy)
The application uses JWT (JSON Web Tokens) for authentication:
- Users sign up or sign in through the
/api/auth/signupor/api/auth/signinendpoints - Upon successful authentication, the server returns a JWT token
- The frontend stores this token in localStorage and includes it in the
x-access-tokenheader for subsequent requests - The backend middleware verifies the token before allowing access to protected routes