A modern notes application frontend built with Next.js (App Router), React, TypeScript, TailwindCSS, shadcn/ui, and Supabase Auth.
The app provides authenticated note management with favorites, CRUD operations, and a responsive UI.
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- UI: TailwindCSS + shadcn/ui
- State/Data: React Query + local UI state
- Auth: Supabase Authentication (JWT)
- API: REST backend (
/api/v1)
- Supabase email/password authentication
- Protected routes (redirect if not logged in)
- Create, edit, delete notes
- Mark notes as favorite
- Optimistic UI updates
- Responsive layout shell
- Type-safe API layer
app/
layout.tsx
page.tsx
auth/
login/page.tsx
signup/page.tsx
components/
layout-shell.tsx
notes-list.tsx
editor.tsx
auth/
AuthLayout.tsx
hooks/
use-auth.ts
use-notes.ts
use-debounce.ts
lib/
supabase-client.ts
query-client.ts
utils.ts
store/
notes-slice.ts
index.ts
shared/
routes.ts
schema.ts
types/
note.ts
- User signs up / logs in via Supabase
- Supabase returns access token (JWT)
- Token stored in Supabase session
useAuth()exposes session- Protected pages check session
- ❌ no session → redirect
/auth/login - ✅ session → render app
Backend base URL:
http://localhost:8000/api/v1
Endpoints used:
GET /notes
POST /notes
PUT /notes/:id
DELETE /notes/:idAll requests include:
Authorization: Bearer <supabase_access_token>Create .env.local:
NEXT_PUBLIC_SUPABASE_URL=your_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_key
NEXT_PUBLIC_API_URL=http://localhost:8000- Get session
- Login / signup
- Logout
- Redirect protection
- Fetch notes (React Query)
- Create / update / delete
- Cache invalidation
- Favorite toggle
- layout-shell → main app layout (sidebar + content)
- notes-list → sidebar list + favorite toggle
- editor → note editor
- AuthLayout → auth pages wrapper
Install dependencies:
npm installRun dev server:
npm run devOpen:
http://localhost:3000
Protected pages use auth guard:
const { user, loading } = useAuth();
if (!loading && !user) {
router.replace("/auth/login");
return null;
}Shared note type:
export interface Note {
id: string;
title: string;
content: string;
isFavorite: boolean;
}Used across:
- API layer
- React state
- UI components
npm run build
npm start- Offline sync
- Rich text editor
- Tags & search
- Drag reorder
- Collaborative notes
Frontend architecture and implementation by Sourav