Welcome to the Phronesis Tour Logistics website repository! This project is designed to provide a dynamic and responsive platform for managing tour logistics and booking freelancers. The platform is built with cutting-edge technologies like React, TypeScript, MongoDB, and Tailwind CSS, offering seamless performance, scalability, and user-friendliness.
- Features
- Tech Stack
- Prerequisites
- Getting Started
- Folder Structure
- Scripts
- API Endpoints
- Contributing
- License
- Dynamic Website Design: Built on a WordPress CMS backend for flexibility and easy management.
- Responsive Design: Mobile-first, responsive design across all devices using Tailwind CSS.
- Freelancer Booking: Integrated calendar for scheduling and managing freelancers.
- Payment Gateway:
- Supports USD payments via credit cards.
- Secure and reliable payment processing.
- Social Media Integration: Embedded social media and WhatsApp chat for user engagement.
- Website Security: Advanced security measures to prevent hacks.
- Admin Panel: Comprehensive admin dashboard for content and user management.
- User Training: Documentation and training for managing the website.
- Hosting & Renewals: Includes domain, SSL, and email hosting (renewed yearly).
- Modern Design: UI/UX designed for a smooth user experience.
- Cutting-Edge Tech Stack: Built with React, TypeScript, and MongoDB for scalability.
- Two-Month Support: Post-launch support and updates.
- React: A JavaScript library for building user interfaces.
- TypeScript: Strongly typed programming language for scalable development.
- Tailwind CSS: Utility-first CSS framework for fast styling.
- Axios: For HTTP requests.
- Node.js: JavaScript runtime for server-side development.
- Express.js: Lightweight web framework for APIs.
- MongoDB: NoSQL database for scalable data storage.
- Mongoose: ODM for MongoDB.
- Vite: Fast development build tool.
- Postman: For API testing.
- Git & GitHub: Version control and repository management.
- Jest: For unit and integration testing.
Ensure you have the following installed:
- Node.js: >= 18.0.0
- npm or yarn: Package manager
- MongoDB: For database setup
- Git: Version control
Follow these steps to set up the project locally:
This is an overview of the file and directory structure for the application. It follows a modular approach with clearly separated concerns, making it easier to scale, maintain, and navigate.
This is the main directory for all the source code of the application.
Contains utility functions for API integration and all the API calls.
auth.ts- Authentication-related API callsuser.ts- User-related API callsbooking.ts- Booking-related API callsindex.ts- Common API utilities or exports
Contains static assets like images, fonts, and icons.
images/- Image filesfonts/- Font filesicons/- Icon files
Reusable UI components.
Generic components like buttons, inputs, etc.
Button.tsx- A reusable button componentInput.tsx- A reusable input componentModal.tsx- A reusable modal component
Layout-related components that are part of the site's overall structure.
Header.tsx- Header componentFooter.tsx- Footer componentSidebar.tsx- Sidebar componentNavbar.tsx- Navbar component
Feature-specific components for different parts of the application.
-
BookingForm.tsx- Booking form component -
Notification.tsx- Notification component -
RatingStars.tsx- Rating stars component -
index.ts- Export for easier imports from components
React context for global state management.
AuthContext.tsx- Authentication contextUserContext.tsx- User-related contextThemeContext.tsx- Theme-related context
Custom React hooks for different functionalities.
useAuth.ts- Authentication hook for managing auth stateuseFetch.ts- Data fetching hookuseResponsive.ts- Media query or responsive hooksindex.ts- Export for easier imports from hooks
Application pages, which represent routes.
Home.tsx- Home page componentAbout.tsx- About page componentDashboard.tsx- Dashboard page componentBooking.tsx- Booking page componentProfile.tsx- User profile page componentindex.ts- Export for easier imports from pages
Contains business logic and utilities, separate from UI.
authService.ts- Authentication-related servicespaymentService.ts- Payment-related servicesemailService.ts- Email-related servicesindex.ts- Export for easier imports from services
Global and Tailwind configuration files.
index.css- Main global CSS file (tailwind base)tailwind.css- Tailwind CSS configurationanimations.css- Custom animations for UIthemes.css- Theme-related styles (light/dark mode)
TypeScript type definitions.
api.d.ts- API response typescomponents.d.ts- Component-specific typescontext.d.ts- Context-related typesindex.d.ts- Common exports from all types
Utility functions.
dateUtils.ts- Date manipulation utilitiesformatUtils.ts- Formatting utilities (e.g., for currency)storageUtils.ts- LocalStorage/sessionStorage utilitiesindex.ts- Export for easier imports from utils
App.tsx- Root React component for the applicationmain.tsx- Main application entry point (rendersApp.tsx)index.html- Main HTML template for the applicationvite-env.d.ts- Vite environment type definitions (e.g., for Vite config)
-
src/: Contains the core source code for the backend, including controllers, models, services, and middlewares.controllers/: Contains the logic to handle incoming requests, process them, and send appropriate responses.userController.js: Handles requests related to user operations (e.g., registration, login).bookingController.js: Handles requests related to booking operations (e.g., creating a booking, updating booking).
models/: Contains the Mongoose models that define the structure and schema of the data in the database.userModel.js: Defines the schema for the user data in the database.bookingModel.js: Defines the schema for booking-related data in the database.
routers/: Contains the API route handlers to define how the routes should behave.userRouter.js: Defines routes for user-related requests.bookingRouter.js: Defines routes for booking-related requests.
services/: Contains business logic for various functionalities, such as authentication, payments, and bookings.authService.js: Contains logic for handling user authentication (e.g., login, signup).paymentService.js: Contains logic for handling payment processing.bookingService.js: Contains logic for booking-related operations.
utils/: Contains helper functions for tasks like error handling and logging.errorHandler.js: Contains utilities for handling errors in the application.logger.js: Contains utilities for logging application events.
config/: Contains configuration files such as database connection settings and environment variables.dbConfig.js: Contains logic for connecting to the MongoDB database.
middleware/: Contains custom middleware functions used across routes.authMiddleware.js: Middleware to check if the user is authenticated.
index.js: Main entry point for the application, initializing Express, connecting to the database, and starting the server.
-
public/: Contains static files (optional) like uploaded files, images, etc.uploads/: Directory for storing uploaded files such as images.
-
.env: File for storing environment variables, including sensitive data like database credentials, API keys, etc. -
package.json: Contains project metadata and dependencies. -
README.md: This file that contains documentation for the project.
-
Clone the repository:
git clone <repository-url> cd backend
-
Install dependencies:
npm install
-
Create a
.envfile with your environment variables:touch .env
-
Add the following keys to the
.envfile:DB_URI=<Your MongoDB URI> JWT_SECRET=<Your JWT Secret> PORT=<Port number, default is 5000>
-
Run the application:
npm start
This structure is designed to keep concerns separated and ensure that files are easy to find and update. It follows common best practices for modularity and scalability in large web applications.
sql Copy code
- apis/: Contains API integration files like authentication and booking calls.
- assets/: Stores static files such as images, fonts, and icons, which can be imported into components as needed.
- components/: Modular UI components like buttons, forms, navigation bars, and any feature-specific components.
- contexts/: Manages global application state using React's context API (e.g., user authentication, theme management).
- hooks/: Custom hooks that abstract repetitive logic like authentication, data fetching, or responsive behavior.
- pages/: Components for each route or page (e.g., Home, About, Dashboard), which correspond to the main view of the app.
- services/: Contains business logic and utilities that don't belong to UI components, like payment and email services.
- styles/: Global styles, Tailwind CSS configuration, animations, and theme definitions.
- types/: TypeScript type definitions for API responses, context states, components, and utilities, ensuring type safety across the app.
- utils/: Helper functions for tasks like date manipulation, format conversion, and managing browser storage.
- App.tsx: The main React component that wraps the entire application and renders the routes.
- main.tsx: The entry point for React, responsible for rendering the
App.tsxcomponent into the DOM. - index.html: The main HTML template loaded into the browser.
- vite-env.d.ts: Custom TypeScript definitions for Vite, used for environment variables or project-specific configurations.
This structure keeps everything modular and scalable for future growth. It ensures that as your application grows, you can easily add or modify components, hooks, and services without cluttering the codebase. git clone https://github.com/your-username/phronesis-tour-logistics.git cd phronesis-tour-logistics
Install Dependencies bash Copy code npm install
-
Create a .env file in the root directory and configure the following:
-
makefile
-
Copy code
-
MONGO_URI=your_mongo_db_connection_string
-
PORT=5000
-
JWT_SECRET=your_jwt_secret
-
Run the Project
-
Start the development server:
bash
- Copy code
- npm run dev
- Navigate to http://localhost:3000 to view the project in your browser.
- Full description of the project's scope and features.
- Detailed tech stack with all cutting-edge tools mentioned.
- Setup instructions for both development and production environments.
- API endpoints and folder structure for clarity.
- Contribution guidelines and licensing for open collaboration.