Elite Mart is a feature-rich React Native-based mobile application designed to deliver a seamless e-commerce experience. It provides an intuitive and dynamic user interface for product browsing, listing, and interaction, making online shopping convenient and enjoyable.
- Cross-Platform Compatibility: Fully functional on both iOS and Android.
- State Management: Powered by Redux Toolkit for centralized state handling.
- Scalable Architecture: Clean and modular structure, making the app easy to extend and maintain.
- Home Page:
- Displays categories, top-selling products, and new arrivals in an optimized layout.
- Product Listing Page:
- Dynamically loads and paginates products.
- Features advanced FlatList optimization for large datasets.
- Product Details:
- Displays detailed product information with an interactive image gallery supporting zoom and swipe.
- Pin Code Check:
- Validates delivery availability with error handling and success messages.
- Wishlist Integration:
- Enables adding or removing products from the wishlist.
- Global Loading Overlay:
- A reusable, singleton-style, full-screen loading indicator.
- FlatList Optimization:
- Efficient and smooth scrolling for handling large datasets.
- React Native: Framework for building cross-platform mobile applications.
- TypeScript: Static typing for improved code quality and maintainability.
- Navigation:
@react-navigation/native
@react-navigation/stack
@react-navigation/bottom-tabs
- State Management:
@reduxjs/toolkit
,redux
, andredux-thunk
react-redux
for connecting React components to the Redux store.
- Forms and Validation:
react-hook-form
for form management.yup
for schema-based form validation.
- Network Requests:
axios
for handling API calls.
- UI Enhancements:
react-native-gesture-handler
andreact-native-reanimated
for gesture support.react-native-vector-icons
for custom icons.@gorhom/bottom-sheet
for modal-like behavior.react-native-keyboard-aware-scroll-view
for better input handling.
- Testing:
jest
for unit testing. - Code Quality:
eslint
andprettier
for linting and formatting.
- Node.js: >= 18.x
- React Native CLI: Installed globally
- Yarn: >= 3.6.4
- Xcode: For iOS development
- Android Studio: For Android development
-
Clone the repository:
git clone https://github.com/jigaroza287/elite-mart-mobile-app.git cd elite-mart-mobile-app
-
Install dependencies:
yarn install
-
Start Metro bundler:
yarn start
-
Run the app:
- For iOS
yarn ios
- For Android
yarn android
To streamline API interactions and manage authentication tokens and error responses globally, this project uses Axios interceptors.
The request interceptor adds an authentication token (if available) to every outgoing API request, ensuring secure communication.
axiosInstance.interceptors.request.use(async config => {
const token = await AsyncStorage.getItem('token');
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
});
The response interceptor processes API responses and handles errors consistently. It extracts meaningful error messages for various scenarios like bad requests, unauthorized access, and server issues.
axiosInstance.interceptors.response.use(
response => response,
(error: AxiosError) => {
let errorMessage = 'An unexpected error occurred.';
if (error.response) {
const { status, data } = error.response;
if (status === 400) {
errorMessage =
(data as { message?: string }).message || 'Invalid request.';
} else if (status === 401) {
errorMessage = 'Unauthorized. Please login again.';
} else if (status === 404) {
errorMessage = 'Requested resource not found.';
} else if (status >= 500) {
errorMessage = 'Server error. Please try again later.';
}
} else if (error.request) {
errorMessage = 'No response from the server. Please check your network.';
} else {
errorMessage = error.message;
}
console.error('API Error:', errorMessage);
return Promise.reject(new Error(errorMessage));
},
);
- Centralized Token Management: Ensures all API requests automatically include the authentication token.
- Consistent Error Handling: Provides a unified way to manage errors, making debugging and user feedback easier.
- Security: By dynamically injecting the token, sensitive data is kept secure.
This approach is highly scalable and aligns with industry standards for handling authentication and API errors in a React Native application.
http://localhost:3000
Endpoint | Method | Description |
---|---|---|
/home |
GET | Fetch products for Home page |
/products |
GET | Fetch all products |
/products/:id |
GET | Fetch product details |
/categories |
GET | Fetch product categories |
/validate-pin-code |
GET | Validate delivery availability |
/users/register |
POST | User registration (Signup) |
/users/login |
POST | User login (Login) |
- The backend for this application is implemented in Node.js with Sequelize ORM.
- Find the backend project and setup instructions here:
Elite Mart Backend
We welcome contributions to make Elite Mart better!
To contribute:
- Fork the repository.
- Create a new branch (
feature/your-feature-name
). - Commit and push your changes.
- Submit a pull request.
This project is licensed under the MIT License.
For questions or suggestions, reach out to us at:
- GitHub Issues: Elite Mart Issues