Skip to content

PBL6-HKTNN/web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

86 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CodeMy Web

A modern React application built with TypeScript, Vite, and TanStack Router for learning and development purposes.

πŸš€ Features

  • React 19 - Latest React with concurrent features
  • TypeScript - Full type safety and better developer experience
  • TanStack Router - File-based routing with type-safe navigation
  • TanStack Query - Powerful data fetching and caching
  • Tailwind CSS - Utility-first CSS framework
  • ESLint - Code linting and formatting
  • Husky + Commitlint - Git hooks for code quality
  • Path Aliases - Clean import statements

πŸ“ Project Structure

src/
β”œβ”€β”€ components/          # Reusable UI components
β”‚   β”œβ”€β”€ layout/         # Layout components
β”‚   β”œβ”€β”€ shared/         # Shared components
β”‚   └── ui/            # UI components
β”œβ”€β”€ hooks/              # Custom React hooks
β”‚   β”œβ”€β”€ queries/       # Query-related hooks
β”‚   └── use-persistance.ts
β”œβ”€β”€ routes/             # File-based routes (TanStack Router)
β”‚   β”œβ”€β”€ __root.tsx   # Root layout
β”‚   β”œβ”€β”€ index.tsx      # Home page (/)
β”‚   β”œβ”€β”€ about.tsx      # About page (/about)
β”‚   β”œβ”€β”€ contact.tsx    # Contact page (/contact)
β”‚   └── users/         # User-related routes
β”‚       β”œβ”€β”€ index.tsx  # Users list (/users)
β”‚       β”œβ”€β”€ $userId.tsx # User profile (/users/:userId)
β”‚       └── route.tsx # /users layout file
β”œβ”€β”€ services/           # API services and external integrations
β”œβ”€β”€ types/              # TypeScript type definitions
β”œβ”€β”€ utils/              # Utility functions
β”‚   └── persistance.ts
β”œβ”€β”€ contexts/           # React contexts
β”œβ”€β”€ conf/               # Configuration files
β”œβ”€β”€ router.tsx          # Router configuration
β”œβ”€β”€ main.tsx           # Application entry point
└── App.tsx            # Main app component

docs/                   # Documentation
β”œβ”€β”€ TANSTACK_FILEBASED_ROUTING.md

πŸ› οΈ Tech Stack

Core Framework

  • React 19 - UI library
  • TypeScript - Type safety
  • Vite - Build tool and dev server

Routing & Data

  • TanStack Router - File-based routing
  • TanStack Query - Data fetching and caching
  • Axios - HTTP client

Styling

  • Tailwind CSS - Utility-first CSS

Development Tools

  • ESLint - Code linting
  • Husky - Git hooks
  • Commitlint - Commit message linting

πŸš€ Getting Started

Prerequisites

  • Node.js (v20.18.3 or higher)
  • npm or yarn

Installation

  1. Clone the repository
git clone <repository-url>
cd codemy-web
  1. Install dependencies
npm install
npm run prepare
  1. Start the development server
npm run dev
  1. Open http://localhost:5173 in your browser

Available Scripts

# Development
npm run dev          # Start dev server
npm run build        # Build for production
npm run preview      # Preview production build

# Code Quality
npm run lint         # Run ESLint

# Git Hooks (auto-setup)
npm run prepare      # Setup Husky hooks

πŸ—‚οΈ Routing

This project uses TanStack Router with file-based routing. Routes are automatically generated from files in the src/routes/ directory.

Route Examples

  • src/routes/index.tsx β†’ / (Home)
  • src/routes/about.tsx β†’ /about
  • src/routes/users/$userId.tsx β†’ /users/:userId (Dynamic route)

Route Features

  • Type-safe navigation - Full TypeScript support
  • Dynamic routes - URL parameters with $param syntax
  • Nested routes - Folder-based organization
  • Route loaders - Data fetching before render
  • Route actions - Form handling and mutations
  • Automatic code splitting - Performance optimization

For detailed routing documentation, see docs/TANSTACK_FILEBASED_ROUTING.md.

🎨 Styling

The project uses Tailwind CSS for styling with a utility-first approach.

Key Classes Used

  • Responsive design with sm:, md:, lg: prefixes
  • Flexbox utilities: flex, items-center, justify-center
  • Spacing: p-8, m-4, space-x-4
  • Colors: bg-indigo-500, text-gray-900
  • Shadows: shadow-md, shadow-lg

πŸ”§ Development

Code Quality

The project enforces code quality through:

  • ESLint - Catches potential bugs and enforces style
  • TypeScript - Strict type checking
  • Pre-commit hooks - Automatic linting before commits
  • Commit message linting - Conventional commit format

Git Hooks & Commit Convention

This project uses Husky for Git hooks and Commitlint to enforce conventional commit messages.

Pre-commit Hook

  • Runs ESLint on staged files before each commit

Commit Message Linting

  • Enforces conventional commit format
  • Supported commit types: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test

Commit Message Format

type(scope): description

[optional body]

[optional footer]

Examples

feat: add user authentication
fix: resolve memory leak in component
docs: update API documentation
style: format code with prettier
refactor: simplify component logic

Path Aliases

Clean import statements using path aliases:

// Instead of relative paths
import Component from '../../../components/ui/Button'

// Use aliases
import Component from '@/components/ui/Button'
import { usePersistance } from '@/hooks/use-persistance'
import { apiClient } from '@/services/api'

Available aliases:

  • @/* β†’ src/*
  • @components/* β†’ src/components/*
  • @hooks/* β†’ src/hooks/*
  • @utils/* β†’ src/utils/*
  • @types/* β†’ src/types/*
  • @routes/* β†’ src/routes/*
  • @conf/* β†’ src/conf/*

πŸ“š Documentation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Commit Guidelines

Please follow conventional commit format. The pre-commit hooks will enforce this automatically.

πŸ“„ License

This project is private and proprietary.


Built with ❀️ using React, TypeScript, and modern web technologies.

About

PBL6's Web Admin + Client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages