React Marvel App π¦ΈββοΈ
A modern React application for exploring Marvel characters using the official Marvel API. Browse through your favorite superheroes and villains with an intuitive and responsive interface.
π Live Demo
Check out the live application: https://victoralfonsoperez.github.io/react_marvel_app/
β¨ Features
- Character Browser: Explore Marvel characters with detailed information
- Responsive Design: Works seamlessly on desktop and mobile devices
- Marvel API Integration: Real-time data from the official Marvel API
- Search Functionality: Find characters by name
- Favorites System: Save your favorite Marvel characters
- Loading States: Smooth user experience with loading indicators
- Redux State Management: Centralized state management for better data flow
π οΈ Built With
- React 16.2 - JavaScript library for building user interfaces
- Redux - Predictable state container for JavaScript apps
- React Redux - Official React bindings for Redux
- Axios - Promise-based HTTP client for API requests
- React Icons - Popular icons as React components
- React Modal - Accessible modal dialog component
- MD5 - Hash function for Marvel API authentication
- Lodash - Modern JavaScript utility library
π Prerequisites
Before you begin, ensure you have the following installed:
- Node.js (version 12 or higher)
- npm or yarn package manager
- Marvel API Keys (public and private keys from Marvel Developer Portal)
π Getting Started
1. Clone the Repository
git clone https://github.com/victoralfonsoperez/react_marvel_app.git
cd react_marvel_app
2. Install Dependencies
Using npm:
npm install
Using yarn:
yarn install
3. Configure Marvel API Keys
Create a configuration file in the src/utils/
directory:
touch src/utils/config.js
Add the following configuration to src/utils/config.js
:
// Marvel API Configuration
export const apikey = 'your_marvel_public_api_key'
export const privatekey = 'your_marvel_private_api_key'
export const baseUrl = 'https://gateway.marvel.com/v1/public/'
π Security Note: Never commit your API keys to version control. Add
src/utils/config.js
to your.gitignore
file.
4. Get Your Marvel API Keys
- Visit the Marvel Developer Portal
- Create a free account or sign in
- Navigate to βMy Developer Accountβ
- Create a new application
- Copy your Public Key (apikey) and Private Key (privatekey)
5. Start the Development Server
Using npm:
npm start
Using yarn:
yarn start
The application will open in your browser at http://localhost:3000
.
π Project Structure
react_marvel_app/
βββ public/
β βββ index.html
β βββ favicon.ico
βββ src/
β βββ actions/ # Redux actions
β βββ assets/ # Images and static assets
β βββ components/ # React components
β β βββ App.js # Main application component
β β βββ Header.js # Navigation header
β β βββ ComicCard.js # Character card component
β β βββ Footer.js # Application footer
β β βββ ... # Other components
β βββ reducers/ # Redux reducers
β βββ utils/
β β βββ api.js # API utility functions
β β βββ config.js # API configuration (create this file)
β βββ index.js # Application entry point
β βββ index.css # Global styles
βββ package.json # Project dependencies and scripts
βββ .eslintrc.json # ESLint configuration
βββ .gitignore # Git ignore rules
βββ README.md
π§ͺ Available Scripts
In the project directory, you can run:
npm start
or yarn start
Runs the app in development mode. Open http://localhost:3000 to view it in the browser.
npm test
or yarn test
Launches the test runner in interactive watch mode.
npm run build
or yarn build
Builds the app for production to the build
folder. The build is minified and optimized for best performance.
npm run deploy
or yarn deploy
Deploys the application to GitHub Pages.
π API Integration
This application uses the Marvel Comics API to fetch character data. The API requires authentication using:
- Public Key (apikey): Your public API key
- Private Key: Your private API key
- Timestamp (ts): Current timestamp
- Hash: MD5 hash of timestamp + private key + public key
The hash is automatically generated for each API request to ensure secure authentication.
API Endpoints Used:
GET /v1/public/characters
- Fetch all charactersGET /v1/public/characters?nameStartsWith={value}
- Search characters by name
π¨ Styling
The application uses custom CSS with a focus on:
- Responsive Design: Mobile-first approach
- Marvel Theme: Colors and styling inspired by Marvel branding
- Smooth Animations: Hover effects and transitions
- Accessibility: Proper contrast ratios and semantic HTML
π Deployment
The application is automatically deployed to GitHub Pages using GitHub Actions. To deploy manually:
- Build the project:
npm run build
- Deploy to GitHub Pages:
npm run deploy
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Development Guidelines:
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting
π License
This project was bootstrapped with Create React App.
π Acknowledgments
- Marvel Entertainment - For providing the amazing Marvel Comics API
- Create React App - For the initial project setup
- React Community - For the excellent ecosystem and documentation
π Support
If you encounter any issues or have questions:
- Check the Marvel API Documentation
- Review the Create React App Documentation
- Open an issue in this repository
Made with β€οΈ by Victor PΓ©rez