Skip to main content

Command Palette

Search for a command to run...

week 1 (Part-1) : Folder Structure

Published
β€’4 min read
V

I am a CS student learning and exploring this technology field and eagerness to build something.

Folder Structure

Since this project is not built on top of a predefined framework, the folder structure was designed intentionally to keep the codebase modular, scalable, and easy to maintain.
Each directory has a clear responsibility, making the project easy to understand and extend.

β”œβ”€β”€ πŸ“ log
β”œβ”€β”€ πŸ“ src
β”‚   β”œβ”€β”€ πŸ“ mycli.egg-info
β”‚   β”‚   β”œβ”€β”€ πŸ“„ PKG-INFO
β”‚   β”‚   β”œβ”€β”€ πŸ“„ SOURCES.txt
β”‚   β”‚   β”œβ”€β”€ πŸ“„ dependency_links.txt
β”‚   β”‚   β”œβ”€β”€ πŸ“„ entry_points.txt
β”‚   β”‚   └── πŸ“„ top_level.txt
β”‚   └── πŸ“ setfile
β”‚       β”œβ”€β”€ πŸ“ GoogleOAuth
β”‚       β”‚   β”œβ”€β”€ 🐍 auth_server.py
β”‚       β”‚   β”œβ”€β”€ 🐍 db.py
β”‚       β”‚   └── 🐍 gmail_api.py
β”‚       β”œβ”€β”€ πŸ“ commands
β”‚       β”‚   β”œβ”€β”€ 🐍 gmail_auth.py
β”‚       β”‚   β”œβ”€β”€ 🐍 organize.py
β”‚       β”‚   └── 🐍 revert.py
β”‚       β”œβ”€β”€ πŸ“ core
β”‚       β”‚   └── 🐍 prediction.py
β”‚       β”œβ”€β”€ πŸ“ model
β”‚       β”‚   β”œβ”€β”€ πŸ“„ doc_classifier_svm.pkl
β”‚       β”‚   └── 🐍 model.py
β”‚       β”œβ”€β”€ πŸ“ utils
β”‚       β”‚   β”œβ”€β”€ 🐍 file_rules.py
β”‚       β”‚   β”œβ”€β”€ 🐍 history.py
β”‚       β”‚   β”œβ”€β”€ 🐍 logger.py
β”‚       β”‚   └── 🐍 reader.py
β”‚       β”œβ”€β”€ 🐍 __main__.py
β”‚       └── 🐍 cli.py
β”œβ”€β”€ βš™οΈ .gitignore
β”œβ”€β”€ πŸ“ README.md
β”œβ”€β”€ βš™οΈ pyproject.toml
└── πŸ“„ requirements.txt

πŸ—‚ logs/

This directory stores all runtime logs generated by the application.

Purpose:

  • Helps with debugging

  • Tracks user actions

  • Provides traceability when something goes wrong

Keeping logs separate prevents clutter in the main project and makes troubleshooting easier.


πŸ—‚ src/

The src directory contains the actual application code.
This follows a best practice used in professional Python projects to prevent import issues and keep the project clean.


πŸ—‚ mycli.egg-info/

This folder is auto-generated by Python packaging tools.

Purpose:

  • Stores metadata about the package

  • Includes dependency information and entry points

It allows the project to behave like a real, installable CLI tool.


πŸ—‚ setfile/

This is the core application package.
Everything related to the CLI and file organization logic lives here.


πŸ—‚ commands/

Each command supported by the CLI is implemented in a separate file.

Why this design?

  • Each file handles exactly one command

  • Follows the Separation of Concerns principle

  • Makes it easy to add new commands in the future

For example:

This keeps the CLI logic clean and easy to extend.


πŸ—‚ core/

This folder contains the heart of the project.

core/
└── prediction.py

prediction.py is responsible for making intelligent decisions about where files should go.
All higher-level features depend on this logic, which is why it lives in core.


πŸ—‚ model/

This directory contains everything related to machine learning.

model/
β”œβ”€β”€ doc_classifier_svm.pkl
└── model.py
  • model.py loads and manages the ML model

  • doc_classifier_svm.pkl is the trained SVM model used to classify documents

Using a separate folder for ML assets makes the project easier to manage and retrain.


πŸ—‚ utils/

This directory contains reusable helper code used across the project.

These utilities:

  • Handle logging

  • Track file history

  • Read file metadata

  • Apply file organization rules

This avoids code duplication and keeps the main logic clean.


πŸ—‚ GoogleOAuth/

This is an advanced feature of the project.

GoogleOAuth/
β”œβ”€β”€ auth_server.py
β”œβ”€β”€ db.py
└── gmail_api.py

It allows the CLI to:

  • Authenticate with Google

  • Access Gmail

  • Download email attachments

These attachments can then be organized automatically using the same ML-powered system.

This feature is isolated in its own folder so it doesn’t interfere with the main CLI logic.


🐍 cli.py

This is the main entry point of the application.

It:

  • Parses command-line arguments

  • Dispatches the correct command from the commands/ folder

  • Connects user input to the internal logic


🐍 main.py

This allows the project to be executed as:

python -m setfile

It makes the package behave like a real CLI application.


πŸ“„ pyproject.toml & requirements.txt

These files define:

  • Project metadata

  • Dependencies

  • Build configuration

They allow the project to be installed and run reliably on any system.


🧠 Why this structure works

This structure was chosen to ensure:

  • Scalability – new commands and features can be added easily

  • Maintainability – logic is cleanly separated

  • Professional packaging – the project behaves like a real Python CLI tool

  • AI integration – ML and prediction logic are cleanly isolated

Even without a framework, this design follows industry-level software architecture principles.

You Can see my project on and suggestions are welcomed :

Github Link : https://github.com/VivekPrajapati-Git/setfile

β€œThat’s all for today. This concludes Part 1 of this week’s series. In Part 2, we’ll dive deeper into the project workflow and explore how all the components come together.”