Environment Setup
This guide will help you set up your local development environment for the Lonely Planet frontend.
Prerequisites
Section titled “Prerequisites”- Node.js (see
.nvmrcfor version) - npm (comes with Node.js)
- Git
- A code editor (we recommend VS Code with our recommended extensions)
Step-by-Step Setup
Section titled “Step-by-Step Setup”1. Clone the Repository
Section titled “1. Clone the Repository”git clone git@github.com:lonelyplanet/lp-frontend-astro.gitcd lp-frontend-astro2. Node.js Setup
Section titled “2. Node.js Setup”We use a specific Node.js version (defined in .nvmrc). You can manage Node.js versions using one of these tools:
# Using nvmnvm use
# Using asdfasdf local nodejs $(cat .nvmrc)
# Using nn autoNote for asdf users: Set this environment variable to recognize
.nvmrc:Terminal window export ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY=latest_available
3. Environment Variables
Section titled “3. Environment Variables”# Copy the example env filecp .env.example .env.localThe .env.local file is git-ignored and should never be committed. It contains your local development secrets.
- See
.env.examplefor required variables
4. Install Dependencies
Section titled “4. Install Dependencies”# Fresh install (recommended for clean installs)npm run fresh
# Regular installnpm install5. Start Development Server
Section titled “5. Start Development Server”# Regular developmentnpm run dev
# Development with structured loggingnpm run dev:loggerVisit http://local.lonelyplanet.com:3000 to see the site.
VS Code or Cursor Setup
Section titled “VS Code or Cursor Setup”Our repository includes VS Code or Cursor configuration that will automatically:
- Suggest required extensions on first open
- Apply consistent editor settings
- Enable TypeScript features
- Configure debugging
Required extensions will be automatically suggested when you open the project. You can also install them manually:
-
Core Extensions (auto-suggested)
- Astro
- Tailwind CSS IntelliSense
- ESLint
- Prettier
-
Recommended Extensions (optional but helpful)
- GraphQL
- Git Lens
VS Code settings are checked into:
.vscode/settings.json- Editor settings.vscode/extensions.json- Extension recommendations.vscode/launch.json- Debugger configuration
Common Issues
Section titled “Common Issues”Server Island Rendering
Section titled “Server Island Rendering”If you see errors about mismatched server island rendering:
- Ensure
ASTRO_KEYis set in.env.local - Restart the development server
GraphQL Type Generation
Section titled “GraphQL Type Generation”If you see TypeScript errors about missing GraphQL types:
- Ensure the GraphQL schema is up to date
- Run
npm run codegenornpm run codegen:watch
Port Conflicts
Section titled “Port Conflicts”If port 3000 is in use:
- Kill the existing process
- Use port
3001instead
Verifying Your Setup
Section titled “Verifying Your Setup”Run these checks to ensure everything is working:
-
Development Server
Terminal window npm run devShould start without errors and show the homepage
-
Type Checking (coming soon)
Terminal window npm run typecheckShould pass without errors
-
Linting
Terminal window npm run lintShould pass without errors
-
GraphQL Types (coming soon)
Terminal window npm run codegenShould generate types without errors
Next Steps
Section titled “Next Steps”Once your environment is set up:
- Read our Core Concepts guide
- Make your First Contribution
- Review our Component Patterns
Getting Help
Section titled “Getting Help”If you encounter issues:
- Check the Common Issues section above
- Search our documentation
- Ask in #lp-frontend Slack channel