This PR establishes the foundational infrastructure for the React Ecommerce boilerplate, including a complete authentication system with automatic token refresh, absolute path configuration across the monorepo, Poppins font integration, and extensive documentation for both web and admin apps.
Token Management
- ✅ Automatic access token storage on login/register
- ✅ Automatic refresh token storage
- ✅ Dual storage strategy (localStorage + memory for SSR support)
Auto Token Refresh
- ✅ Automatic token refresh on 401 errors
- ✅ Request queuing during refresh (prevents race conditions)
- ✅ Automatic retry of failed requests after token refresh
- ✅ Graceful fallback: redirects to
/loginif refresh fails - ✅ Backend-validated tokens (removed unnecessary client-side checks)
Implementation
// Simplified flow
Request (401) → Get Refresh Token → POST /api/auth/refresh
→ Save New Tokens → Retry Original Request → Resume Queued RequestsSDK Package (@react-shop/sdk)
- ✅ Changed internal alias from
@/to@sdk/to avoid conflicts - ✅ Added path mappings:
@sdk/*,@entities/*,@providers/*,@services/* - ✅ Updated all SDK files to use new aliases
Web App
- ✅ Configured
tsconfig.jsonwith absolute paths - ✅ Configured
next.config.jswith webpack aliases - ✅ Added mappings for
@lib,@entities,@providers,@services,@sdk
Benefits
// ❌ Before
import { setToken } from "../../../client";
import { User } from "../../../../entities/User";
// ✅ After
import { setToken } from "@sdk/client";
import { User } from "@entities/User";Poppins Font Integration
- ✅ Integrated using Next.js
next/font/googlefor optimal performance - ✅ Weights: 300, 400, 500, 600, 700
- ✅ Applied to both
font-sansandfont-headingin Tailwind config - ✅ Zero layout shift with
display: swap - ✅ CSS variable support:
--font-poppins
-
apps/web/FEATURES.md(266 lines)- Complete customer-facing store feature list
- Organized by: Public Pages, Shopping Experience, User Account, UI/UX, Technical
- 8-week implementation roadmap with 5 phases
- Priority-based task organization
-
apps/admin/FEATURES.md(357 lines)- Complete admin dashboard feature list
- Organized by: Dashboard, Product Management, Orders, Customers, Financial, Settings
- 8-week implementation roadmap with 6 phases
- Technical requirements for admin-specific patterns
-
apps/APPS_ARCHITECTURE.md(444 lines)- Comprehensive architecture guide
- Explains web vs admin app separation
- Data flow diagrams
- Authentication strategies
- Deployment options
- Development workflow
-
packages/sdk/AUTH_FLOW.md(342 lines)- Complete authentication flow documentation
- Token lifecycle diagram
- Usage examples for all auth hooks
- Backend requirements
- Security best practices
- Troubleshooting guide
-
QUICK_START.md(269 lines)- Developer quick reference
- Setup instructions
- Common commands
- Test credentials
- Code examples
- Troubleshooting tips
-
IMPLEMENTATION_SUMMARY.md(163 lines)- Recent updates summary
- Technical implementation details
- What's working checklist
- Next steps
-
ABSOLUTE_PATHS_GUIDE.md(updated)- Added
@sdkalias documentation - Updated examples with new paths
- Added
SDK (packages/sdk/)
src/client.ts - Token refresh logic + storage helpers
src/services/mutations/auth/useLogin/ - Save both tokens
src/services/mutations/auth/useRegister/ - Save both tokens
src/services/mutations/auth/useLogout/ - Updated imports
src/services/queries/products/ - Updated imports
src/providers/ApiProvider.tsx - Config validation
tsconfig.json - Changed @/ to @sdk/
Web App (apps/web/)
app/layout.tsx - Poppins font + apiConfig fix
tsconfig.json - Absolute path mappings
next.config.js - Webpack aliases
FEATURES.md - Complete rewrite
Design System (packages/design-system/)
src/styles/global.css - Removed redundant font-family
tailwind.config.ts - Updated font config to use Poppins
Documentation
apps/admin/FEATURES.md - New file
apps/APPS_ARCHITECTURE.md - New file
packages/sdk/AUTH_FLOW.md - New file
QUICK_START.md - New file
IMPLEMENTATION_SUMMARY.md - New file
ABSOLUTE_PATHS_GUIDE.md - Updated
Decision: Admin dashboard is a separate Next.js app (apps/admin), not a route in web app.
Reasons:
- 🔒 Security: Admin code doesn't ship to customers
- 📦 Performance: Smaller bundle size for customer store
- 🎨 Different UI/UX needs
- 🚀 Independent deployments
- 🔐 Separate RBAC system
Decision: Removed client-side refresh token validation, let backend handle it.
Benefits:
- Backend is single source of truth
- Simpler client logic
- More flexible validation rules
- Better error messages from backend
Decision: Use @sdk/ prefix instead of @/ for SDK package.
Reasons:
- Avoids conflicts with web app's
@/alias - Clearer import origins
- Better IDE autocomplete
- Consistent across monorepo
- Token refresh works automatically on 401
- Multiple requests queue correctly during refresh
- Failed refresh redirects to login
- Poppins font loads and applies correctly
- Absolute imports resolve in web app
- Absolute imports resolve in SDK
- Dev server starts without errors
- All documentation is accurate
- ✅ Automatic token refresh reduces failed requests
- ✅ Request queuing prevents duplicate refresh calls
- ✅ Poppins font optimized via Next.js
- ✅ Absolute imports improve code readability
- ✅ Comprehensive docs reduce onboarding time
- ✅ Clear architecture guide prevents confusion
- ✅ Quick start guide speeds up setup
- ✅ Centralized token management
- ✅ Type-safe SDK with React Query
- ✅ Well-documented feature roadmaps
- ✅ Clear separation of concerns (web vs admin)
- ✅ Authentication - Complete JWT flow with auto-refresh
- ✅ Token Storage - Persistent + memory storage
- ✅ Absolute Paths - Configured across monorepo
- ✅ Typography - Poppins font integrated
- ✅ Documentation - Comprehensive guides for all aspects
- ✅ Architecture - Clear app separation strategy
- ✅ Feature Roadmaps - 8-week plans for web & admin
- Setup admin app structure
- Create authentication pages (login, register)
- Build layout components (header, footer, navigation)
- Home page with featured products
- Product listing page with filters
- Product detail page
- Shopping cart functionality
- Product CRUD interface
- Category management
- Image upload
- Stock management
None. This is foundational work that doesn't affect existing functionality.
- Closes #[issue-number] - Add authentication system
- Closes #[issue-number] - Setup absolute paths
- Closes #[issue-number] - Add project documentation
✅ Font loads correctly in browser with proper weights
✅ http://localhost:3001 - Web app running without errors
✅ All absolute imports resolved
✅ Hot reload working
Focus Areas:
- Token refresh logic in
packages/sdk/src/client.ts - Absolute path configurations in
tsconfig.jsonfiles - Documentation accuracy and completeness
- Architecture decisions in
APPS_ARCHITECTURE.md
Testing:
- Start dev server:
pnpm dev - Check browser console for errors
- Verify font loads: inspect element to see Poppins
- Test imports: all
@sdk/*,@entities/*should resolve
- Code follows project conventions
- All tests pass (SDK and web app)
- Documentation is complete and accurate
- No console errors in dev mode
- Absolute imports work correctly
- Token refresh tested manually
- Poppins font verified in browser
- Commit messages follow conventional commits
- All changes committed and pushed
- Auth Flow: See
packages/sdk/AUTH_FLOW.md - Architecture: See
apps/APPS_ARCHITECTURE.md - Getting Started: See
QUICK_START.md - Web Features: See
apps/web/FEATURES.md - Admin Features: See
apps/admin/FEATURES.md
Commits: 8 commits Files Changed: 18 files Lines Added: ~2,500+ Documentation: 6 new files, 1 updated
Ready to merge and start building features! 🎉