Personal template to make life easier
- Typescript
- Next.js
- Tailwind CSS for styling
- SWR for data fetching + caching
- Zustand for state management
A Node.js LTS setup with pnpm is recommended.
# install dependencies
pnpm
# serve with hot reload at localhost:3000
pnpm dev
# build for production
pnpm build
# run lint + type check
pnpm validate
# run unit tests
pnpm test
We use Next.js API routes to wrap requests heading to the Random User API. Then we use SWR for our data-fetching logic, allowing for data fetches to be wrapped in a custom hook.
components/
- UI/layout components that are used globally throughout project.hooks/
- Reusable hooks.utilities/
- Shared utility/helper functions.modules/
- Each feature and their business logic goes into this folder.pages/
- Next.js pages. Please read this page for more info about them.api/
- Next.js API routes. This is where the application's API/backend goes.
public/
- Next.js public directory, used for storing static assets.styles/
- Global CSS files.types/
- TypeScript types + interfaces that are used globally throughout the project.