Prerequisites
Before you begin, ensure you have the following installed:- Node.js 18.0 or later
- pnpm 10.30.3 or later (specified as the package manager)
- A Mapbox account and API access token (free tier works fine)
Been uses pnpm as its package manager. While npm or yarn might work, pnpm is recommended for compatibility.
Get a Mapbox Access Token
Been requires a Mapbox API key to render the interactive globe. Here’s how to get one:Create a Mapbox Account
Go to mapbox.com and sign up for a free account if you don’t have one already.
Access Your Tokens
Once logged in, navigate to your Account Dashboard and click on “Tokens” in the sidebar.
Installation
Install Dependencies
Install the required dependencies using pnpm:This will install all necessary packages including:
- React 19 for the UI framework
- Mapbox GL JS and react-map-gl for map rendering
- Tailwind CSS 4 for styling
- Jotai for state management
- Turf.js for geospatial calculations
Configure Environment Variables
Create a Open the Replace
.env file in the root directory by copying the example file:.env file and add your Mapbox access token:.env
your_mapbox_token_here with the token you copied from Mapbox.Open in Browser
Navigate to http://localhost:5173 in your web browser.You should see the Been application with:
- The “been” header at the top
- An interactive 3D globe taking up most of the screen
- A menu panel where you can select countries
Verify Your Setup
To ensure everything is working correctly:- Check the Globe Renders: You should see a 3D Mapbox globe that you can rotate and zoom
- Test Dark Mode: Your system’s color scheme preference should be reflected (light or dark theme)
- Select a Country: Use the menu panel to search for and select a country
- View Visualization: Selected countries should appear highlighted in orange on the globe
Project Structure
Here’s a quick overview of the key files and directories:Common Issues
Blank screen or map doesn't load
Blank screen or map doesn't load
This is usually caused by a missing or invalid Mapbox token. Double-check that:
- Your
.envfile exists in the root directory - The variable is named exactly
VITE_API_KEY_MAPBOX - Your Mapbox token is valid and has public scopes
- You restarted the dev server after creating the
.envfile
pnpm: command not found
pnpm: command not found
Port 5173 is already in use
Port 5173 is already in use
If port 5173 is already in use, Vite will automatically try the next available port. Check the terminal output for the actual URL.Alternatively, you can specify a different port:
Countries list doesn't load
Countries list doesn't load
Make sure all dependencies are properly installed. Try:
Next Steps
Now that you have Been running locally, you can:- Start tracking countries you’ve visited
- Explore the codebase to understand how the Mapbox integration works
- Customize the styling using Tailwind CSS
- Run the test suite with
pnpm test - Build for production with
pnpm build
Architecture
Learn about the project architecture and how components work together
Components
Explore the component library and their APIs
Deployment
Deploy your instance of Been to production
Testing
Learn about the testing setup and how to write tests