Build the Branches Page
Your first real page built from data, not prose. The pattern you'll repeat on every page from now on.
The /branches page is the simplest page you can build that demonstrates the full React + Tailwind + Next.js pattern. By the end of this page you'll have:
- A working
/branchesroute - A reusable
BranchCardcomponent - A page that renders three branches from your
BRANCHESconstant
When a fourth branch opens, you add one entry to the array and everything updates.
1. Create the Route
Inside src/app/, create a new folder called branches. Inside it, create page.tsx.
Open src/app/branches/page.tsx and start with the simplest possible version:
Save. Visit http://localhost:3000/branches. You see "Our Branches" — unstyled, plain.
That's the smallest possible thing that proves the route works. Now we make it real.
2. Add the Data Import
Save. Refresh /branches. You see three branch cards in a row, each showing the data you put in constants.ts.
3. Take a Moment to Notice
Look at what just happened.
- You did not type "Andheri", "Powai", or "Thane" anywhere in this file. The names come from the constant.
- You did not type any phone numbers. They come from the constant.
- If you add a 4th branch —
Vashi— toBRANCHES, this page immediately shows a 4-column grid without you touchingbranches/page.tsx.
Try it now. Open src/lib/constants.ts. Add:
Save. Look at /branches. Four cards now. You didn't touch the page file.
This is the single biggest leap from Project 1. Data has one source. Every place that uses it updates automatically.
(Remove the Vashi entry if you don't actually want it. We added it just to feel the effect.)
4. Extract a BranchCard Component
The cards work but the page is getting long. Let's extract the card into its own reusable component — because we'll also use it on the home page.
Create src/components/BranchCard.tsx:
A few things to notice in the component file:
- Props interface is named
BranchCardProps. Convention:[ComponentName]Props. Branchinterface is local to this file for now. Later if more files need it, you'd move it tosrc/types/.childrenis optional. It lets us pass extra content into the card on different pages (e.g. a "Get Directions" link on the home page that isn't on the branches page).- No
'use client'directive. This is a Server Component by default — Next.js renders it on the server, sends just HTML. Faster, simpler, all you need for static cards.
Now simplify branches/page.tsx:
The page file is now 20 lines instead of 50. The styling lives in the component. The data lives in the constant. The page is just composition.
5. Add Page Metadata
Right above export default function BranchesPage, add:
This sets the browser tab title and the description that Google shows in search results. Every page should have this.
6. Commit and Push
Wait 90s. Check https://aurora-school.vercel.app/branches. The branches page is now live on the public internet, generated from your data.
7. What You Practised
Look back at what you just did:
- Created a new route by adding a folder +
page.tsx. - Imported data from a constants module.
- Used React's
.map()to render a list. - Extracted a reusable component with a typed
Propsinterface. - Used Tailwind classes for layout, typography, spacing.
- Added Next.js page metadata for SEO.
- Committed and pushed — live in 90 seconds.
That pattern repeats on every page you build from now on. The home page is the same pattern with different sections. The admissions page is the same pattern with a form added. The about page is the same pattern with mostly text.
The first page is the hardest. Each subsequent page takes half the time of the previous one because the mental model is the same.