Fundamentals
Folder Structure

Project Structure and Best Practices

Understanding the Project Structure:

To ensure a clean and maintainable project, we've adopted a well-organized folder structure:

agrimarket/
β”œβ”€β”€ app/
β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Header/
β”‚   β”‚   β”‚   β”œβ”€β”€ Header.tsx
β”‚   β”‚   β”‚   └── Header.module.css
β”‚   β”‚   β”œβ”€β”€ Footer/
β”‚   β”‚   β”‚   β”œβ”€β”€ Footer.tsx
β”‚   β”‚   β”‚   └── Footer.module.css
β”‚   β”‚   β”œβ”€β”€ ...
β”œβ”€β”€ public/
β”œβ”€β”€ prisma/
β”œβ”€β”€ tailwind.config.js
β”œβ”€β”€ next.config.js
└── package.json

Key Folders and Their Purpose:

  • app: Contains the main application code.
  • components: Stores reusable UI components, organized into subdirectories for better organization.
  • public: Stores static assets like images, fonts, and favicons.
  • prisma: Contains Prisma schema and migration files for database interactions.
  • tailwind.config.js: Configures Tailwind CSS for the project.
  • next.config.js: Configures Next.js for the project.
  • package.json: Manages project dependencies and scripts.

Best Practices for Contributors:

  • Follow the Folder Structure: Maintain the existing folder structure to ensure consistency and ease of navigation.
  • Use Clear and Concise Naming: Use descriptive names for files, components, and variables.
  • Write Clean and Well-Commented Code: Adhere to coding standards, use meaningful variable names, and add comments where necessary.
  • Leverage the Tech Stack: Utilize Next.js, TypeScript, Tailwind CSS, and shadcn UI to build efficient and maintainable components.
  • Write Comprehensive Tests: Write unit and integration tests to ensure code quality and prevent regressions.
  • Follow Git Best Practices: Use clear commit messages, create meaningful branches, and resolve merge conflicts promptly.