This project is a Star Wars application built using React, TypeScript, Vite, and various other modern web technologies. It allows users to view and manage different Star Wars entities like People, Films, Planets, Starships, Species, and Vehicles.
To get started, clone the repository and install the dependencies:
git clone https://github.com/your-repo/starwars-app.git
cd starwars-app
npm install
dev: Starts the development server using Vite. build: Builds the application using TypeScript and Vite. lint: Runs ESLint on the project. preview: Previews the built application using Vite.
{
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
}
}
The project uses the following dependencies:
@hookform/resolvers
@radix-ui/react-dialog
@radix-ui/react-label
@radix-ui/react-scroll-area
@radix-ui/react-separator
@radix-ui/react-slot
@tanstack/react-table
axios
class-variance-authority
clsx
lucide-react
react
react-dom
react-hook-form
react-icons
react-router-dom
tailwind-merge
tailwindcss-animate
uuid
zod
zustand
For development:
@types/node
@types/react
@types/react-dom
@types/uuid
@typescript-eslint/eslint-plugin
@typescript-eslint/parser
@vitejs/plugin-react
autoprefixer
eslint
eslint-plugin-react-hooks
eslint-plugin-react-refresh
postcss
tailwindcss
typescript
vite
The project structure is organized as follows:
src/
|-- components/
| |-- ui/
| |-- EntityDetails/
| |-- EntityForm/
| |-- List/
| |-- Search/
|-- constants/
|-- hooks/
|-- lib/
|-- pages/
|-- store/
|-- types/
|-- utils/
Displays the details of a single entity.
Used to create or edit an entity.
A reusable form field component.
Displays a list of entities with pagination controls and an option to create a new entity.
Provides a search input and displays search results.
Displays the search results.
Main application component that sets up the routes.
Provides a search input and displays search results.
Displays a list of entities based on the entity type provided in the URL.
Displays the details of a single entity based on the URL.
Displays a "Page Not Found" message for invalid URLs.
Maps a string to an EntityType.
Defines the fields for each EntityType.
Transforms a raw entity into a more structured format.
Returns the default values for a given EntityType.
Configures the Axios instance with the base URL.
Manages the state for entities using Zustand.
Manages the state for search using Zustand.
This project is set up with Vite for fast development, TypeScript for static type checking, React for UI development, Zustand for state management, and Tailwind CSS for styling. Additionally, it uses various other libraries for form handling, routing, and data fetching.