Lin / frontend_structure.md
Zelyanoth's picture
fff
25f22bf
|
raw
history blame
3.66 kB

Frontend Structure Plan

Directory Structure

frontend/
β”œβ”€β”€ package.json           # Project dependencies and scripts
β”œβ”€β”€ public/                # Static assets
β”‚   β”œβ”€β”€ index.html         # Main HTML file
β”‚   └── favicon.ico        # Application icon
β”œβ”€β”€ src/                   # Source code
β”‚   β”œβ”€β”€ index.js           # Application entry point
β”‚   β”œβ”€β”€ App.js             # Root component
β”‚   β”œβ”€β”€ App.css            # Global styles
β”‚   β”œβ”€β”€ components/        # Reusable components
β”‚   β”‚   β”œβ”€β”€ Header/        # Navigation header
β”‚   β”‚   β”œβ”€β”€ Sidebar/       # Navigation sidebar
β”‚   β”‚   β”œβ”€β”€ Auth/          # Authentication components
β”‚   β”‚   β”‚   β”œβ”€β”€ LoginForm.js
β”‚   β”‚   β”‚   └── RegisterForm.js
β”‚   β”‚   β”œβ”€β”€ Dashboard/     # Dashboard components
β”‚   β”‚   β”œβ”€β”€ Sources/       # Source management components
β”‚   β”‚   β”œβ”€β”€ Posts/         # Post management components
β”‚   β”‚   └── Scheduler/     # Scheduling components
β”‚   β”œβ”€β”€ pages/             # Page components
β”‚   β”‚   β”œβ”€β”€ Home.js        # Home page
β”‚   β”‚   β”œβ”€β”€ Login.js       # Login page
β”‚   β”‚   β”œβ”€β”€ Register.js    # Registration page
β”‚   β”‚   β”œβ”€β”€ Dashboard.js   # Main dashboard
β”‚   β”‚   β”œβ”€β”€ Sources.js     # Source management page
β”‚   β”‚   β”œβ”€β”€ Posts.js       # Post management page
β”‚   β”‚   └── Schedule.js    # Scheduling page
β”‚   β”œβ”€β”€ services/          # API service layer
β”‚   β”‚   β”œβ”€β”€ api.js         # Axios instance and interceptors
β”‚   β”‚   β”œβ”€β”€ authService.js # Authentication API calls
β”‚   β”‚   β”œβ”€β”€ sourceService.js# Source management API calls
β”‚   β”‚   β”œβ”€β”€ postService.js # Post management API calls
β”‚   β”‚   └── scheduleService.js# Scheduling API calls
β”‚   β”œβ”€β”€ store/             # Redux store
β”‚   β”‚   β”œβ”€β”€ index.js       # Store configuration
β”‚   β”‚   β”œβ”€β”€ actions/       # Action creators
β”‚   β”‚   └── reducers/      # Reducers
β”‚   β”œβ”€β”€ hooks/             # Custom hooks
β”‚   β”‚   └── useAuth.js     # Authentication hook
β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   β”‚   └── helpers.js     # Helper functions
β”‚   └── styles/            # CSS styles
β”‚       β”œβ”€β”€ variables.css  # CSS variables
β”‚       β”œβ”€β”€ auth.css       # Authentication styles
β”‚       β”œβ”€β”€ dashboard.css  # Dashboard styles
β”‚       β”œβ”€β”€ sources.css    # Source management styles
β”‚       β”œβ”€β”€ posts.css      # Post management styles
β”‚       └── schedule.css   # Scheduling styles
└── README.md              # Frontend documentation

Key Components

App.js

  • Main application component
  • Routing configuration
  • Authentication state management
  • Layout structure (Header, Sidebar)

Components

  • Reusable UI components
  • Presentational components with minimal logic
  • Styled with CSS modules or styled-components

Pages

  • Page-level components that compose multiple components
  • Route-specific logic
  • Data fetching and state management

Services

  • API communication layer
  • Request/response interceptors
  • Error handling
  • Authentication token management

Store

  • Redux store configuration
  • State management for the entire application
  • Actions and reducers for each feature

Hooks

  • Custom React hooks for reusable logic
  • Custom authentication hook
  • Data fetching hooks

Styles

  • CSS files organized by feature
  • Global styles and variables
  • Responsive design considerations