Search for a city and show current conditions from a public API.
Difficulty: Beginner · Technology: JavaScript, public weather API
Features to build
- City search
- Error handling
- Unit toggle
- Loading state
Step-by-step build plan
- Pick a public weather API and read its docs
- Fetch data for a typed city
- Display temperature and conditions
- Handle empty input, wrong city and network errors
- Add unit toggle and recent searches
The part most people find hard
Handling failed requests without breaking the page.
How to test it
Turn off your network and check the error message.
What to decide before you start
Read the API documentation first: the URL, parameters, response shape and any key or limit.
Questions an interviewer may ask about this project
- What happens when the API is down?
- How do you keep an API key out of public code?
- What is the difference between promises and async/await?
Mistakes to watch for
Not handling an unknown city, and exposing a key in front-end code.
Suggested extensions
Add user accounts, better error handling, automated tests and a README with screenshots. Each extension is a new talking point in interviews.
How to describe it on your resume
Created a weather app consuming a REST API with asynchronous JavaScript.
Portfolio tip
Deploy it, link both the live version and the code, and write two paragraphs about what you learned and what you would improve.