A React application that integrates with the Deck of Cards API to create and manage card game sessions.
Users can create a new game, which generates a fresh shuffled deck from the Deck of Cards API. Once a game is created, players can draw cards from the deck and view the remaining cards available.
- Create a new game with a freshly shuffled deck
- Retrieve deck information from the Deck of Cards API
- Draw cards from an active deck
- Display drawn cards
- Track remaining cards in the deck
- Responsive user interface built with React and Vite
- Create a new game
- Application requests a new shuffled deck from the Deck of Cards API
- Deck ID is stored for the game session
- Player draws cards from the deck
- Drawn cards are displayed in the interface
- Remaining card count is updated after each draw
This application uses the public Deck of Cards API:
GET https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1GET https://deckofcardsapi.com/api/deck/{deck_id}/draw/?count=1- React
- Vite
- JavaScript (ES6+)
- Fetch API
- CSS / Styling Framework (update if applicable)
src/
├── components/
├── pages/
├── services/
├── hooks/
├── utils/
├── App.jsx
└── main.jsx
Update the structure above to match your actual project layout.
Clone the repository:
git clone https://github.com/<your-username>/<repository-name>.gitNavigate into the project directory:
cd <repository-name>Install dependencies:
npm installStart the development server:
npm run devThe application will be available at:
http://localhost:5173
Create a production build:
npm run buildPreview the production build locally:
npm run preview- Separation of UI and API logic
- Reusable React components
- Simple and intuitive user experience
- Efficient state management for game sessions and card draws
- Clear handling of API loading and error states
- Support multiple players
- Game history tracking
- Persistent game sessions
- Card discard pile
- Multiple deck support
- Player scoring system
- Dark mode support
The application handles:
- Network request failures
- Invalid deck identifiers
- Empty deck scenarios
- API response errors
This project is provided for educational and demonstration purposes.